Skip to content

fix(llm): harden bytedance/deepseek/qwen/anthropic/minimax/ollama/openai adapters#227

Closed
lIang70 wants to merge 2 commits into
mainfrom
pr/llm-provider-fixes
Closed

fix(llm): harden bytedance/deepseek/qwen/anthropic/minimax/ollama/openai adapters#227
lIang70 wants to merge 2 commits into
mainfrom
pr/llm-provider-fixes

Conversation

@lIang70

@lIang70 lIang70 commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Address review findings across the LLM provider layer.

Changes

  • 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:// and raw base64 image references, reject unsupported file URIs, disable CapAudio/penalty caps, and add a ResponseHeaderTimeout safety net.
  • MiniMax: add MiniMax-M3 and MiniMax-M2.1-highspeed entries, disable ignored caps (thinking/top_k/stop/penalties) for the Anthropic-compatible endpoint.
  • Ollama: record streaming metrics, apply default caps (Audio/File/JSONSchema/ToolChoice), 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.

Test Plan

  • go test ./sdkx/llm/... ./sdk/llm/... passes for all affected packages.

…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
lIang70 force-pushed the pr/llm-provider-fixes branch from 6cf967f to 076cdd0 Compare July 10, 2026 03:52
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>
@lIang70 lIang70 closed this Jul 10, 2026
@lIang70
lIang70 deleted the pr/llm-provider-fixes branch July 10, 2026 04:06
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