mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-07-03 06:51:00 +02:00
feat: add dashscope variant for Alibaba Cloud DashScope API (#1010)
DashScope uses enable_thinking as a top-level parameter rather than inside extra_body as the Qwen docs suggest.
This commit is contained in:
parent
55e2a2a3ce
commit
6887076ce0
1 changed files with 21 additions and 0 deletions
|
|
@ -118,6 +118,26 @@ class QwenVariant(Variant):
|
|||
return {}
|
||||
|
||||
|
||||
class DashScopeVariant(Variant):
|
||||
"""Alibaba Cloud DashScope API (Qwen models via DashScope)."""
|
||||
|
||||
name = "dashscope"
|
||||
token_param = "max_completion_tokens"
|
||||
temperature_with_thinking = True
|
||||
|
||||
def completion_kwargs(self, max_output, temperature, thinking):
|
||||
enabled = thinking != "off"
|
||||
kwargs = {
|
||||
self.token_param: max_output,
|
||||
"temperature": temperature,
|
||||
"enable_thinking": enabled,
|
||||
}
|
||||
return kwargs
|
||||
|
||||
def thinking_kwargs(self, effort):
|
||||
return {}
|
||||
|
||||
|
||||
class MistralVariant(Variant):
|
||||
"""Mistral API (Mistral Large, etc.)."""
|
||||
|
||||
|
|
@ -181,6 +201,7 @@ VARIANTS = {
|
|||
"deepseek": DeepSeekVariant,
|
||||
"qwen": QwenVariant,
|
||||
"mistral": MistralVariant,
|
||||
"dashscope": DashScopeVariant,
|
||||
"glm": GlmVariant,
|
||||
"llama": LlamaVariant,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue