Skip to content

Commit 8e50172

Browse files
docs: add TingWu guide, NLU and tokenizer coverage, assistants file ops
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent b2391c0 commit 8e50172

15 files changed

Lines changed: 605 additions & 10 deletions

‎README.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,24 @@ async def main():
567567
asyncio.run(main())
568568
```
569569

570+
### Text Understanding (NLU)
571+
572+
`Understanding` runs zero-shot information extraction or classification against a fixed label set, without training a custom model:
573+
574+
```python
575+
from dashscope import Understanding
576+
577+
response = Understanding.call(
578+
model=Understanding.Models.opennlu_v1,
579+
sentence="老师今天表扬我了",
580+
labels="积极,消极",
581+
task="classification",
582+
)
583+
print(response.output["text"])
584+
```
585+
586+
Set `task="extraction"` (the default) to pull spans matching `labels` out of `sentence` instead of classifying it.
587+
570588
### Code Generation
571589

572590
`CodeGeneration` powers task-specific coding scenarios (`Scenes`): natural-language-to-code, code explanation, comment generation, commit messages, unit tests, code Q&A, and natural-language-to-SQL.
@@ -854,6 +872,25 @@ recognition.stop()
854872

855873
For voice cloning, pronunciation fixes, real-time speech translation, and custom ASR hot words, see the [Advanced Audio guide](docs/guides/realtime-audio.md).
856874

875+
### TingWu (Meeting & Industrial Audio Analysis)
876+
877+
`TingWu` runs domain-specific audio analysis tasks (industrial inspections, automotive service calls) against a file URL:
878+
879+
```python
880+
from dashscope.multimodal.tingwu.tingwu import TingWu
881+
882+
response = TingWu.call(
883+
model="tingwu-automotive-service-inspection",
884+
user_defined_input={
885+
"fileUrl": "http://example.com/call-recording.mp3",
886+
"appid": "your-app-id",
887+
},
888+
)
889+
print(response)
890+
```
891+
892+
For streaming/real-time TingWu sessions over a live audio source, see the [TingWu guide](docs/guides/tingwu.md).
893+
857894
### Bailian Application (Agent App)
858895

859896
Call an app you built in [Bailian's Application Center](https://bailian.console.aliyun.com/):
@@ -902,7 +939,9 @@ Note: `Client()` reads the `DASHSCOPE_WORKSPACE` environment variable (no `_ID`
902939
Count or encode/decode tokens for Qwen models locally, without an API call (requires `pip install "dashscope[tokenizer]"`):
903940

904941
```python
905-
from dashscope.tokenizers.tokenizer import get_tokenizer
942+
from dashscope.tokenizers.tokenizer import get_tokenizer, list_tokenizers
943+
944+
print(list_tokenizers()) # model series supported by the local tokenizer
906945

907946
tokenizer = get_tokenizer("qwen-turbo") # works for any qwen-* model
908947
tokens = tokenizer.encode("这个是千问tokenizer")

‎README_es.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,24 @@ async def main():
568568
asyncio.run(main())
569569
```
570570

571+
### Comprensión de texto (NLU)
572+
573+
`Understanding` ejecuta extracción de información o clasificación zero-shot sobre un conjunto de etiquetas fijo, sin necesidad de entrenar un modelo personalizado:
574+
575+
```python
576+
from dashscope import Understanding
577+
578+
response = Understanding.call(
579+
model=Understanding.Models.opennlu_v1,
580+
sentence="老师今天表扬我了",
581+
labels="积极,消极",
582+
task="classification",
583+
)
584+
print(response.output["text"])
585+
```
586+
587+
Usa `task="extraction"` (el valor por defecto) para extraer de `sentence` los fragmentos que coincidan con `labels`, en lugar de clasificarlo.
588+
571589
### Generación de código
572590

573591
`CodeGeneration` da soporte a escenarios de programación específicos (`Scenes`): generación de código a partir de lenguaje natural, explicación de código, generación de comentarios, mensajes de commit, pruebas unitarias, preguntas y respuestas sobre código, y generación de SQL a partir de lenguaje natural.
@@ -855,6 +873,25 @@ recognition.stop()
855873

856874
Para clonación de voz, corrección de pronunciación, traducción de voz en tiempo real y palabras clave (hot words) personalizadas para ASR, consulta la [guía de audio avanzado](docs/guides/realtime-audio_es.md).
857875

876+
### TingWu (análisis de audio de reuniones e industrial)
877+
878+
`TingWu` ejecuta tareas de análisis de audio específicas de dominio (inspecciones industriales, llamadas de servicio automotriz) sobre una URL de archivo:
879+
880+
```python
881+
from dashscope.multimodal.tingwu.tingwu import TingWu
882+
883+
response = TingWu.call(
884+
model="tingwu-automotive-service-inspection",
885+
user_defined_input={
886+
"fileUrl": "http://example.com/call-recording.mp3",
887+
"appid": "your-app-id",
888+
},
889+
)
890+
print(response)
891+
```
892+
893+
Para sesiones de TingWu en streaming/tiempo real sobre una fuente de audio en vivo, consulta la [guía de TingWu](docs/guides/tingwu_es.md).
894+
858895
### Aplicación de Bailian (App de agente)
859896

860897
Llama a una app que hayas creado en el [Centro de Aplicaciones de Bailian](https://bailian.console.aliyun.com/):
@@ -903,7 +940,9 @@ Nota: `Client()` lee la variable de entorno `DASHSCOPE_WORKSPACE` (sin el sufijo
903940
Cuenta o codifica/decodifica tokens para modelos Qwen localmente, sin una llamada a la API (requiere `pip install "dashscope[tokenizer]"`):
904941

905942
```python
906-
from dashscope.tokenizers.tokenizer import get_tokenizer
943+
from dashscope.tokenizers.tokenizer import get_tokenizer, list_tokenizers
944+
945+
print(list_tokenizers()) # series de modelos soportadas por el tokenizador local
907946

