Skip to content

Instantly share code, notes, and snippets.

@mh61503891
Created August 16, 2025 22:29
Show Gist options
  • Select an option

  • Save mh61503891/28b99345bb96ff5841360405cad18a23 to your computer and use it in GitHub Desktop.

Select an option

Save mh61503891/28b99345bb96ff5841360405cad18a23 to your computer and use it in GitHub Desktop.
Using gpt-oss:120b with Tool Calling
from openai import OpenAI
LLM_PROMPT = """
Your Prompt to get the score.
"""
LLM_TOOLS = [
{
"type": "function",
"function": {
"name": "get_score",
"description": "Get a score",
"parameters": {
"type": "object",
"properties": {
"score": {"type": "number"},
},
"required": ["score"],
},
},
},
]
client = OpenAI(
base_url="http://localhost:11434/v1",
api_key="[api-key]",
)
response = client.chat.completions.create(
model="gpt-oss:120b",
messages=[
{
"role": "system",
"content": "You shall always respond using tool calling.",
},
{
"role": "user",
"content": LLM_PROMPT,
},
],
reasoning_effort="high",
tools=LLM_TOOLS,
tool_choice={
"type": "function",
"function": {
"name": "get_score",
},
},
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment