@@ -19,81 +19,30 @@ def run(self):
1919 print ("Error:" , response .status_code , response .text )
2020
2121
22- openai_url = "http://localhost:8888/v1/chat/completions"
2322url = "http://localhost:8000/generate"
2423headers = {"Content-Type" : "application/json" }
2524
26- # Test OpenAI Tool Call API
27- messages = [
28- {
29- "role" : "user" ,
30- "content" : "What's the weather like in Boston today? "
31- "Output a reasoning before act, then use the tools to help you." ,
32- }
33- ]
34- tools = [
35- {
36- "type" : "function" ,
37- "function" : {
38- "name" : "get_current_weather" ,
39- "description" : "Get the current weather in a given location" ,
40- "parameters" : {
41- "type" : "object" ,
42- "properties" : {
43- "city" : {
44- "type" : "string" ,
45- "description" : "The city to find the weather for, e.g. 'San Francisco'" ,
46- },
47- "state" : {
48- "type" : "string" ,
49- "description" : "the two-letter abbreviation for the state that the city is"
50- " in, e.g. 'CA' which would mean 'California'" ,
51- },
52- "unit" : {
53- "type" : "string" ,
54- "description" : "The unit to fetch the temperature in" ,
55- "enum" : ["celsius" , "fahrenheit" ],
56- },
57- },
58- "required" : ["city" , "state" , "unit" ],
59- },
60- },
61- }
62- ]
6325for i in range (1 ):
6426 data = {
65- "model " : "qwen25 " ,
66- "messages" : messages ,
67- "tools " : tools ,
68- "do_sample" : False ,
69- "max_tokens" : 1024 ,
27+ "inputs " : "San Francisco is a " ,
28+ # 'temperature': 0.1 ,
29+ "parameters " : {
30+ "do_sample" : False ,
31+ } ,
7032 }
71- thread = RequestThread (openai_url , headers , data )
33+ thread = RequestThread (url , headers , data )
7234 thread .start ()
7335
36+ time .sleep (2 )
7437
75- # Test LightLLM API
76- # for i in range(1):
77- # data = {
78- # 'inputs': 'San Francisco is a',
79- # # 'temperature': 0.1,
80- # 'parameters' : {
81- # 'do_sample': False,
82- # }
83- # }
84- # thread = RequestThread(url, headers, data)
85- # thread.start()
86-
87- # time.sleep(2)
88-
89- # for i in range(20):
90- # data = {
91- # 'inputs': 'San Francisco is a',
92- # 'parameters': {
93- # 'do_sample': False,
94- # 'ignore_eos': True,
95- # 'max_new_tokens': 200,
96- # }
97- # }
98- # thread = RequestThread(url, headers, data)
99- # thread.start()
38+ for i in range (20 ):
39+ data = {
40+ "inputs" : "San Francisco is a" ,
41+ "parameters" : {
42+ "do_sample" : False ,
43+ "ignore_eos" : True ,
44+ "max_new_tokens" : 200 ,
45+ },
46+ }
47+ thread = RequestThread (url , headers , data )
48+ thread .start ()
0 commit comments