Skip to content

Latest commit

 

History

History
218 lines (181 loc) · 5.32 KB

learn-dashscope-api-2024.org

File metadata and controls

218 lines (181 loc) · 5.32 KB

Learn DashScope API 2024

https://help.aliyun.com/zh/dashscope/developer-reference/api-details

最简单的尝试

post https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation Content-Type: application/json Authorization: Bearer {{(funcall (plist-get (car (auth-source-search :host “dashscope.aliyuncs.com” :max 1)) :secret))}}

{ “model”: “qwen-turbo”, “input”:{ “messages”:[ { “role”: “system”, “content”: “You are a helpful assistant.” }, { “role”: “user”, “content”: “介绍下 Emacs 的历史” } ] }, “parameters”: { } }

Token 计算

POST https://dashscope.aliyuncs.com/api/v1/tokenizer Content-Type: application/json Authorization: Bearer {{(funcall (plist-get (car (auth-source-search :host “dashscope.aliyuncs.com” :max 1)) :secret))}}

{ “model”: “qwen-plus”, “input”:{ “messages”:[ { “role”: “user”, “content”: “北京有哪些好玩地方?” }, { “role”: “assistant”, “content”: “故宫、颐和园、天坛等都是可以去游玩的景点哦。” }, { “role”: “user”, “content”: “帮我安排一些行程” } ] }, “parameters”: { } }

开始测试通义千问吧

template https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation Content-Type: application/json Authorization: Bearer {{(funcall (plist-get (car (auth-source-search :host “dashscope.aliyuncs.com” :max 1)) :secret))}}

qwen-turbo

POST /

{ “model”: “qwen-turbo”, “input”:{ “messages”:[ { “role”: “user”, “content”: “介绍下你自己” } ] }, “parameters”: { } }

qwen-plus

POST /

{ “model”: “qwen-plus”, “input”:{ “messages”:[ { “role”: “user”, “content”: “介绍下你自己” } ] }, “parameters”: { } }

qwen-max

POST /

{ “model”: “qwen-max”, “input”:{ “messages”:[ { “role”: “user”, “content”: “介绍下你自己” } ] }, “parameters”: { } }

parameters.seed 参数

POST /

{ “model”: “qwen-turbo”, “input”:{ “messages”:[ { “role”: “user”, “content”: “请介绍下 Lua 的历史” } ] }, “parameters”: { “seed”: 111205 } }

通义千问VL

template https://dashscope.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation Content-Type: application/json Authorization: Bearer {{(funcall (plist-get (car (auth-source-search :host “dashscope.aliyuncs.com” :max 1)) :secret))}}

qwen-vl-plus 图片大模型, woman

post /

{ “model”: “qwen-vl-plus”, “input”: { “messages”: [ { “role”: “user”, “content”: [ { “image”: “http://xuchunyang-oss.domain-4-testing.com/hua-ling-VV62v9KELCo-unsplash.jpg” }, { “text”: “介绍下这张图片” } ] } ] }, “parameters”: { } }

qwen-vl-plus 图片大模型, lion

post /

{ “model”: “qwen-vl-plus”, “input”: { “messages”: [ { “role”: “user”, “content”: [ { “image”: “http://xuchunyang-oss.domain-4-testing.com/ansie-potgieter-GV2LxPJArgQ-unsplash.jpg” }, { “text”: “介绍下这张图片” } ] } ] }, “parameters”: { } }

试一下能否 hotlink 图片

post /

{ “model”: “qwen-vl-plus”, “input”: { “messages”: [ { “role”: “user”, “content”: [ { “image”: “https://imagecloud.thepaper.cn/thepaper/image/288/63/268.jpg?x-oss-process=image/resize,w_332” }, { “text”: “介绍下这张图片” } ] } ] }, “parameters”: { } }