Skip to content
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Do not record `gen_ai.request.stream` on `fetch_response` spans.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
get_fetch_response_creation_kwargs,
get_inference_creation_kwargs,
get_response_error,
is_streamed_raw_response,
set_fetch_response_attributes,
set_invocation_response_attributes,
)
Expand Down Expand Up @@ -215,11 +214,6 @@ def _start_fetch_response_invocation(
) -> FetchResponseInvocation:
invocation = handler.fetch_response(
**get_fetch_response_creation_kwargs(response_id, instance),
request_stream=(
True
if is_streaming(kwargs) or is_streamed_raw_response(kwargs)
else None
),
)
invocation.stream_cursor = _get_stream_cursor(kwargs)
invocation.attributes[OpenAIAttributes.OPENAI_API_TYPE] = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ async def test_async_responses_retrieve_streaming(
response_model=response.model,
response_status="completed",
finish_reasons=("stop",),
request_stream=True,
stream_cursor=str(RETRIEVE_STREAM_CURSOR),
response_service_tier=response.service_tier,
)
Expand Down Expand Up @@ -455,7 +454,7 @@ async def test_async_responses_retrieve_with_streaming_response_stays_lazy(
span.attributes[GenAIAttributes.GEN_AI_RESPONSE_ID]
== RETRIEVE_RESPONSE_ID
)
assert span.attributes[GenAIAttributes.GEN_AI_REQUEST_STREAM] is True
assert GenAIAttributes.GEN_AI_REQUEST_STREAM not in span.attributes
assert response.id == RETRIEVE_RESPONSE_ID


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ def test_responses_retrieve_streaming(
response_model=response.model,
response_status="completed",
finish_reasons=("stop",),
request_stream=True,
stream_cursor=str(RETRIEVE_STREAM_CURSOR),
response_service_tier=response.service_tier,
)
Expand Down Expand Up @@ -476,7 +475,7 @@ def test_responses_retrieve_with_streaming_response_stays_lazy(
span.attributes[GenAIAttributes.GEN_AI_RESPONSE_ID]
== RETRIEVE_RESPONSE_ID
)
assert span.attributes[GenAIAttributes.GEN_AI_REQUEST_STREAM] is True
assert GenAIAttributes.GEN_AI_REQUEST_STREAM not in span.attributes
assert response.id == RETRIEVE_RESPONSE_ID


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,6 @@ def assert_fetch_response_attributes(
response_model: str | None = None,
response_status: str | None = None,
finish_reasons: tuple | None = None,
request_stream: bool | None = None,
stream_cursor: str | None = None,
response_service_tier: str | None = None,
server_address: str = "api.openai.com",
Expand Down Expand Up @@ -419,6 +418,7 @@ def assert_fetch_response_attributes(
assert GenAIAttributes.GEN_AI_USAGE_OUTPUT_TOKENS not in span.attributes
assert GenAIAttributes.GEN_AI_REQUEST_MODEL not in span.attributes
assert GenAIAttributes.GEN_AI_INPUT_MESSAGES not in span.attributes
assert GenAIAttributes.GEN_AI_REQUEST_STREAM not in span.attributes

_assert_optional_attribute(
span, GenAIAttributes.GEN_AI_RESPONSE_MODEL, response_model
Expand All @@ -427,9 +427,6 @@ def assert_fetch_response_attributes(
_assert_optional_attribute(
span, GenAIAttributes.GEN_AI_RESPONSE_FINISH_REASONS, finish_reasons
)
_assert_optional_attribute(
span, GenAIAttributes.GEN_AI_REQUEST_STREAM, request_stream
)
_assert_optional_attribute(
span, GEN_AI_REQUEST_STREAM_CURSOR, stream_cursor
)
Expand Down
Loading