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
Have 0 credits in your Anthropic account
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):
Describe the bug When the
completions
method is called from theAnthropicResponse
object, it does not check for an error in the response. For this reason, it will returnnil,
and we cannot see the actual API error.To Reproduce
I was able to reproduce this with the following lines of code (specification text is a local file in a project):
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:
Actual error from setting a debugger:
The line of code that is returning
nil
instead of the error is highlighted below: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.