History

test(amp): update tests to expect thinking blocks to pass through during streaming

Aikins Laryea committed 7 months ago

Commit ff7dbb51 parent e34b2b41 file · +4 −7Browse files

Unified · Split

internal/api/modules/amp/response_rewriter_test.go+4−7
@@ -100,17 +100,14 @@ func TestRewriteStreamChunk_MessageModel(t *testing.T) { · 99 unmodified lines
100100 }
101101 }
102102
103−func TestRewriteStreamChunk_SuppressesThinkingContentBlockFrames(t *testing.T) {
104− rw := &ResponseRewriter{suppressedContentBlock: make(map[int]struct{})}
103+func TestRewriteStreamChunk_PassesThroughThinkingBlocks(t *testing.T) {
104+ rw := &ResponseRewriter{}
105105
106106 chunk := []byte("event: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":0,\"content_block\":{\"type\":\"thinking\",\"thinking\":\"\"}}\n\nevent: content_block_delta\ndata: {\"type\":\"content_block_delta\",\"index\":0,\"delta\":{\"type\":\"thinking_delta\",\"thinking\":\"abc\"}}\n\nevent: content_block_stop\ndata: {\"type\":\"content_block_stop\",\"index\":0}\n\nevent: content_block_start\ndata: {\"type\":\"content_block_start\",\"index\":1,\"content_block\":{\"type\":\"tool_use\",\"name\":\"bash\",\"input\":{}}}\n\n")
107107 result := rw.rewriteStreamChunk(chunk)
108108
109− if contains(result, []byte("\"thinking\"")) || contains(result, []byte("\"thinking_delta\"")) {
110− t.Fatalf("expected thinking content_block frames to be suppressed, got %s", string(result))
111− }
112− if contains(result, []byte("content_block_stop")) {
113− t.Fatalf("expected suppressed thinking content_block_stop to be removed, got %s", string(result))
109+ if !contains(result, []byte("\"thinking_delta\"")) {
110+ t.Fatalf("expected thinking blocks to pass through in streaming, got %s", string(result))
114111 }
115112 if !contains(result, []byte("\"tool_use\"")) {
116113 t.Fatalf("expected tool_use content_block frame to remain, got %s", string(result))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t