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
8 changes: 4 additions & 4 deletions alphatrion/tracing/cost_enrichment_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,14 @@ def on_end(self, span: ReadableSpan):

# Extract token usage
attributes = span.attributes
# 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"
# Keep getting the provider from api_base first because some providers (like DeepInfra)
# don't set the provider name in the attributes, it's still OPENAI, which is not correct.
provider = determine_provider(
str(
attributes.get("gen_ai.openai.api_base")
or attributes.get("gen_ai.system")
or attributes.get("gen_ai.provider.name")
# Being deprecated in favor of `gen_ai.provider.name`
or attributes.get("gen_ai.system")
)
)
model = str(
Expand Down
Loading