Commit ccd82bfe authored by dengjb's avatar dengjb
Browse files

Update api_request.py

parent 68df1089
...@@ -68,22 +68,23 @@ client = OpenAI( ...@@ -68,22 +68,23 @@ client = OpenAI(
base_url=openai_api_base, base_url=openai_api_base,
) )
completion = client.chat.completions.create( completion = client.chat.completions.create(
model="zai-org/GLM-4.5", model="glm-4.5",
messages=messages, messages=messages,
max_tokens=4096, max_tokens=4096,
temperature=0.0, temperature=0.0,
# extra_body={"chat_template_kwargs": {"enable_thinking": False}} # Uncomment this line to disable thinking # extra_body={"chat_template_kwargs": {"enable_thinking": False}} # Uncomment this line to disable thinking
) )
tool_call = completion.choices[0].message.tool_calls[0] print(completion.choices[0].message)
args = json.loads(tool_call.function.arguments) # tool_call = completion.choices[0].message.tool_calls[0]
print("===== TOOL CALL =====") # args = json.loads(tool_call.function.arguments)
print(tool_call) # print("===== TOOL CALL =====")
# print(tool_call)
messages.append(completion.choices[0].message) messages.append(completion.choices[0].message)
messages.append(tools_messages[0]) messages.append(tools_messages[0])
## This part is to simulate the tool response ## This part is to simulate the tool response
completion_2 = client.chat.completions.create( completion_2 = client.chat.completions.create(
model="zai-org/GLM-4.5", model="glm-4.5",
messages=messages, messages=messages,
tools=tools, tools=tools,
extra_body={"chat_template_kwargs": {"enable_thinking": False}}, extra_body={"chat_template_kwargs": {"enable_thinking": False}},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment