Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ The SDK ships with an interactive AI assistant, **DashScope SDK Expert**, built
| Text Embedding | text-embedding-v4, text-embedding-v3 | `TextEmbedding` |
| Multi-Modal Embedding | tongyi-embedding-vision-plus, qwen3-vl-embedding | `MultiModalEmbedding` |
| Text ReRank | qwen3-rerank, gte-rerank-v2 | `TextReRank` |
| Decision Model | decision-model-preview | `DecisionModel` |
| Image Generation | wan2.7-image-pro, qwen-image-2.0-pro | `ImageSynthesis` |
| Video Generation | wan2.7-t2v, wan2.7-i2v, happyhorse-1.0-t2v/i2v | `VideoSynthesis` |
| Speech Synthesis (TTS) | cosyvoice-v3.5-plus, cosyvoice-v1 | `SpeechSynthesizer`, `HttpSpeechSynthesizer` |
Expand Down
1 change: 1 addition & 0 deletions README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ SDK 内置了交互式 AI 助手 **DashScope SDK Expert**,基于随包提供
| 文本向量 | text-embedding-v4、text-embedding-v3 | `TextEmbedding` |
| 多模态向量 | tongyi-embedding-vision-plus、qwen3-vl-embedding | `MultiModalEmbedding` |
| 文本重排 | qwen3-rerank、gte-rerank-v2 | `TextReRank` |
| 决策模型 | decision-model-preview | `DecisionModel` |
| 图像生成 | wan2.7-image-pro、qwen-image-2.0-pro | `ImageSynthesis` |
| 视频生成 | wan2.7-t2v、wan2.7-i2v、happyhorse-1.0-t2v/i2v | `VideoSynthesis` |
| 语音合成(TTS) | cosyvoice-v3.5-plus、cosyvoice-v1 | `SpeechSynthesizer`、`HttpSpeechSynthesizer` |
Expand Down
3 changes: 3 additions & 0 deletions dashscope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
base_websocket_api_url,
validate_workspace_id,
)
from dashscope.decision import AioDecisionModel, DecisionModel
from dashscope.finetune.deployments import Deployments
from dashscope.finetune.finetunes import FineTunes
from dashscope.embeddings.batch_text_embedding import BatchTextEmbedding
Expand Down Expand Up @@ -169,6 +170,8 @@ def set_region(region: str, workspace_id: str = None):
"Application",
"TextReRank",
"AioTextReRank",
"DecisionModel",
"AioDecisionModel",
"Assistants",
"Threads",
"Messages",
Expand Down
55 changes: 55 additions & 0 deletions dashscope/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,61 @@ class AioTextReRank:
**kwargs: Any,
) -> ReRankResponse: ...

# ---------------------------------------------------------------------------
# Decision Model
# ---------------------------------------------------------------------------
class DecisionUsage:
input_tokens: int

class DecisionAnswer:
type: str
choice: str | None
noul: float | None
score: float | None
probabilities: Dict[str, float] | None
confidence: float | None
legend: Dict[str, str] | None

class DecisionModelResponse:
model: str
request_id: str
status_code: int
answers: Dict[str, DecisionAnswer] | None
usage: DecisionUsage | None
latency_ms: float | None
code: str
message: str

class DecisionModel:
class Models:
decision_model_preview: str
@classmethod
def call(
cls,
model: str,
state: Union[str, Dict[str, Any]],
questions: Dict[str, Dict[str, Any]],
api_key: str | None = None,
workspace: str | None = None,
extra_headers: Dict | None = None,
**kwargs: Any,
) -> DecisionModelResponse: ...

class AioDecisionModel:
class Models:
decision_model_preview: str
@classmethod
async def call(
cls,
model: str,
state: Union[str, Dict[str, Any]],
questions: Dict[str, Dict[str, Any]],
api_key: str | None = None,
workspace: str | None = None,
extra_headers: Dict | None = None,
**kwargs: Any,
) -> DecisionModelResponse: ...

# ---------------------------------------------------------------------------
# Image Synthesis
# ---------------------------------------------------------------------------
Expand Down
18 changes: 18 additions & 0 deletions dashscope/decision/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

from dashscope.decision.decision import (
AioDecisionModel,
DecisionAnswer,
DecisionModel,
DecisionModelResponse,
DecisionUsage,
)

__all__ = [
"DecisionModel",
"AioDecisionModel",
"DecisionAnswer",
"DecisionModelResponse",
"DecisionUsage",
]
Loading
Loading