# Your tool implementationdef square_the_number(num: float) -> dict: return num ** 2
# Define Toolstools=[ { "type":"function", "function":{ "name": "square_the_number", "description": "output the square of the number.", "parameters": { "type": "object", "required": ["input_num"], "properties": { 'input_num': { 'type': 'number', 'description': 'input_num is a number that will be squared' } }, } } }]
from openai import OpenAI# Define LLMclient = OpenAI( # Use a custom endpoint compatible with OpenAI API base_url='http://localhost:8000/v1', # api_base api_key="EMPTY") messages = [{'role': 'user', 'content': 'square the number 1024'}]
completion = client.chat.completions.create( messages=messages, model="RedHatAI/Qwen3-Coder-Next-FP8-dynamic", max_tokens=65536, tools=tools,)
print(completion.choices[0])