Function Calling

BytapaScript

IntermediateAI Agents

What it means

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.

Code example

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,
});

Why it matters

It connects AI models to application logic in a controlled and predictable way.

Related terms

Learn Full Stack

with tapaScript

By clicking Sign Up you re confirming that you agree with our Terms and Conditions.

newsletter

Don't forget to connect with us on