Update of @langchain/mistralai necessary for using Mistral API in Autogen Studio
What happened?
Describe the bug
When using Autogen Studio with the Mistral API, the generated request payload includes an extra field ("name") inside the user object. The Mistral API only accepts "role" and "content" for user messages, so including the "name" field causes a HTTP 422 error ("Extra inputs are not permitted"). This issue causes all API calls to fail unless the extra field is removed.
To Reproduce
- Configure Autogen Studio with the following provider settings:
{ "provider": "autogen_ext.models.openai.OpenAIChatCompletionClient", "component_type": "model", "version": 1, "component_version": 1, "description": "Chat completion client for OpenAI hosted models.", "label": "OpenAIChatCompletionClient", "config": { "model": "mistral-small-latest", "model_info": { "family": "mistral", "model_name": "mistral-small-latest", "vision": false, "function_calling": true, "json_output": false }, "api_key": "YOUR_API_KEY", "api_type": "mistral", "base_url": "https://api.mistral.ai/v1/" } } - Trigger a chat completion request. The generated payload contains an object similar to:
{ "role": "user", "content": "Your prompt here", "name": "user" } - The Mistral API responds with a HTTP 422 error:
{ "detail": [ { "type": "extra_forbidden", "loc": ["body", "messages", 0, "user", "name"], "msg": "Extra inputs are not permitted", "input": "user" } ] }
Expected behavior
The API request payload should only include the "role" and "content" keys for the user object. With the correct payload structure, the Mistral API call should succeed without returning a 422 error.
Additional context
This issue has been addressed in the underlying library @langchain/mistralai, which in version 0.0.19 removes the extra "name" field from the request. Updating to version 0.0.19 resolves the problem.
Since Autogen Studio currently uses an older version, please update the dependency to @langchain/mistralai version 0.0.19 (or later) to ensure compatibility with the stricter validation rules of the Mistral API.
Feedback or further questions are welcome.
Which packages was the bug in?
AutoGen Studio (autogensudio)
AutoGen library version.
Python dev (main branch)
Other library version.
No response
Model used
All mistral models
Model provider
Mistral AI
Other model provider
No response
Python version
None
.NET version
None
Operating system
None
This may be resovled by #6063
cc @SongChiYoung
@ekzhu Thank you for information.
You're absolutely right — this issue can definitely be addressed via the modular transformer system in #6063.
To keep things more maintainable though, how about resolving this in a separate PR after #6063 is merged?
That way, we can track model-specific issues more clearly, while keeping #6063 focused on structural improvements.
To be addressed by: https://github.com/microsoft/autogen/issues/6151 -- help wanted