A structured mechanism through which an AI model requests a specific function with the required arguments.
💡 Asking an assistant to call a particular department and giving the exact extension and information.
const tools = [{
type: "function",
function: {
name: "get_weather",
description: "Get current weather for a city",
parameters: {
type: "object",
properties: { city: { type: "string" } },
required: ["city"],
},
},
}];
const res = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "user", content: "Weather in London?" }],
tools,
});It connects AI models to application logic in a controlled and predictable way.
with tapaScript
By clicking Sign Up you re confirming that you agree with our Terms and Conditions.
