mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-19 11:15:24 +03:00
fix(llm): apply DeepSeek capabilities to OpenRouter-namespaced models
- OpenRouter exposes DeepSeek as deepseek/<id>, which matched neither the exact IDs nor the patterns, so a thinking model like deepseek/deepseek-v4-flash fell through to _DEFAULT and had object-form tool_choice forced on it - strip the official deepseek/ namespace before lookup so it reuses the native quirks; deepseek/deepseek-chat still keeps tool_choice, and third-party finetunes on other publishers stay on _DEFAULT #1199
This commit is contained in:
@@ -118,6 +118,15 @@ _BY_PATTERN: list[tuple[re.Pattern[str], ModelCapabilities]] = [
|
||||
|
||||
def get_capabilities(model_name: str) -> ModelCapabilities:
|
||||
"""Resolve capabilities by exact ID, then pattern, then default."""
|
||||
# OpenRouter namespaces official DeepSeek models as ``deepseek/<id>``, so
|
||||
# strip that prefix to reuse the same quirks as the native provider — e.g.
|
||||
# ``deepseek/deepseek-v4-flash`` must suppress tool_choice like
|
||||
# ``deepseek-v4-flash`` does, not fall through to _DEFAULT (#1199). Only the
|
||||
# official namespace is stripped; third-party finetunes on other publishers
|
||||
# (e.g. ``tngtech/deepseek-...``) keep _DEFAULT, since their quirks are unknown.
|
||||
if model_name.startswith("deepseek/"):
|
||||
model_name = model_name.removeprefix("deepseek/")
|
||||
|
||||
if model_name in _BY_ID:
|
||||
return _BY_ID[model_name]
|
||||
for pattern, caps in _BY_PATTERN:
|
||||
|
||||
Reference in New Issue
Block a user