File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
volcenginesdkarkruntime/resources/context
volcenginesdkexamples/volcenginesdkarkruntime Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,6 @@ def create(
5656 cast_to = CreateContextResponse ,
5757 )
5858
59- @with_sts_token
6059 def clone (
6160 self ,
6261 * ,
Original file line number Diff line number Diff line change 4242 if not chunk .choices :
4343 continue
4444 print (chunk .choices [0 ].delta .content , end = "" )
45+
46+ # Clone:
47+ print ("----- clone context -----" )
48+ clone_response = client .context .clone (
49+ context_id = response .id ,
50+ )
51+ print (clone_response )
52+
53+ print ("----- streaming request -----" )
54+ stream = client .context .completions .create (
55+ context_id = clone_response .id ,
56+ model = "${YOUR_ENDPOINT_ID}" ,
57+ messages = [
58+ {"role" : "user" , "content" : "刚才你说了什么?" },
59+ ],
60+ stream = True
61+ )
62+ for chunk in stream :
63+ if chunk .usage :
64+ print (chunk .usage )
65+ if not chunk .choices :
66+ continue
67+ print (chunk .choices [0 ].delta .content , end = "" )
You can’t perform that action at this time.
0 commit comments