opentelemetry-instrumentation-openai 0.3.5__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of opentelemetry-instrumentation-openai might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: opentelemetry-instrumentation-openai
3
- Version: 0.3.5
3
+ Version: 0.4.0
4
4
  Summary: OpenTelemetry OpenAI instrumentation
5
5
  License: Apache-2.0
6
6
  Author: Gal Kleinman
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Requires-Dist: opentelemetry-api (>=1.21.0,<2.0.0)
16
16
  Requires-Dist: opentelemetry-instrumentation (>=0.42b0,<0.43)
17
- Requires-Dist: opentelemetry-semantic-conventions-ai (>=0.0.8,<0.0.9)
17
+ Requires-Dist: opentelemetry-semantic-conventions-ai (>=0.0.12,<0.0.13)
18
18
  Description-Content-Type: text/markdown
19
19
 
20
20
  # opentelemetry-instrumentation-openai
@@ -1,5 +1,6 @@
1
1
  import logging
2
2
  import os
3
+ import json
3
4
  import types
4
5
  import pkg_resources
5
6
  from typing import Collection
@@ -122,6 +123,18 @@ def _set_input_attributes(span, llm_request_type, kwargs):
122
123
  prompt[0] if isinstance(prompt, list) else prompt,
123
124
  )
124
125
 
126
+ functions = kwargs.get("functions")
127
+ if functions:
128
+ for i, function in enumerate(functions):
129
+ prefix = f"{SpanAttributes.LLM_REQUEST_FUNCTIONS}.{i}"
130
+ _set_span_attribute(span, f"{prefix}.name", function.get("name"))
131
+ _set_span_attribute(
132
+ span, f"{prefix}.description", function.get("description")
133
+ )
134
+ _set_span_attribute(
135
+ span, f"{prefix}.parameters", json.dumps(function.get("parameters"))
136
+ )
137
+
125
138
  return
126
139
 
127
140
 
@@ -11,7 +11,7 @@ addopts = "--cov --cov-report html:'../../coverage/packages/opentelemetry-instru
11
11
 
12
12
  [tool.poetry]
13
13
  name = "opentelemetry-instrumentation-openai"
14
- version = "0.3.5"
14
+ version = "0.4.0"
15
15
  description = "OpenTelemetry OpenAI instrumentation"
16
16
  authors = [
17
17
  "Gal Kleinman <gal@traceloop.com>",
@@ -28,7 +28,7 @@ include = "opentelemetry/instrumentation/openai"
28
28
  python = ">=3.8.1,<4"
29
29
  opentelemetry-api = "^1.21.0"
30
30
  opentelemetry-instrumentation = "^0.42b0"
31
- opentelemetry-semantic-conventions-ai = "^0.0.8"
31
+ opentelemetry-semantic-conventions-ai = "^0.0.12"
32
32
 
33
33
  [tool.poetry.group.dev.dependencies]
34
34
  autopep8 = "2.0.4"