-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Problem with the user and assistant roles when using the Mistarl api. #757
Labels
bug
Something isn't working
Comments
@Neuro-Storm |
Using this on a multi agent setup myself and I get the same error. I'll see about the code but the agents are simple agents with some tools... The error is intermittent, not on every call, |
@keetrap Here is the code I used:
Here's what I get in the output:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When using the Mistarl API via LiteLLM or OpenAIServerModel, an error occurs due to the fact that the Mistral API expects a message with the User or Tool role, and receives it with the Assistant role.
Code to reproduce the error
I used this code:
model_mistral = LiteLLMModel(
model_id="mistral/mistral-large-latest",
api_key=mistral_api_key,
timeout=29,
)
and such
model_mistral_openAI = OpenAIServerModel(
model_id="mistral-large-latest",
api_base="https://api.mistral.ai/v1",
api_key=mistral_api_key,
)
Error logs (if any)
Error:
Error in generating model output:
litellm.BadRequestError: MistralException - Error code: 400 - {'object': 'error', 'message': 'Expected last role User or Tool (or
Assistant with prefix True) for serving but got assistant', 'type': 'invalid_request_error', 'param': None, 'code': None}
Expected behavior
Perhaps you should immediately pass the Assistant role with prefix True?
Packages version:
smolagents==1.9.2
Additional context
The text was updated successfully, but these errors were encountered: