Function Calling with AI APIs

Use function calling for structured outputs.

Make LLMs call your functions.

Example

tools = [{

“type”: “function”,

“function”: {

“name”: “get_weather”,

“parameters”: {

“type”: “object”,

“properties”: {“location”: {“type”: “string”}}

}

}

}]

response = client.chat.completions.create(

model=”gpt-4″,

messages=[…],

tools=tools

)

Conclusion

Function calling enables structured interactions!

Leave a Comment