Skip to main content

Module ai

Module ai 

Source
Expand description

AI cost calculation.

Structs§

CalculatedCost
Calculated model call costs.
UsedTokens
Amount of used tokens for a model call.

Functions§

calculate_costs
Calculates the total cost for a model call.
default_ai_operation_type
Returns the fallback AI operation type based on whether model info is available.
enrich_ai_event_data
Extract the ai data from all of an event’s spans
enrich_ai_span
Enrich the AI span data
has_valid_total_cost
Returns whether a valid total cost is attached.
infer_ai_operation_type
Infers the AI operation from an AI operation name.