908947
tokenizer = get_tokenizer("qwen-turbo") # funciona con cualquier modelo qwen-*
909948
tokens = tokenizer.encode("这个是千问tokenizer")

‎README_ja.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,24 @@ async def main():
560560
asyncio.run(main())
561561
```
562562

563+
### テキスト理解(NLU)
564+
565+
`Understanding` は、カスタムモデルを学習させることなく、固定のラベル集合に対するゼロショット情報抽出や分類を実行します:
566+
567+
```python
568+
from dashscope import Understanding
569+
570+
response = Understanding.call(
571+
model=Understanding.Models.opennlu_v1,
572+
sentence="老师今天表扬我了",
573+
labels="积极,消极",
574+
task="classification",
575+
)
576+
print(response.output["text"])
577+
```
578+
579+
`task="extraction"`(デフォルト)を指定すると、`sentence` を分類する代わりに `labels` に一致する部分を抽出します。
580+
563581
### コード生成
564582

565583
`CodeGeneration` は特定のコーディングシーン(`Scenes`)に対応しています:自然言語からのコード生成、コードの説明、コメント生成、コミットメッセージ生成、単体テスト生成、コードに関する質問応答、自然言語から SQL への変換など。
@@ -847,6 +865,25 @@ recognition.stop()
847865

848866
音声クローン、発音修正、リアルタイム音声翻訳、カスタム ASR ホットワードについては、[高度な音声機能ガイド](docs/guides/realtime-audio_ja.md)を参照してください。
849867

868+
### TingWu(会議・産業音声分析)
869+
870+
`TingWu` は、ファイル URL に対してドメイン特化型の音声分析タスク(産業点検、自動車サービス通話など)を実行します:
871+
872+
```python
873+
from dashscope.multimodal.tingwu.tingwu import TingWu
874+
875+
response = TingWu.call(
876+
model="tingwu-automotive-service-inspection",
877+
user_defined_input={
878+
"fileUrl": "http://example.com/call-recording.mp3",
879+
"appid": "your-app-id",
880+
},
881+
)
882+
print(response)
883+
```
884+
885+
ライブ音声ソースに対するストリーミング/リアルタイムの TingWu セッションについては、[TingWu ガイド](docs/guides/tingwu_ja.md)を参照してください。
886+
850887
### 百煉アプリケーション(エージェントアプリ)
851888

852889
[百煉のアプリケーションセンター](https://bailian.console.aliyun.com/) で作成したアプリを呼び出します。
@@ -895,7 +932,9 @@ with client.sessions.events.stream(session.id) as stream:
895932
API を呼び出さずに、ローカルで Qwen 系モデルのトークン数カウントやエンコード/デコードができます(`pip install "dashscope[tokenizer]"` が必要):
896933

897934
```python
898-
from dashscope.tokenizers.tokenizer import get_tokenizer
935+
from dashscope.tokenizers.tokenizer import get_tokenizer, list_tokenizers
936+
937+
print(list_tokenizers()) # ローカルトークナイザーが対応するモデル系列
899938

900939
tokenizer = get_tokenizer("qwen-turbo") # 任意の qwen-* モデルで利用可能
901940
tokens = tokenizer.encode("这个是千问tokenizer")

