You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a3e8ceb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: README.md
+83Lines changed: 83 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -118,6 +118,8 @@ else:
118
118
print(response.output.choices[0].message.content)
119
119
```
120
120
121
+
For the full list of exception classes and when each is raised, see the [Error Handling Reference](docs/guides/error-handling.md).
122
+
121
123
## API Key Authentication
122
124
123
125
The SDK uses API key for authentication. To obtain an API Key, see [How to get an API Key](https://help.aliyun.com/en/model-studio/get-api-key). Please refer to [official documentation for alibabacloud china](https://www.alibabacloud.com/help/en/model-studio/) and [official documentation for alibabacloud international](https://www.alibabacloud.com/help/en/model-studio/) regarding how to obtain your api-key.
@@ -252,6 +254,8 @@ print(response)
252
254
253
255
A complete runnable example is available in [`samples/set_region_example.py`](samples/set_region_example.py).
254
256
257
+
For request timeouts, custom headers, proxy support, and closing shared connection pools, see the [Advanced Configuration guide](docs/guides/configuration.md).
258
+
255
259
## AI Assistant: DashScope SDK Expert
256
260
257
261
The SDK ships with an interactive AI assistant, **DashScope SDK Expert**, built on the bundled Agentic CLI (`dashscope/acli`) framework. For DashScope SDK/CLI users it is the recommended way to get development consultation and AI coding help — answering SDK/API questions, generating runnable examples, showing CLI usage, and diagnosing errors, right in your terminal.
Every field that accepts a URL (`image`, `audio`, `video` in messages; `images` on `ImageSynthesis`, etc.) also accepts a local file path — the SDK uploads it to OSS automatically, no manual header needed:
For the full job/deployment lifecycle (listing, canceling, streaming events, scaling), see the [Fine-tuning & Deployment Lifecycle guide](docs/guides/fine-tuning.md).
690
+
691
+
### Assistants API (Deprecated)
692
+
693
+
The legacy Assistants API (`Assistants`, `Threads`, `Runs`, `Messages`) still works but is deprecated — see the [Assistants API guide](docs/guides/assistants.md) for the full surface and migration notes. New code should use [`Generation`](#quick-start) or [`MultiModalConversation`](#multimodal-understanding-vision) instead.
694
+
614
695
## CLI Usage
615
696
616
697
Every SDK capability is also available as a `dashscope` sub-command (installed with the base package), for scripting or quick checks without writing Python:
@@ -676,5 +757,7 @@ response.output # Any: the request output (shape depends on the API calle
676
757
response.usage # Any: token/quota usage information
677
758
```
678
759
760
+
For how `output`/`usage` support both dict-style and attribute-style access, and the per-capability response subclasses, see the [Response Object Model guide](docs/guides/response-types.md).
761
+
679
762
## License
680
763
This project is licensed under the Apache License (Version 2.0).
> **Deprecated.** The Assistants API (`dashscope.assistants` and `dashscope.threads`) is deprecated and will be removed in a future release. Please migrate to [`Generation`](../../README.md#quick-start) or [`MultiModalConversation`](../../README.md#multimodal-understanding-vision) with the `messages` parameter. See the [migration reference](https://help.aliyun.com/zh/model-studio/synchronous-call-api-reference) for details.
6
+
7
+
This guide documents the existing surface for maintaining code that still depends on it.
8
+
9
+
## Basic Flow
10
+
11
+
Create an assistant, start a thread, run it, and wait for completion:
12
+
13
+
```python
14
+
from dashscope import Assistants, Threads, Runs, Messages
15
+
16
+
assistant = Assistants.create(
17
+
model="qwen-max",
18
+
name="smart helper",
19
+
description="A tool helper.",
20
+
instructions="You are a helpful assistant.",
21
+
)
22
+
23
+
thread = Threads.create(
24
+
messages=[{"role": "user", "content": "How do I make beef stew?"}],
25
+
)
26
+
27
+
run = Runs.create(thread.id, assistant_id=assistant.id)
Attaching a file uses a separate `Files` class under `dashscope.assistants` (distinct from the top-level `dashscope.Files` used for fine-tuning uploads):
0 commit comments