-
Notifications
You must be signed in to change notification settings - Fork 17.3k
langchain: catch if there are only system messages in a prompt for anthropic #30822
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of blocking this ourselves, could we catch the error from Anthropic and add whatever clarifications we want to the error message? This way if Anthropic adds support we will not be blocking.
Here's an example:
def _handle_openai_bad_request(e: openai.BadRequestError) -> None: |
Will need to handle for all invocation modes (sync/async invoke and stream)
okay, I just thought it would be wiser to do this before sending a call to Anthropic that would get us a bad request, but yes it does makes sense to expect them to change it down the line :) |
throws the errors, wasn't sure if you wanted tests but this works now |
PR message: Not sure if I put the check at the right spot, but I thought throwing the error before the loop made sense to me.
Description: Checks if there are only system messages using AnthropicChat model and throws an error if it's the case. Check Issue for more details
Issue: #30764