‎README_ko.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,24 @@ async def main():
567567
asyncio.run(main())
568568
```
569569

570+
### 텍스트 이해(NLU)
571+
572+
`Understanding`은 커스텀 모델을 학습시키지 않고도 고정된 레이블 집합에 대해 제로샷 정보 추출 또는 분류를 수행합니다:
573+
574+
```python
575+
from dashscope import Understanding
576+
577+
response = Understanding.call(
578+
model=Understanding.Models.opennlu_v1,
579+
sentence="老师今天表扬我了",
580+
labels="积极,消极",
581+
task="classification",
582+
)
583+
print(response.output["text"])
584+
```
585+
586+
`task`를 `"extraction"`(기본값)으로 설정하면 `sentence`를 분류하는 대신 `labels`와 일치하는 부분을 추출합니다.
587+
570588
### 코드 생성
571589

572590
`CodeGeneration`은 특정 코딩 시나리오(`Scenes`)를 지원합니다: 자연어를 코드로 변환, 코드 설명, 주석 생성, 커밋 메시지 생성, 단위 테스트 생성, 코드 질의응답, 자연어를 SQL로 변환.
@@ -854,6 +872,25 @@ recognition.stop()
854872

855873
음성 클로닝, 발음 교정, 실시간 음성 번역, 커스텀 ASR 핫워드에 대해서는 [고급 음성 기능 가이드](docs/guides/realtime-audio_ko.md)를 참고하세요.
856874

875+
### TingWu(회의 및 산업용 오디오 분석)
876+
877+
`TingWu`는 파일 URL을 대상으로 도메인 특화 오디오 분석 작업(산업 점검, 자동차 서비스 통화 등)을 수행합니다:
878+
879+
```python
880+
from dashscope.multimodal.tingwu.tingwu import TingWu
881+
882+
response = TingWu.call(
883+
model="tingwu-automotive-service-inspection",
884+
user_defined_input={
885+
"fileUrl": "http://example.com/call-recording.mp3",
886+
"appid": "your-app-id",
887+
},
888+
)
889+
print(response)
890+
```
891+
892+
실시간 오디오 소스를 대상으로 하는 스트리밍/실시간 TingWu 세션에 대해서는 [TingWu 가이드](docs/guides/tingwu_ko.md)를 참고하세요.
893+
857894
### Bailian 애플리케이션(에이전트 앱)
858895

859896
[Bailian 애플리케이션 센터](https://bailian.console.aliyun.com/)에서 만든 앱을 호출합니다:
@@ -902,7 +939,9 @@ with client.sessions.events.stream(session.id) as stream:
902939
API를 호출하지 않고 로컬에서 Qwen 계열 모델의 토큰 수를 세거나 인코딩/디코딩할 수 있습니다(`pip install "dashscope[tokenizer]"` 필요):
903940

904941
```python
905-
from dashscope.tokenizers.tokenizer import get_tokenizer
942+
from dashscope.tokenizers.tokenizer import get_tokenizer, list_tokenizers
943+
944+
print(list_tokenizers()) # 로컬 tokenizer가 지원하는 모델 계열
906945

907946
tokenizer = get_tokenizer("qwen-turbo") # 모든 qwen-* 모델에서 사용 가능
908947
tokens = tokenizer.encode("这个是千问tokenizer")

‎README_zh.md‎

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,24 @@ async def main():
558558
asyncio.run(main())
559559
```
560560

561+
### 文本理解(NLU)
562+
563+
`Understanding` 可以在固定标签集合上进行零样本信息抽取或分类,无需训练自定义模型:
564+
565+
```python
566+
from dashscope import Understanding
567+
568+
response = Understanding.call(
569+
model=Understanding.Models.opennlu_v1,
570+
sentence="老师今天表扬我了",
571+
labels="积极,消极",
572+
task="classification",
573+
)
574+
print(response.output["text"])
575+
```
576+
577+
将 `task` 设为 `"extraction"`(默认值)即可从 `sentence` 中抽取匹配 `labels` 的片段,而不是对其分类。
578+
561579
### 代码生成
562580

563581
`CodeGeneration` 面向特定编程场景(`Scenes`):自然语言生成代码、代码解释、生成注释、生成 commit message、生成单元测试、代码问答、自然语言生成 SQL。
@@ -845,6 +863,25 @@ recognition.stop()
845863

846864
关于音色复刻、发音纠正、实时语音翻译以及自定义 ASR 热词,请参见[高级语音功能指南](docs/guides/realtime-audio_zh.md)。
847865

866+
### 听悟(会议与工业音频分析)
867+
868+
`TingWu` 针对文件 URL 运行特定领域的音频分析任务(工业质检、汽车服务通话等):
869+
870+
```python
871+
from dashscope.multimodal.tingwu.tingwu import TingWu
872+
873+
response = TingWu.call(
874+
model="tingwu-automotive-service-inspection",
875+
user_defined_input={
876+
"fileUrl": "http://example.com/call-recording.mp3",
877+
"appid": "your-app-id",
878+
},
879+
)
880+
print(response)
881+
```
882+
883+
关于基于实时音频源的流式听悟会话,请参见[听悟指南](docs/guides/tingwu_zh.md)。
884+
848885
### 百炼应用(Agent 应用)
849886

850887
调用你在[百炼应用中心](https://bailian.console.aliyun.com/)搭建的应用:
@@ -893,7 +930,9 @@ with client.sessions.events.stream(session.id) as stream:
893930
无需调用接口,即可在本地对 Qwen 系列模型进行分词计数或编解码(需要 `pip install "dashscope[tokenizer]"`):
894931

895932
```python
896-
from dashscope.tokenizers.tokenizer import get_tokenizer
933+
from dashscope.tokenizers.tokenizer import get_tokenizer, list_tokenizers
934+
935+
print(list_tokenizers()) # 本地分词器支持的模型系列
897936

