File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change 33
44messages = [
55 {"role" : "system" , "content" : "You are a helpful assistant." },
6- {"role" : "user" , "content" : "你是谁?" },
6+ {
7+ "role" : "user" ,
8+ "content" : [
9+ {
10+ "type" : "text" ,
11+ "text" : "abc" * 1024 + "你是谁?" ,
12+ "cache_control" : {
13+ "type" : "ephemeral" ,
14+ "ttl" : "5m"
15+ }
16+ }
17+ ]
18+ }
719]
820response = Generation .call (
921 api_key = os .getenv ("DASHSCOPE_API_KEY" ),
10- model = "qwen-plus" ,
22+ model = os . getenv ( "MODEL_NAME" ) ,
1123 messages = messages ,
1224 result_format = "message" ,
13- enable_encryption = True ,
25+ incremental_output = True ,
1426 stream = True ,
1527)
1628
1729for chunk in response :
18- print (chunk . output . choices [ 0 ]. message . content )
30+ print (chunk )
1931
2032# if response.status_code == 200:
2133# print(response.output.choices[0].message.content)
You can’t perform that action at this time.
0 commit comments