shipfeedAI news, curated daily

23:04:15 CET
20 MAY23:04:15shipfeed
pull to refreshlast sync
Just in — 30 new
§ feed · storyline

Tool Calls

Tool Calls

May 7 · · primary fetch1 sourceupdated May 7 ·

Tool Calls allow models to invoke external tools to enhance their capabilities. Non-thinking Mode Sample Code Here is a complete Python code example demonstrating the use of Tool Calls, showing how to get weather information for the user's current location. For the specific API format of Tool Calls, please refer to the chat completion documentation. from openai import OpenAI def send_messages(messages): response = client.chat.completions.create( model="deepseek-v4-pro", messages=messages, tools=tools ) return response.choices[0].message client = OpenAI( api_key="", base_url="https://api.deepseek.com", ) tools = [ { "type": "function", "function": { "name": "get_weather", "description": "Get weather of a location, the user should supply a location first.", "parameters": { "type": "object", "properties": { "location": { "type": "string", "description": "The city and state, e.g.

San Francisco, CA", } }, "required": ["location"] }, } }, ] messages = [{"role": "user", "content": "How's the weather in Hangzhou, Zhejiang?"}] message = send_messages(messages) print(f"User>\t {messages[0]['content']}") tool = message.tool_calls[0] messages.append(message) messages.append({"role": "tool"…

read full article on api-docs.deepseek.com
§ sources1 publication · timeline below
  1. api-docs.deepseek.comTool Callsprimary