898937
tokenizer = get_tokenizer("qwen-turbo") # 适用于任意 qwen-* 模型
899938
tokens = tokenizer.encode("这个是千问tokenizer")

‎docs/guides/assistants.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,12 @@ from dashscope.assistants.files import Files
100100
attached = Files.create(assistant_id=assistant.id, file_id="file-id-xxxx")
101101
print(attached)
102102

103-
info = Files.get(assistant_id=assistant.id, file_id="file-id-xxxx")
103+
info = Files.get(file_id="file-id-xxxx", assistant_id=assistant.id)
104+
105+
files = Files.list(assistant.id, limit=10, order="asc")
106+
for f in files.data:
107+
print(f.id, f.assistant_id)
108+
109+
deleted = Files.delete(file_id="file-id-xxxx", assistant_id=assistant.id)
110+
print(deleted.deleted)
104111
```

‎docs/guides/assistants_es.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,12 @@ from dashscope.assistants.files import Files
100100
attached = Files.create(assistant_id=assistant.id, file_id="file-id-xxxx")
101101
print(attached)
102102

103-
info = Files.get(assistant_id=assistant.id, file_id="file-id-xxxx")
103+
info = Files.get(file_id="file-id-xxxx", assistant_id=assistant.id)
104+
105+
files = Files.list(assistant.id, limit=10, order="asc")
106+
for f in files.data:
107+
print(f.id, f.assistant_id)
108+
109+
deleted = Files.delete(file_id="file-id-xxxx", assistant_id=assistant.id)
110+
print(deleted.deleted)
104111
```

‎docs/guides/assistants_ja.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,12 @@ from dashscope.assistants.files import Files
100100
attached = Files.create(assistant_id=assistant.id, file_id="file-id-xxxx")
101101
print(attached)
102102

103-
info = Files.get(assistant_id=assistant.id, file_id="file-id-xxxx")
103+
info = Files.get(file_id="file-id-xxxx", assistant_id=assistant.id)
104+
105+
files = Files.list(assistant.id, limit=10, order="asc")
106+
for f in files.data:
107+
print(f.id, f.assistant_id)
108+
109+
deleted = Files.delete(file_id="file-id-xxxx", assistant_id=assistant.id)
110+
print(deleted.deleted)
104111
```

‎docs/guides/assistants_ko.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,12 @@ from dashscope.assistants.files import Files
100100
attached = Files.create(assistant_id=assistant.id, file_id="file-id-xxxx")
101101
print(attached)
102102

103-
info = Files.get(assistant_id=assistant.id, file_id="file-id-xxxx")
103+
info = Files.get(file_id="file-id-xxxx", assistant_id=assistant.id)
104+
105+
files = Files.list(assistant.id, limit=10, order="asc")
106+
for f in files.data:
107+
print(f.id, f.assistant_id)
108+
109+
deleted = Files.delete(file_id="file-id-xxxx", assistant_id=assistant.id)
110+
print(deleted.deleted)
104111
```

‎docs/guides/assistants_zh.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,12 @@ from dashscope.assistants.files import Files
100100
attached = Files.create(assistant_id=assistant.id, file_id="file-id-xxxx")
101101
print(attached)
102102

103-
info = Files.get(assistant_id=assistant.id, file_id="file-id-xxxx")
103+
info = Files.get(file_id="file-id-xxxx", assistant_id=assistant.id)
104+
105+
files = Files.list(assistant.id, limit=10, order="asc")
106+
for f in files.data:
107+
print(f.id, f.assistant_id)
108+
109+
deleted = Files.delete(file_id="file-id-xxxx", assistant_id=assistant.id)
110+
print(deleted.deleted)
104111
```

0 commit comments

Comments
 (0)