Skip to content

Commit b798263

Browse files
Qardclaude
andcommitted
refactor(e2e): remove unused useMessagesStreamHelper parameter
Now that auto-hook instrumentation also uses client.messages.stream(), the useMessagesStreamHelper flag is always true and the fallback branch is unreachable. Remove the parameter and simplify the stream-with-response operation to unconditionally use client.messages.stream(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 296c165 commit b798263

File tree

1 file changed

+13
-32
lines changed

1 file changed

+13
-32
lines changed

e2e/scenarios/anthropic-instrumentation/scenario.impl.mjs

Lines changed: 13 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@ const WEATHER_TOOL = {
2626

2727
async function runAnthropicInstrumentationScenario(
2828
Anthropic,
29-
{
30-
decorateClient,
31-
useBetaMessages = true,
32-
useMessagesStreamHelper = true,
33-
} = {},
29+
{ decorateClient, useBetaMessages = true } = {},
3430
) {
3531
const imageBase64 = (
3632
await readFile(new URL("./test-image.png", import.meta.url))
@@ -123,33 +119,18 @@ async function runAnthropicInstrumentationScenario(
123119
"anthropic-stream-with-response-operation",
124120
"stream-with-response",
125121
async () => {
126-
const stream =
127-
useMessagesStreamHelper === false
128-
? await client.messages.create({
129-
model: ANTHROPIC_MODEL,
130-
max_tokens: 32,
131-
temperature: 0,
132-
stream: true,
133-
messages: [
134-
{
135-
role: "user",
136-
content:
137-
"Count from 1 to 3 and include the words one two three.",
138-
},
139-
],
140-
})
141-
: client.messages.stream({
142-
model: ANTHROPIC_MODEL,
143-
max_tokens: 32,
144-
temperature: 0,
145-
messages: [
146-
{
147-
role: "user",
148-
content:
149-
"Count from 1 to 3 and include the words one two three.",
150-
},
151-
],
152-
});
122+
const stream = client.messages.stream({
123+
model: ANTHROPIC_MODEL,
124+
max_tokens: 32,
125+
temperature: 0,
126+
messages: [
127+
{
128+
role: "user",
129+
content:
130+
"Count from 1 to 3 and include the words one two three.",
131+
},
132+
],
133+
});
153134
await collectAsync(stream);
154135
},
155136
);

0 commit comments

Comments
 (0)