-
Notifications
You must be signed in to change notification settings - Fork 179
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
GenAI: define conventions for embeddings operations #1603
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.
Left a few minor comments, looks great otherwise!
… feedback from luidmilla
…n, per Liudmila suggestion
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.
Looks great!
^^ the check failure is:
I'm guessing it was a fluke server error response from that site. The URL exists for me. The check passes for me locally as well:
I don't have permissions to re-run that workflow run. |
the link check is not required and oracle blog is the usual offender. We need another approval to merge though. @open-telemetry/semconv-genai-approvers ptal! |
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.
Thanks for starting this
… semconv Update attributes to match open-telemetry/semantic-conventions#1603
Just wanted to add some thoughts on observability workflows for embeddings since they are important to our product at Arize. We use both embedding vectors and their associated text for debugging and troubleshooting workflows. Because embedding vectors map semantically similar content to nearby vectors, you can use them for observability workflows such as:
These workflows require both embedding vectors and associated content (text, image, etc.), which we include as semantic conventions in the OpenInference spec. I've included a few resources below for additional context. embeddings.mp4 |
… semconv (#36) Update attributes to match open-telemetry/semantic-conventions#1603
Refs: #1174
Many LLMs support an Embeddings API, for example:
This proposal defines OpenTelemetry semantic conventions to use for instrumenting Embeddings API client usage.
Overview
A span will be created for Embeddings API calls. The only differences from existing chat spans are:
embeddings
value is added for attributegen_ai.operation.name
.gen_ai.request.encoding_formats
attribute is defined. It is only relevant for embeddings operations.note: ...
be added orif applicable.
added to thebrief
for those span attributes?)No new events are proposed. See "Notes" below.
For metrics:
gen_ai.client.token.usage
metric applies, with the note that output tokens do not apply for embeddings operations, so the metric would only be recorded with thegen_ai.token.type: 'input'
attribute (as already specified).gen_ai.client.operation.duration
metric applies as currently specified.Example span
This an example embeddings operation span using the
openai
client library and the OTel JS ConsoleSpanExporter:Notes
This section contains supporting notes and reasoning for some of the proposed values.
A span attribute for the
dimensions
parameter (in the OpenAI API) was considered, but dropped as likely not being useful. Happy to revisit that if others know of a reasonable use case.A (log) event to record the input strings to the Embeddings API call is not being proposed. The reasoning is that API calls for embeddings are expected to be higher volume, and the input strings less valuable to application observability than chat content, so the cost-benefit ratio is much less. If a good use case is presented for optionally recording Embeddings input strings, then this can be revisited.
Recording Embeddings API response vectors in telemetry is not being proposed. Vectors are large and would not be useful for observability.
The operation name
embeddings
was selected. Other possible options considered:embeddings
embedding
embed
My inclination is
embeddings
to match the (OpenAI) API name:embeddings.create
.Cohere's API name is
embed
.LangTrace uses
embed
.Current semconv values are
chat
(e.g. foropenai.chat.completions.create()
) andtext_completion
(for the deprecatedopenai.chat.create()
).The Cohere and Anthropic APIs have a request attribute
input_type
, for creating embeddings for inputs other than text. This might be worth considering adding as well. I have not currently proposed this because I have only prototyped with OpenAI.