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 LLM swallows API errors #697

Closed
Jbrito6492 opened this issue Jul 7, 2024 · 0 comments
Closed

Anthropic LLM swallows API errors #697

Jbrito6492 opened this issue Jul 7, 2024 · 0 comments
Labels
BUG Something isn't working

Comments

@Jbrito6492
Copy link
Contributor

Describe the bug
When the completions method is called from the AnthropicResponse object, it does not check for an error in the response. For this reason, it will return nil, and we cannot see the actual API error.

To Reproduce

  1. Have 0 credits in your Anthropic account
  2. Try to use the client.

I was able to reproduce this with the following lines of code (specification text is a local file in a project):

anthropic = Langchain::LLM::Anthropic.new(api_key: ENV["ANTHROPIC_API_KEY"])
chunker = Langchain::Chunker::Semantic.new(specification_text, llm: anthropic).chunks

Expected behavior
I expect to see the error I am getting from the API so I can fix the issue instead of an obfuscated error.

Terminal commands & output
Commands you used and the terminal output.

Screenshots
Error from my downstream Rails app:
image

Actual error from setting a debugger:
image

The line of code that is returning nil instead of the error is highlighted below:
image

Desktop (please complete the following information):
Macbook Pro

  • OS: [e.g. OS X, Linux, Ubuntu, Windows]
    OS X

  • Ruby version [e.g. 3.1, 3.2, 3.3]
    3.2

  • Langchain.rb version [e.g. 0.13.0]
    0.13.5

Additional context
Add any other context about the problem here.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants