Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion alphatrion/tracing/cost_enrichment_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,16 @@ def on_end(self, span: ReadableSpan):

# Extract token usage
attributes = span.attributes
provider = determine_provider(str(attributes.get("gen_ai.openai.api_base")))
# OpenAI SDK populates the `gen_ai.openai.api_base` with base URL
# whereas Bedrock SDK either only populates the `gen_ai.system` with "AWS"
# or the `gen_ai.provider.name` with "aws.bedrock"
provider = determine_provider(
str(
attributes.get("gen_ai.openai.api_base")
or attributes.get("gen_ai.system")
or attributes.get("gen_ai.provider.name")
)
)
model = str(
attributes.get("gen_ai.request.model")
or attributes.get("gen_ai.response.model", "")
Expand Down
Loading