fix(mistral-ai): forward response_format for JSON schema#1615
Open
arun2728 wants to merge 1 commit intoPortkey-AI:mainfrom
Open
fix(mistral-ai): forward response_format for JSON schema#1615arun2728 wants to merge 1 commit intoPortkey-AI:mainfrom
arun2728 wants to merge 1 commit intoPortkey-AI:mainfrom
Conversation
Author
|
Hi @roh26it, just following up on the PR I raised last week. The fix is non-breaking and only addresses the issue without affecting existing functionality. Please take a look whenever you get a chance. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: (required)
response_formaton the Mistral AI chat completionProviderConfigso the gateway forwards OpenAI-compatibleresponse_format(includingtype: "json_schema"and nestedjson_schema) to Mistral’s/v1/chat/completionsAPI instead of dropping it duringtransformUsingProviderConfig.response_format.typeisjson_schemaand the innerjson_schemaobject omitsname, set a defaultnameof"response"so payloads match Mistral’s OpenAPI (requiredname+schemaon the inner object) while staying compatible with clients that omitname.Fixes #1559
Tests Run/Test cases added: (required)
transformUsingProviderConfig(MistralAIChatCompleteConfig, …)withresponse_format.type: "json_schema"and verified the transformed body includesresponse_formatand defaultedjson_schema.namewhen omitted.curlto local gateway (x-portkey-provider: mistral-ai) withresponse_format/ JSON schema and confirmed a successful structured response from Mistral.Type of Change: