AI Chatbot Hub
HomepageAPI docsDiscordLog inSign up
Documentation
Documentation
  • welcome
    • Quick start guide
    • Creating your first AI chatbot
  • Dashboard
    • Analytics
  • Account
    • Account settings
    • Get OpenAI API key
    • API docs
  • Inbox
    • Navigating the Inbox menu
  • Sources
    • Navigating the Sources menu
    • Best practices for preparing data
    • Adding training data
    • How to work with tables
  • AI agents
    • Creating AI agents
    • Fine-tune intents
    • Supervisor overrides
    • Function calling
    • Bias and stickiness
  • Customizations
    • Settings
      • Security
      • Conversations
      • Custom domains
      • Disclaimer
      • Human support escalation
    • User Data Management
      • File uploader
      • Conversation labeling
      • User data collection
      • Forms
      • Webhooks
      • User identity verification
    • Appearance & Style
      • General
      • Messages
      • Suggested prompts
      • Watermark
      • Button
  • Collaborators
    • Permissions
    • Transfer ownership
  • Preview
    • Overview
  • Go live
    • Integrations
  • Community
    • Partners
    • Affiliates
    • Discord
  • Resources
    • Get a free template
    • Enterprise
    • Glossary
    • Support
Powered by GitBook
On this page
  • What is function calling?
  • Where to find function calling
  • How does function calling work?
  • Setting up the parameter schema
  • Key Use Cases for Function Calling
  • Conclusion
  1. AI agents

Function calling

Advanced guide on how to get data on-demand from an external data provider.

PreviousSupervisor overridesNextBias and stickiness

Last updated 4 months ago

Note this is an advanced feature. Implementing function calling requires coding expertise and familiarity with APIs to unlock its full potential.

What is function calling?

Function calling allows AI models to interact directly with external systems, APIs, or data sources by executing predefined functions. It bridges the gap between static AI responses and dynamic, real-time data integration, empowering AI Chatbot Hub to generate precise, context-aware outputs in chat conversations. Depending on your plan, you can create up to 5 functions per AI agent, which opens the door to great levels of customization for your use cases.

Where to find function calling

You can find it by clicking on each AI agent and going to the Functions tab, allowing you to create multiple functions for each agent.

How does function calling work?

The process typically involves these steps:

  1. User Query: The AI model (our AI chatbot) receives a query or input from the user.

  2. Function Selection: Based on the query, the AI determines which predefined function to invoke. If you have multiple functions set up in AI Chatbot Hub, it will pick the one that fits best. For example: if a user is asking about the order tracking, it will pull data from a function (that you previously set up) that calls an external data provider to fetch the status of all orders in progress.

  3. Execution: The selected function executes, retrieving or generating data from an external source or performing a computation.

  4. Response Generation: The AI model will use the function's output to generate a final response tailored to the user's query. Depending on the prompt instructions you set for that specific AI agent and function, it will generate a structured response for the user.

Setting up the parameter schema

Example parameter schema

{
  "type": "object",
  "properties": {
    "location": {
      "type": "string",
      "description": "The city and state, e.g. Chicago, IL"
    },
    "unit": {
      "type": "string",
      "enum": ["celsius", "fahrenheit"]
    }
  },
  "required": ["location"]
}

Key Use Cases for Function Calling

  1. Dynamic Data Retrieval:

    • Query large knowledge bases, CRM systems, or cloud databases for up-to-date information.

    • Retrieve specific details, such as product data, user profiles, or real-time stock prices.

  2. Document Summarization and Question Answering:

    • Extract relevant sections from extensive documents using retrieval tools.

    • Summarize content or answer specific user queries with precision.

  3. Customized Workflows:

    • Tailor responses based on business logic embedded in the functions.

    • Provide personalized recommendations, such as flight bookings or loan calculations.

  4. Real-Time Analytics:

    • Fetch real-time statistics, financial data, or operational metrics.

    • Analyze and report findings directly within the chat interface.

  5. Advanced Data Processing:

    • Perform calculations, aggregate data, or trigger automation processes.

    • Combine structured and unstructured data for hybrid analysis.

Conclusion

Function calling is a cornerstone of modern Retrieval-Augmented Generation systems, allowing AI to move beyond static knowledge and interact dynamically with the world. With applications ranging across industries such as healthcare, finance, e-commerce, education, and beyond, this feature opens up endless possibilities for innovation and efficiency.

Define the inputs for your custom functions with parameters that specify the arguments to be extracted by AI from user conversations. This ensures tailored responses. The AI identifies and uses values from user queries to execute your function accordingly. Each parameter must include a type (to ensure accurate processing), properties and required fields. For guidance on setting up parameters specifically for AI models, refer to for examples and best practices on configuring your function's parameters correctly.

How to Call Functions with Chat Models