Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
GLM4.5_pytorch
Commits
ccd82bfe
Commit
ccd82bfe
authored
Aug 11, 2025
by
dengjb
Browse files
Update api_request.py
parent
68df1089
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
inference/api_request.py
inference/api_request.py
+7
-6
No files found.
inference/api_request.py
View file @
ccd82bfe
...
@@ -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
}},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment