Skip to content

fix(generation_span): Include input when tracing.include_data(). #742

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/agents/extensions/models/litellm_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ async def get_response(
previous_response_id: str | None,
) -> ModelResponse:
with generation_span(
input=input if tracing.include_data() else None,
model=str(self.model),
model_config=model_settings.to_json_dict()
| {"base_url": str(self.base_url or ""), "model_impl": "litellm"},
Expand Down Expand Up @@ -145,6 +146,7 @@ async def stream_response(
previous_response_id: str | None,
) -> AsyncIterator[TResponseStreamEvent]:
with generation_span(
input=input if tracing.include_data() else None,
model=str(self.model),
model_config=model_settings.to_json_dict()
| {"base_url": str(self.base_url or ""), "model_impl": "litellm"},
Expand Down
2 changes: 2 additions & 0 deletions src/agents/models/openai_chatcompletions.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ async def get_response(
previous_response_id: str | None,
) -> ModelResponse:
with generation_span(
input=input if tracing.include_data() else None,
model=str(self.model),
model_config=model_settings.to_json_dict() | {"base_url": str(self._client.base_url)},
disabled=tracing.is_disabled(),
Expand Down Expand Up @@ -118,6 +119,7 @@ async def stream_response(
Yields a partial message as it is generated, as well as the usage information.
"""
with generation_span(
input=input if tracing.include_data() else None,
model=str(self.model),
model_config=model_settings.to_json_dict() | {"base_url": str(self._client.base_url)},
disabled=tracing.is_disabled(),
Expand Down