Skip to content

feat: check and support native structured output for different model platforms#3924

Open
Zephyroam wants to merge 16 commits intomasterfrom
1695-feature-request-check-and-support-native-structured-output-for-different-model-platforms
Open

feat: check and support native structured output for different model platforms#3924
Zephyroam wants to merge 16 commits intomasterfrom
1695-feature-request-check-and-support-native-structured-output-for-different-model-platforms

Conversation

@Zephyroam
Copy link
Copy Markdown
Collaborator

Related Issue

Closes #1695

Description

Platform Structured Output Support Reference

Platform Backend Class Camel Code Status Official Docs Comments
AIHUBMIX AihubMixModel JSON_SCHEMA https://docs.aihubmix.com/en/api/Aihubmix-Integration OpenAI Compatible, Not explicitly documented
AIML AIMLModel JSON_SCHEMA https://docs.aimlapi.com/api-references/text-models-llm/openai/gpt-5 Only a subset of models support JSON_SCHEMA
ANTHROPIC AnthropicModel / (leave DEFAULT) https://platform.claude.com/docs/en/build-with-claude/structured-outputs Handled in #3821
ATLASCLOUD AtlasCloudModel JSON_SCHEMA https://www.atlascloud.ai/docs/en/createChatCompletion OpenAI Compatible, Not explicitly documented
AWS_BEDROCK AWSBedrockModel JSON_SCHEMA https://docs.aws.amazon.com/bedrock/latest/userguide/structured-output.html Only support bedrock native API, handled in #3901
AZURE AzureOpenAIModel JSON_SCHEMA https://learn.microsoft.com/azure/ai-services/openai/how-to/structured-outputs Native support
CEREBRAS CerebrasModel JSON_SCHEMA https://inference-docs.cerebras.ai/resources/openai OpenAI Compatible
COHERE CohereModel JSON_SCHEMA https://docs.cohere.com/docs/structured-outputs Native json_object with schema field
COMETAPI CometAPIModel JSON_SCHEMA https://apidoc.cometapi.com/ OpenAI Compatible, Not explicitly documented
CRYNUX CrynuxModel JSON_SCHEMA https://docs.crynux.ai/ Not explicitly documented
DEEPSEEK DeepSeekModel JSON_OBJECT https://api-docs.deepseek.com/guides/json_mode
GEMINI GeminiModel JSON_SCHEMA https://ai.google.dev/gemini-api/docs/structured-output
GROQ GroqModel JSON_SCHEMA https://console.groq.com/docs/structured-outputs Only a subset of models support JSON_SCHEMA
INTERNLM InternLMModel JSON_SCHEMA https://internlm.intern-ai.org.cn/api/document Not explicitly documented
LITELLM LiteLLMModel JSON_SCHEMA https://docs.litellm.ai/docs/completion/json_mode Only a subset of models support JSON_SCHEMA
LMSTUDIO LMStudioModel JSON_SCHEMA https://lmstudio.ai/docs/developer/openai-compat/structured-output
MINIMAX MinimaxModel JSON_SCHEMA https://platform.minimax.io/docs/api-reference/text-openai-api OpenAI Compatible, Not explicitly documented
MISTRAL MistralModel JSON_OBJECT https://docs.mistral.ai/capabilities/structured_output/
MOONSHOT MoonshotModel JSON_OBJECT https://platform.moonshot.cn/docs/guide/use-json-mode-feature-of-kimi-api
NOVITA NovitaModel JSON_SCHEMA https://novita.ai/docs/api-reference/model-apis-llm-create-chat-completion OpenAI Compatible, Not explicitly documented
OPENAI OpenAIModel JSON_SCHEMA https://platform.openai.com/docs/guides/structured-outputs Native support
OPENROUTER OpenRouterModel JSON_SCHEMA https://openrouter.ai/docs/features/structured-outputs Only a subset of models support JSON_SCHEMA
PPIO PPIOModel JSON_SCHEMA https://ppio.com/docs/model/llm-structured-outputs Only a subset of models support JSON_SCHEMA
QIANFAN QianfanModel JSON_OBJECT https://cloud.baidu.com/doc/qianfan-api/s/3m7of64lb
QWEN QwenModel JSON_SCHEMA https://help.aliyun.com/zh/model-studio/qwen-structured-output Only a subset of models support JSON_SCHEMA
REKA RekaModel JSON_SCHEMA https://docs.reka.ai/research/structured-output
SAMBA SambaModel JSON_SCHEMA https://docs.sambanova.ai/docs/en/features/function-calling
SILICONFLOW SiliconFlowModel JSON_OBJECT https://docs.siliconflow.cn/cn/userguide/guides/json-mode
TOGETHER TogetherAIModel JSON_SCHEMA https://docs.together.ai/docs/json-mode Only a subset of models support JSON_SCHEMA
VOLCANO VolcanoModel JSON_SCHEMA https://www.volcengine.com/docs/82379/1568221
YI YiModel JSON_SCHEMA https://platform.lingyiwanwu.com/docs OpenAI Compatible, Not explicitly documented
ZHIPU ZhipuAIModel JSON_OBJECT https://open.bigmodel.cn/dev/howuse/jsonformat

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Checklist

  • I have read and agree to the AI-Generated Code Policy (required)
  • I have linked this PR to an issue (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and run uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 12, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 8c7c3a6d-56a2-4dba-8bd3-2bed67b99f2c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 1695-feature-request-check-and-support-native-structured-output-for-different-model-platforms
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added the Review Required PR need to be reviewed label Mar 12, 2026
@Zephyroam Zephyroam requested a review from Wendong-Fan March 12, 2026 10:36
@Zephyroam Zephyroam mentioned this pull request Mar 13, 2026
10 tasks
Copy link
Copy Markdown
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added enhance in #3930, feel free to check

@fengju0213 fengju0213 modified the milestone: Sprint 50 Mar 16, 2026
Copy link
Copy Markdown
Collaborator

@fengju0213 fengju0213 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @Zephyroam desides what Wendong has already corrected,find a issue.

self._async_client.chat.completions.create,
messages=messages,
model=self.model_type,
**request_config,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we remove response_format here?

fengju0213 and others added 4 commits March 18, 2026 16:02
…ive-structured-output-for-different-model-platforms
…d-output-for-different-model-platforms' of https://github.com/camel-ai/camel into 1695-feature-request-check-and-support-native-structured-output-for-different-model-platforms
…ive-structured-output-for-different-model-platforms
@fengju0213
Copy link
Copy Markdown
Collaborator

fengju0213 commented Mar 18, 2026

overall ,looks good to me now,thanks @Zephyroam still need some time to check the model doc,will give you feedback within today
btw,pytest need be fixed

@fengju0213
Copy link
Copy Markdown
Collaborator

i think qwenmodel need change to json object according to docs

@fengju0213
Copy link
Copy Markdown
Collaborator

fixed the qwen model and cicdi ,also migrated the JSON prompt injection logic from the latest user message to the system message, as injecting it into user messages could interfere with KV cache reuse.

fengju0213 and others added 2 commits March 19, 2026 22:05
@fengju0213 fengju0213 modified the milestones: Sprint 50, Sprint 51 Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Review Required PR need to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Check and support native structured output for different model platforms

3 participants