Helicone Community Page

Updated 5 months ago

Error using Helicone with the Claude 3 + streaming

At a glance

The community member is experiencing an error when streaming responses from Claude 3 using the Anthropic Typescript SDK. The error occurs after several tokens and is related to parsing the JSON response. However, the issue does not occur when the community member goes directly to the Anthropic API by omitting the baseURL and defaultHeaders in the client constructor.

In the comments, another community member acknowledges the issue and mentions that the Anthropic SDK has a known problem, which they are working on a temporary patch for. Another community member suggests that the issue should be fixed with the latest version of the Anthropic SDK, and a third community member confirms that updating to version 0.17.1 resolved the problem.

Useful resources
When streaming responses from Claude 3 using the Anthropic Typescript SDK, after several tokens, I get an error:

Plain Text
Could not parse message into JSON: 
From chunk: [ 'event: content_block_delta' ]
 ⨯ Error: failed to pipe response


This error doesn't happen if I go directly to Anthropic's API by omitting the baseURL and defaultHeaders in the client constructor:

``function getAnthropic() { return new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY, // baseURL: 'https://anthropic.hconeai.com/', // defaultHeaders: { // 'Helicone-Auth': Bearer ${process.env.ANTHROPIC_API_KEY}`,
// },
});
}
a
J
a
4 comments
Thanks for flagging this!! The team will look into this first thing this morning and update you when we have a fix
hi this should be fixed with the latest version of anthropic. see https://github.com/anthropics/anthropic-sdk-typescript/issues/318
Just updated to 0.17.1 and it works! Thanks
Add a reply
Sign up and join the conversation on Discord