Skip to content

Create initial AiContext

Problem

DAP and AI Gateway events should all have the same set of properties to ensure consistent instrumentation and reporting across all AI features. Some properties are required while others are optional. Currently, there's no standardized way to model and capture these AI-related properties consistently across different event types.

Desired Outcome

Create a standardized AiContext that holds AI-related properties, ensuring all DAP and AI Gateway events capture the same set of attributes consistently. This will enable proper analytics, reporting, and governance across all AI features.

Potential Solution

Implement an AiContext class that models the standard AI event properties:

Initial properties:

  • session_id (string)
  • workflow_id (string)
  • flow_type (string)
  • agent_name (string)
  • app_id (string)
  • input_tokens (integer)
  • output_tokens (integer)
  • total_tokens (integer)
  • ephemeral_5m_input_tokens (integer)
  • ephemeral_1h_input_tokens (integer)
  • cache_read (integer)

This context can be used across all AI event instrumentation to ensure consistent property capture and provide a foundation for future AI analytics requirements.

Documentation Update Needed

  • Yes
  • No

How to verify

Further actions needed

Edited by 🤖 GitLab Bot 🤖