- Monitor function usage and performance
- Debug tool calling issues and errors
- Analyze user interactions with AI-powered tools
- Track costs and usage across different functions
Simple Example
Here’s a minimal example focusing just on the tool-related fields:Key Tool Call Parameters
Tool Calls Structure
tool_calls: Array of function calls made by the assistantid: Unique identifier for the tool calltype: Always “function” for function callsfunction.name: Name of the called functionfunction.arguments: JSON string of function arguments
Tool Choice
tool_choice: Specifies which tool the model should usetype: “function” for function callingfunction.name: Name of the preferred function
Tools Definition
tools: Array of available functionstype: “function” for function definitionsfunction.name: Function namefunction.description: What the function doesfunction.parameters: JSON schema for function parameters
Best Practices
- Include complete tool definitions in the
toolsarray - Use descriptive function names and descriptions
- Log both successful and failed tool calls
- Include customer identification for user tracking
- Add relevant metadata for filtering and analysis
Viewing Tool Call Logs
Tool call logs appear in your Keywords AI dashboard with:- Function names and arguments
- Execution results and errors
- Performance metrics (latency, tokens)
- User context and metadata