Function calling
Advanced guide on how to get data on-demand from an external data provider.
Last updated
Advanced guide on how to get data on-demand from an external data provider.
Last updated
Note this is an advanced feature. Implementing function calling requires coding expertise and familiarity with APIs to unlock its full potential.
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.
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.
The process typically involves these steps:
User Query: The AI model (our AI chatbot) receives a query or input from the user.
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.
Execution: The selected function executes, retrieving or generating data from an external source or performing a computation.
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.
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 How to Call Functions with Chat Models for examples and best practices on configuring your function's parameters correctly.
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.
Document Summarization and Question Answering:
Extract relevant sections from extensive documents using retrieval tools.
Summarize content or answer specific user queries with precision.
Customized Workflows:
Tailor responses based on business logic embedded in the functions.
Provide personalized recommendations, such as flight bookings or loan calculations.
Real-Time Analytics:
Fetch real-time statistics, financial data, or operational metrics.
Analyze and report findings directly within the chat interface.
Advanced Data Processing:
Perform calculations, aggregate data, or trigger automation processes.
Combine structured and unstructured data for hybrid analysis.
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.