Files
opentelemetry-python-contrib/docs
Keith Decker e3d3817424 GenAI Utils | Inference Type and Span Creation (#3768)
* cherry pick changes from previous PR

* move span utils to new file

* remove span state, use otel context for parent/child

* flatten LLMInvocation to use attributes instead of dict keys

* helper function and docstrings

* refactor: store span and context token in LLMInvocation instead of SpanGenerator

* refactor: rename prompts/chat_generations to input_messages/output_messages for clarity

* refactor: simplify TelemetryHandler API by moving invocation data management to LLMInvocation class

* refactor: update relative imports to absolute imports

* Update handler to use a context manager instead of start_llm and stop_llm

* resolve tox -e doc failure

* safeguard against empty request-model

* fix tox typecheck errors for utils

* refactor: move tracer to generator, clean up dead code

* remove unused linting hint

* back off stricter request-model requirements

* reintroduce manual start/stop for langchain callback flow

* clean up context handler, clarify unit tests

* remove generator concept

* update token types

* code cleanup

* Refactor TestTelemetryHandler to use instance method for span exporter setup

* refactor: remove unused type properties

* refactor: update TelemetryHandler initialization to remove **kwargs

* refactor: remove tracer variable

* refactor: code style updates

* refactor: replace json.dumps with gen_ai_json_dumps for message serialization

* refactor: update span lifecycle to use sdk over setting context manually

* refactor: don't reinvent span attribute assignment

* refactor: pylint update for python 3.13

* Revert "refactor: update span lifecycle to use sdk over setting context manually"

This reverts commit be8620bb33.

---------

Co-authored-by: Aaron Abbott <aaronabbott@google.com>
2025-10-10 17:11:58 -04:00
..
2021-01-26 09:06:39 -08:00
2025-10-07 10:34:07 -08:00
2021-01-26 09:06:39 -08:00
2021-01-26 09:06:39 -08:00