Generative AI functions

Mano TothSenior Technical Writer
December 15, 2025

Analyzing generative AI (GenAI) conversation data in your logs just got easier. Previously, extracting insights from AI conversation logs required complex queries to parse message structures, calculate token costs, and filter conversations by role or content.

We’ve added a comprehensive set of GenAI functions to APL that simplify working with conversation data from large language models and AI systems. These functions help you extract specific information like user prompts, assistant responses, and system prompts, calculate token costs and usage metrics, analyze conversation structure and flow, and detect truncation or tool calls in responses.

FunctionDescription
genai_concat_contentsConcatenates message contents from a conversation array
genai_conversation_turnsCounts the number of conversation turns
genai_costCalculates the total cost for input and output tokens
genai_estimate_tokensEstimates the number of tokens in a text string
genai_extract_assistant_responseExtracts the assistant’s response from a conversation
genai_extract_function_resultsExtracts function call results from messages
genai_extract_system_promptExtracts the system prompt from a conversation
genai_extract_tool_callsExtracts tool calls from messages
genai_extract_user_promptExtracts the user prompt from a conversation
genai_get_content_by_indexGets message content by index position
genai_get_content_by_roleGets message content by role
genai_get_pricingGets pricing information for a specific model
genai_get_roleGets the role of a message at a specific index
genai_has_tool_callsChecks if messages contain tool calls
genai_input_costCalculates the cost for input tokens
genai_is_truncatedChecks if a response was truncated
genai_message_rolesExtracts all message roles from a conversation
genai_output_costCalculates the cost for output tokens

For more information, see the blog or the documentation.

More of our favorite changes

  • Added snow mode toggle to the theme selector for a festive winter interface
  • Fixed missing time range for tags in metrics queries, ensuring tags and tag values are properly scoped to the selected time range
  • Fixed an issue where the getting started flow would incorrectly redirect users
  • Added tooltip to Stream tab for metrics datasets to provide helpful context

Interested to learn more about Axiom?

Sign up for free or contact us at sales@axiom.co to talk with one of the team about our enterprise plans.