Skip to content

Instantly share code, notes, and snippets.

@RodriMora
Created August 8, 2025 18:09
Show Gist options
  • Select an option

  • Save RodriMora/099913a7cea971d1bd09c623fc12c7bf to your computer and use it in GitHub Desktop.

Select an option

Save RodriMora/099913a7cea971d1bd09c623fc12c7bf to your computer and use it in GitHub Desktop.
test tools ik_llama.cpp
import openai
openai.api_key = "local-key"
openai.base_url = "http://192.168.10.115:5000/v1/" # adjust to your proxy
tools = [
{
"type": "function",
"function": {
"name": "add",
"description": "Return the sum of two numbers",
"parameters": {
"type": "object",
"properties": {
"a": { "type": "number", "description": "First number" },
"b": { "type": "number", "description": "Second number" }
},
"required": ["a", "b"]
}
}
}
]
resp = openai.chat.completions.create(
model="GLM-4.5",
messages=[{"role": "user", "content": "add 2 and 3"}],
tools=tools,
tool_choice="auto" # let the model decide
)
print(resp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment