Created
August 8, 2025 18:09
-
-
Save RodriMora/099913a7cea971d1bd09c623fc12c7bf to your computer and use it in GitHub Desktop.
test tools ik_llama.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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