genai_has_tool_calls function checks whether a GenAI messages array contains any tool calls or function calls. It returns a boolean value indicating if the AI model requested to use external tools or functions during the conversation.
You can use this function to filter conversations that use function calling, monitor tool usage patterns, identify integration opportunities, or track feature adoption of function calling capabilities.
For users of other query languages
If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.Splunk SPL users
Splunk SPL users
In Splunk SPL, you would check if tool-related fields exist in the messages.
ANSI SQL users
ANSI SQL users
In ANSI SQL, you would check for existence of tool calls in the messages array.
Usage
Syntax
Parameters
- messages (dynamic, required): An array of message objects from a GenAI conversation. Each message typically contains
roleandcontentfields.
Returns
Returns a boolean value:true if the messages contain tool calls, false otherwise.
Use case examples
- Log analysis
- OpenTelemetry traces
- Security logs
Analyze the adoption rate of function calling features in your AI application.QueryRun in PlaygroundOutput
This query tracks function calling adoption over time, helping you understand feature usage trends.
| _time | conversations_with_tools | total_conversations | adoption_rate |
|---|---|---|---|
| 2024-01-15 | 345 | 1450 | 23.79 |
| 2024-01-16 | 389 | 1523 | 25.54 |
List of related functions
- genai_extract_tool_calls: Extracts the actual tool calls. Use this after confirming tool calls exist to analyze what tools are being called.
- genai_extract_function_results: Extracts function results. Use this to analyze the outcomes of tool calls.
- genai_message_roles: Lists all message roles. Use this to understand conversation structure when tool calls are present.
- genai_conversation_turns: Counts conversation turns. Analyze this alongside tool usage to understand complexity.