Skip to content

Commit fddaac7

Browse files
committed
some fixes
1 parent 4fcfa51 commit fddaac7

6 files changed

Lines changed: 15 additions & 16 deletions

File tree

  • instrumentation-genai
    • opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic
    • opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2
  • util/opentelemetry-util-genai

instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/patch.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@
2424
gen_ai_attributes as GenAIAttributes,
2525
)
2626
from opentelemetry.util.genai.handler import TelemetryHandler
27-
from opentelemetry.util.genai.types import Error, LLMInvocation
27+
from opentelemetry.util.genai.types import ( # pylint: disable=no-name-in-module # TODO: migrate to InferenceInvocation
28+
Error,
29+
LLMInvocation,
30+
)
2831
from opentelemetry.util.genai.utils import (
2932
should_capture_content_on_spans_in_experimental_mode,
3033
)

instrumentation-genai/opentelemetry-instrumentation-anthropic/src/opentelemetry/instrumentation/anthropic/wrappers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from opentelemetry.util.genai.handler import TelemetryHandler
2222
from opentelemetry.util.genai.types import (
2323
Error,
24-
LLMInvocation,
24+
LLMInvocation, # pylint: disable=no-name-in-module # TODO: migrate to InferenceInvocation
2525
MessagePart,
2626
OutputMessage,
2727
)

instrumentation-genai/opentelemetry-instrumentation-openai-v2/src/opentelemetry/instrumentation/openai_v2/patch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from opentelemetry.util.genai.types import (
3737
ContentCapturingMode,
3838
Error,
39-
LLMInvocation,
39+
LLMInvocation, # pylint: disable=no-name-in-module # TODO: migrate to InferenceInvocation
4040
OutputMessage,
4141
Text,
4242
ToolCallRequest,

util/opentelemetry-util-genai/pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,3 @@ include = ["/src", "/tests"]
5151
[tool.hatch.build.targets.wheel]
5252
packages = ["src/opentelemetry"]
5353

54-
[tool.pytest.ini_options]
55-
# TODO: remove once all usages of LLMInvocation are migrated to InferenceInvocation
56-
filterwarnings = [
57-
"ignore:LLMInvocation is deprecated:DeprecationWarning",
58-
]

util/opentelemetry-util-genai/src/opentelemetry/util/genai/handler.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
from opentelemetry.util.genai.embedding_invocation import EmbeddingInvocation
7070
from opentelemetry.util.genai.inference_invocation import (
7171
InferenceInvocation,
72-
LLMInvocation,
72+
LLMInvocation, # pyright: ignore[reportDeprecated]
7373
)
7474
from opentelemetry.util.genai.metrics import InvocationMetricsRecorder
7575
from opentelemetry.util.genai.tool_invocation import ToolInvocation
@@ -116,7 +116,6 @@ def __init__(
116116
tracer_provider,
117117
schema_url=schema_url,
118118
)
119-
self._metrics_recorder: InvocationMetricsRecorder | None = None
120119
meter = get_meter(
121120
__name__, meter_provider=meter_provider, schema_url=schema_url
122121
)
@@ -188,7 +187,7 @@ def start_inference(
188187
@deprecated(
189188
"handler.start_llm() is deprecated. Use handler.start_inference() instead."
190189
)
191-
def start_llm(self, invocation: LLMInvocation) -> LLMInvocation:
190+
def start_llm(self, invocation: LLMInvocation) -> LLMInvocation: # pyright: ignore[reportDeprecated]
192191
"""Start an LLM invocation.
193192
194193
.. deprecated::
@@ -257,7 +256,7 @@ def start_workflow(
257256
@deprecated(
258257
"handler.stop_llm() is deprecated. Use invocation.stop() instead."
259258
)
260-
def stop_llm(self, invocation: LLMInvocation) -> LLMInvocation:
259+
def stop_llm(self, invocation: LLMInvocation) -> LLMInvocation: # pyright: ignore[reportDeprecated]
261260
"""Finalize an LLM invocation successfully and end its span.
262261
263262
.. deprecated::
@@ -269,8 +268,10 @@ def stop_llm(self, invocation: LLMInvocation) -> LLMInvocation:
269268
"handler.fail_llm() is deprecated. Use invocation.fail(error) instead."
270269
)
271270
def fail_llm(
272-
self, invocation: LLMInvocation, error: Error
273-
) -> LLMInvocation:
271+
self,
272+
invocation: LLMInvocation,
273+
error: Error, # pyright: ignore[reportDeprecated]
274+
) -> LLMInvocation: # pyright: ignore[reportDeprecated]
274275
"""Fail an LLM invocation and end its span with error status.
275276
276277
.. deprecated::

util/opentelemetry-util-genai/src/opentelemetry/util/genai/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ def fail(self, error: Error | BaseException) -> None:
308308
def __getattr__(name: str) -> object:
309309
if name == "LLMInvocation":
310310
from opentelemetry.util.genai.inference_invocation import ( # noqa: PLC0415 # pylint: disable=import-outside-toplevel
311-
LLMInvocation,
311+
LLMInvocation, # pyright: ignore[reportDeprecated]
312312
)
313313

314-
return LLMInvocation
314+
return LLMInvocation # pyright: ignore[reportDeprecated]
315315
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

0 commit comments

Comments
 (0)