image-landscapeTool call

NavTalk supports integration of digital humans with external systems through function calling, enabling functionalities such as weather inquiries, knowledge base retrieval, and business system triggers.

Step 1: Define Function Tools

When establishing a WebSocket session, configure the tools in the session.update request body:

tools: [
  {
    "type": "function",
    "name": "function_call_judge",
    "description": "Automatically triggers function extension calls when user requests exceed the current conversation capabilities.",
    "parameters": {
      "type": "object",
      "properties": {
        "userInput": {
          "type": "string",
          "description": "Raw user request content to be processed"
        }
      },
      "required": ["userInput"]
    }
  }
]

Step 2: Receive Callback Events

When the function is triggered, the WebSocket will receive messages of the following type:

field
meaning

type

Fixed as response.function_call_arguments.done

arguments

The parameters for the function call (in JSON string format)

call_id

The current unique identifier for the function call

Step 3: Handle Function Calls

Step 4: Call Backend Interfaces to Handle Business Logic

You can pass the userInput to the business system or middleware interface, such as a weather API or CRM system:

Step 5: Return Results to AI Conversation

After processing the results, they need to be pushed back to the WebSocket, prompting the AI to continue responding:

Common Application Scenario Examples

scene
user input
system action

Check the weather

"What will the weather be like in Beijing tomorrow?"

Call the weather API and return the weather forecast

Query the knowledge base

"How to integrate Function Calling with NavTalk?"

Access the internal knowledge system to retrieve answers

Control devices

"Turn on the conference room lights."

Call the IoT interface to control hardware devices

Last updated