Skip to content

fix(mistral-ai): forward response_format for JSON schema#1615

Open
arun2728 wants to merge 1 commit intoPortkey-AI:mainfrom
arun2728:fix/mistral-response-format-json-schema
Open

fix(mistral-ai): forward response_format for JSON schema#1615
arun2728 wants to merge 1 commit intoPortkey-AI:mainfrom
arun2728:fix/mistral-response-format-json-schema

Conversation

@arun2728
Copy link
Copy Markdown

Description: (required)

  • Register response_format on the Mistral AI chat completion ProviderConfig so the gateway forwards OpenAI-compatible response_format (including type: "json_schema" and nested json_schema) to Mistral’s /v1/chat/completions API instead of dropping it during transformUsingProviderConfig.
  • When response_format.type is json_schema and the inner json_schema object omits name, set a default name of "response" so payloads match Mistral’s OpenAPI (required name + schema on the inner object) while staying compatible with clients that omit name.

Fixes #1559

Tests Run/Test cases added: (required)

  • Ran transformUsingProviderConfig(MistralAIChatCompleteConfig, …) with response_format.type: "json_schema" and verified the transformed body includes response_format and defaulted json_schema.name when omitted.
  • End-to-end: curl to local gateway (x-portkey-provider: mistral-ai) with response_format / JSON schema and confirmed a successful structured response from Mistral.

Type of Change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

@arun2728
Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update mistral integration

1 participant