Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anthropic-AI sdk version upgrade for Issue: Unexpected End of JSON input #4716

Closed
5 tasks done
sunnyunde-xooa opened this issue Mar 12, 2024 · 2 comments · Fixed by #4724
Closed
5 tasks done

Anthropic-AI sdk version upgrade for Issue: Unexpected End of JSON input #4716

sunnyunde-xooa opened this issue Mar 12, 2024 · 2 comments · Fixed by #4724
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@sunnyunde-xooa
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

const llm = new ChatAnthropic({
  modelName: "claude-2",
  anthropicApiKey: "ANTHROPIC_API_KEY",
  clientOptions: {
    baseURL: "https://anthropic.hconeai.com/",
    defaultHeaders: {
      "Helicone-Auth": `Bearer HELICONE_API_KEY`,
    }
  }
});

Error Message and Stack Trace (if applicable)

[3/12/2024 2:58:05 PM] @anthropic-ai/sdk/streaming.js:64 Could not parse message into JSON:
[3/12/2024 2:58:05 PM] @anthropic-ai/sdk/streaming.js:65 From chunk: [ 'event: content_block_delta' ]
[3/12/2024 2:58:05 PM] dist/tracers/console.cjs:157 [llm/error] [1:chain:LLMChain > 2:llm:ChatAnthropic] [864ms] LLM run errored with error: "Unexpected end of JSON input"

Description

I am trying to use Helicone with Anthropic as per the documentation mentioned in the Helicone.
Here I am frequently getting this message on further investigation I found that it was the issue of the Anthropic-sdk which has been fixed in the latest version:
Issue link: anthropics/anthropic-sdk-typescript#292

System Info

  • langchain: v1.22.19
  • Node Version: v.18.13.0
  • @langchain/anthropic: 0.1.5
Copy link

dosubot bot commented Mar 12, 2024

It's great that you've identified the issue and found a potential fix in the latest version of the Anthropic-SDK. Your contribution to upgrading the SDK version would be valuable to the community. Thank you for considering this improvement!

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Mar 12, 2024
@jacoblee93
Copy link
Collaborator

Will patch this today, thanks for the heads up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants