-
Couldn't load subscription status.
- Fork 802
GenAI Utils | Add more SemConv Attributes #3862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
GenAI Utils | Add more SemConv Attributes #3862
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 NIT comments, but looks good otherwise
| _maybe_set_span_messages( | ||
| span, invocation.input_messages, invocation.output_messages | ||
| ) | ||
| _apply_request_attributes(span, invocation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking for this PR, but we should eventually allow to set attributes at start time. I noticed we don't properly mark which attributes should be provided at the start time, fixing it in the open-telemetry/semantic-conventions#2994
| else: | ||
| finish_reasons = None | ||
|
|
||
| if finish_reasons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe if finish_reasons is not available, we should set error - open-telemetry/semantic-conventions#2919 (comment)
util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py
Outdated
Show resolved
Hide resolved
|
|
||
| from dataclasses import asdict | ||
| from typing import List | ||
| from typing import Any, Dict, List, Optional |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit prefer to use dict[k, v], and Foo | None with from __future__ import annotations.
Description
Add missing SemConv attributes to spans for LLMInvocation calls, clean up some repeated code in the unit tests for genai utils.
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Updated unit tests to check for additional attributes
Does This PR Require a Core Repo Change?
Checklist:
See contributing.md for styleguide, changelog guidelines, and more.