Skip to content

Conversation

@Alex-ai-future
Copy link

Title: Add DeepSeek Model Support for JSON Response Format

Description

DeepSeek models (deepseek-chat, deepseek-coder, etc.) are widely used but currently have compatibility issues with structured JSON output in this library.

Problem

DeepSeek models don't support OpenAI's json_schema response format. When requesting structured responses, they need to use the simpler json format instead.

Solution

Modified TranscriptConverter.extractResponseFormatFromJSON() to detect DeepSeek models and automatically use json format when a response schema is provided.

Changes

  • TranscriptConverter.swift: Added DeepSeek model check to fallback to json format
  • DeepSeekCompatibilityTests.swift: Added comprehensive tests for DeepSeek response format handling

Testing

Added tests verifying DeepSeek models correctly use json format while maintaining compatibility with existing GPT models.

This enables users to leverage DeepSeek models for structured output without API errors.

Add new .deepseek model type with specific context length (32K), max output tokens (8K), capabilities (text generation, function calling, streaming, tool access), and parameter constraints. Update request/response handling to use GPT builders for API compatibility, and fallback to JSON mode for schema conversion. Includes integration tests for DeepSeek model functionality.

Signed-off-by: alex <alex.tech.lab@outlook.com>
…compatibility

- Updated `extractResponseFormatWithSchema` and related methods in `TranscriptConverter` to accept an `OpenAIModel` parameter
- Added logic to fallback to `.json` mode for DeepSeek models that do not support `json_schema`
- Modified `OpenAILanguageModel` to pass the model when extracting response formats
- Ensures compatibility with various OpenAI-compatible models by handling schema support differences

Signed-off-by: alex <alex.tech.lab@outlook.com>
@Alex-ai-future Alex-ai-future force-pushed the fit-for-deepseek branch 2 times, most recently from a236a50 to 7d37d7e Compare January 20, 2026 09:31
Signed-off-by: alex <alex.tech.lab@outlook.com>
@Alex-ai-future Alex-ai-future force-pushed the fit-for-deepseek branch 2 times, most recently from a1704fe to 9578d29 Compare January 20, 2026 09:41
This reverts commit 9578d29.
@Alex-ai-future
Copy link
Author

And it is also necessary to build a special scheme to prompt

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.

1 participant