import json
from together import Together
client = Together()
tools = [
{
"type": "function",
"function": {
"name": "get_current_stock_price",
"description": "Get the current stock price for the given stock symbol",
"parameters": {
"type": "object",
"properties": {
"symbol": {
"type": "string",
"description": "The stock symbol, e.g. AAPL, GOOGL, TSLA",
},
"exchange": {
"type": "string",
"description": "The stock exchange (optional)",
"enum": ["NYSE", "NASDAQ", "LSE", "TSX"],
},
},
"required": ["symbol"],
},
},
},
]
response = client.chat.completions.create(
model="moonshotai/Kimi-K2.5",
reasoning={"enabled": False},
messages=[
{
"role": "user",
"content": [
{
"type": "text",
"text": "What is the stock price of the company from the image",
},
{
"type": "image_url",
"image_url": {
"url": "https://53.fs1.hubspotusercontent-na1.net/hubfs/53/image8-2.jpg",
},
},
],
},
],
tools=tools,
)
print(
json.dumps(
response.choices[0].message.model_dump()["tool_calls"], indent=2
)
)