fix(llm): harden bytedance/deepseek/qwen/anthropic/minimax/ollama/openai adapters#227
Closed
lIang70 wants to merge 2 commits into
Closed
fix(llm): harden bytedance/deepseek/qwen/anthropic/minimax/ollama/openai adapters#227lIang70 wants to merge 2 commits into
lIang70 wants to merge 2 commits into
Conversation
…nai adapters Address review findings across the LLM provider layer: - DeepSeek: default to the current deepseek-v4-flash model and read prompt_cache_hit_tokens when the nested cached_tokens field is absent. - Qwen: mirror MaxTokens to the max_tokens field the DashScope endpoint honors, inject top_k, and disable JSONSchema/FrequencyPenalty. - Anthropic: support https/base64 image references, reject unsupported file URIs, disable CapAudio/penalty caps, and add a ResponseHeaderTimeout safety net. - MiniMax: add MiniMax-M3 and M2.1-highspeed entries, disable ignored caps (thinking/top_k/stop/penalties) for the Anthropic-compatible endpoint. - Ollama: record streaming metrics, apply default caps, and add a response timeout safety net. - OpenAI: add a cached-input fallback for DeepSeek-style prompt_cache_hit_tokens. - Bytedance: add Responses API extras handling (store, previous_response_id, thinking, reasoning_effort), image file_id routing, file data filename defaults, and improved error classification. All affected packages pass go test ./sdkx/llm/... ./sdk/llm/.... Co-authored-by: Cursor <cursoragent@cursor.com>
lIang70
force-pushed
the
pr/llm-provider-fixes
branch
from
July 10, 2026 03:52
6cf967f to
076cdd0
Compare
Main has refactored sdkx/llm/openai into chat/responses/shared and minimax into anthropic.go/openai.go. The previous cherry-pick applied the exp/recall-graph-ledger versions to the new paths, breaking the build. Changes: - Move cached-input-token fallback (OpenAI nested + DeepSeek top-level) into shared.CachedInputTokensFromUsage and use it from chat/openai.go and chat/stream.go. - Keep the DeepSeek/Qwen wrappers on openai.NewChat, since these providers are Chat-Completions compatible, not Responses API compatible. - Port MiniMax M3 catalog/caps updates to minimax/anthropic.go. - Add regression tests for the cached-token fallback. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Address review findings across the LLM provider layer.
Changes
deepseek-v4-flashmodel and readprompt_cache_hit_tokenswhen the nestedcached_tokensfield is absent.MaxTokensto themax_tokensfield the DashScope endpoint honors, injecttop_k, and disableJSONSchema/FrequencyPenalty.https://and raw base64 image references, reject unsupported file URIs, disableCapAudio/penalty caps, and add aResponseHeaderTimeoutsafety net.MiniMax-M3andMiniMax-M2.1-highspeedentries, disable ignored caps (thinking/top_k/stop/penalties) for the Anthropic-compatible endpoint.Audio/File/JSONSchema/ToolChoice), and add a response timeout safety net.prompt_cache_hit_tokens.store,previous_response_id,thinking,reasoning_effort), imagefile_idrouting, file data filename defaults, and improved error classification.Test Plan
go test ./sdkx/llm/... ./sdk/llm/...passes for all affected packages.