pass thread_id
This commit is contained in:
@@ -54,7 +54,8 @@ def test_streaming():
|
|||||||
stream = client.chat.completions.create(
|
stream = client.chat.completions.create(
|
||||||
model="qwen-plus", # Using qwen-plus as configured
|
model="qwen-plus", # Using qwen-plus as configured
|
||||||
messages=messages,
|
messages=messages,
|
||||||
stream=True
|
stream=True,
|
||||||
|
extra_body={"thread_id":2000}
|
||||||
)
|
)
|
||||||
|
|
||||||
full_response = ""
|
full_response = ""
|
||||||
@@ -90,7 +91,8 @@ def test_non_streaming():
|
|||||||
response = client.chat.completions.create(
|
response = client.chat.completions.create(
|
||||||
model="qwen-plus", # Using qwen-plus as configured
|
model="qwen-plus", # Using qwen-plus as configured
|
||||||
messages=messages,
|
messages=messages,
|
||||||
stream=False
|
stream=False,
|
||||||
|
extra_body={"thread_id":2000}
|
||||||
)
|
)
|
||||||
|
|
||||||
content = response.choices[0].message.content
|
content = response.choices[0].message.content
|
||||||
@@ -111,13 +113,13 @@ def main():
|
|||||||
print(f"\nUsing base_url = {BASE_URL}\n")
|
print(f"\nUsing base_url = {BASE_URL}\n")
|
||||||
|
|
||||||
# Test both streaming and non-streaming
|
# Test both streaming and non-streaming
|
||||||
streaming_result = test_streaming()
|
# streaming_result = test_streaming()
|
||||||
non_streaming_result = test_non_streaming()
|
non_streaming_result = test_non_streaming()
|
||||||
|
|
||||||
print("\n" + "="*60)
|
print("\n" + "="*60)
|
||||||
print("SUMMARY")
|
print("SUMMARY")
|
||||||
print("="*60)
|
print("="*60)
|
||||||
print(f"Streaming response length: {len(streaming_result)}")
|
# print(f"Streaming response length: {len(streaming_result)}")
|
||||||
print(f"Non-streaming response length: {len(non_streaming_result)}")
|
print(f"Non-streaming response length: {len(non_streaming_result)}")
|
||||||
print("\nBoth tests completed successfully!")
|
print("\nBoth tests completed successfully!")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user