Skip to content

Commit b00139d

Browse files
authored
elastic-opentelemetry-instrumentation-openai: Update README after semconv 1.29.0 (elastic#37)
1 parent 64c2693 commit b00139d

File tree

2 files changed

+9
-6
lines changed
  • instrumentation/elastic-opentelemetry-instrumentation-openai

2 files changed

+9
-6
lines changed

instrumentation/elastic-opentelemetry-instrumentation-openai/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We currently support the following features:
1010
- Functions calling with tools for chat completions
1111
- Client side metrics
1212
- Embeddings API calls
13-
- Following 1.28.0 Gen AI Semantic Conventions
13+
- Following 1.29.0 Gen AI Semantic Conventions
1414

1515
## Installation
1616

@@ -56,8 +56,7 @@ None
5656

5757
### Elastic specific semantic conventions
5858

59-
- New `embeddings` value for `gen_ai.operation.name`
60-
- New `gen_ai.request.encoding_formats` attribute with openai specific values `[[float], [base64]]`
59+
None at the moment
6160

6261
## Development
6362

instrumentation/elastic-opentelemetry-instrumentation-openai/src/opentelemetry/instrumentation/openai/helpers.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@
3838
GEN_AI_USAGE_INPUT_TOKENS,
3939
GEN_AI_USAGE_OUTPUT_TOKENS,
4040
)
41+
42+
try:
43+
from opentelemetry.semconv._incubating.attributes.gen_ai_attributes import GEN_AI_REQUEST_ENCODING_FORMATS
44+
except ImportError:
45+
# available since 1.29.0
46+
GEN_AI_REQUEST_ENCODING_FORMATS = "gen_ai.request.encoding_formats"
47+
4148
from opentelemetry.metrics import Histogram
4249
from opentelemetry.trace import Span
4350
from opentelemetry.util.types import Attributes
@@ -48,9 +55,6 @@
4855
EVENT_GEN_AI_SYSTEM_MESSAGE = "gen_ai.system.message"
4956
EVENT_GEN_AI_TOOL_MESSAGE = "gen_ai.tool.message"
5057

51-
# not yet released attributes
52-
GEN_AI_REQUEST_ENCODING_FORMATS = "gen_ai.request.encoding_formats"
53-
5458
# As this is only used for a type annotation, only import from openai module
5559
# when running type checker like pyright since we otherwise don't want to import
5660
# it before the app.

0 commit comments

Comments
 (0)