Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Bug]: Incorrect AnthropicException #2662

Closed
morgante opened this issue Mar 23, 2024 · 4 comments
Closed

[Bug]: Incorrect AnthropicException #2662

morgante opened this issue Mar 23, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@morgante
Copy link

What happened?

When sending a simple and correct series of messages for Anthropic, I receive this error:

Error code: 400 - {'error': {'message': "AnthropicException - AnthropicException - Invalid role passed in - {'role': 'user', 'content': '\\nWhat is the query for `console.info` => `consdole.heaven`\\n'}", 'type': None, 'param': None, 'code': 400}}

Messages:

[
    {
        "role": "user",
        "content": "\nWhat is the query for `console.log` => `console.error`\n"
    },
    {
        "role": "assistant",
        "content": "\nThis is the GritQL query for the given before/after examples:\n<gritql>\n`console.log` => `console.error`\n</gritql>\n"
    },
    {
        "role": "user",
        "content": "\nWhat is the query for `console.info` => `consdole.heaven`\n"
    }
]

Relevant log output

No response

Twitter / LinkedIn details

No response

@krrishdholakia
Copy link
Contributor

working to repro this issue.

@morgante
Copy link
Author

It looks like you fixed it here: b9143a0

I would prefer that you not rewrite my messages at all, so I opened #2663

@krrishdholakia
Copy link
Contributor

unable to repro this
Screenshot 2024-03-23 at 2 06 30 PM

@krrishdholakia
Copy link
Contributor

@morgante can you expand on that? If you pass consecutive user or assistant messages, claude will throw an error. To avoid this (since this would work on openai), we merge consecutive messages.

Would you rather we raise an error?

@BerriAI BerriAI locked and limited conversation to collaborators Mar 23, 2024
@krrishdholakia krrishdholakia converted this issue into discussion #2664 Mar 23, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants