0

DashScope Cookbook

Get your API key from: https://modelstudio.console.alibabacloud.com/?tab=model#/api-key

Example · مثال

Content

DashScope Cookbook

1. Create and activate a virtual environment

python3 -m venv ~/.venvs/aienv
source ~/.venvs/aienv/bin/activate

2. Export your DASHSCOPE_API_KEY or QWEN_API_KEY

Get your API key from: https://modelstudio.console.alibabacloud.com/?tab=model#/api-key

export DASHSCOPE_API_KEY=***

3. Install libraries

uv pip install -U openai ddgs agno

4. Run basic Agent

python cookbook/90_models/dashscope/basic.py

5. Run Agent with Tools

  • DuckDuckGo Search
python cookbook/90_models/dashscope/tool_use.py

6. Run Agent that returns structured output

python cookbook/90_models/dashscope/structured_output.py

7. Run Agent that analyzes images

  • Basic image analysis
python cookbook/90_models/dashscope/image_agent.py
  • Image analysis with bytes
python cookbook/90_models/dashscope/image_agent_bytes.py

For more information about Qwen models and capabilities, visit:

Source and license

Source
Agno
Original
agno-agi/agno/cookbook/90_models/dashscope
License
Apache-2.0