Skip to content

Commit ba2d985

Browse files
mypy errors
1 parent 8eacaad commit ba2d985

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

sentry_sdk/integrations/google_genai/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ async def new_async_generate_content(
303303
response = await f(self, *args, **kwargs)
304304
except Exception as exc:
305305
_capture_exception(exc)
306-
chat_span.set_status(SPANSTATUS.INTERNAL_ERROR)
306+
chat_span.status = SpanStatus.ERROR
307307
raise
308308

309309
set_span_data_for_response(chat_span, integration, response)

sentry_sdk/integrations/google_genai/streaming.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ def set_span_data_for_streaming_response(
130130
safe_serialize(accumulated_response["tool_calls"]),
131131
)
132132

133-
if accumulated_response.get("id"):
134-
set_on_span(SPANDATA.GEN_AI_RESPONSE_ID, accumulated_response["id"])
135-
if accumulated_response.get("model"):
136-
set_on_span(SPANDATA.GEN_AI_RESPONSE_MODEL, accumulated_response["model"])
133+
response_id = accumulated_response.get("id")
134+
if response_id is not None:
135+
set_on_span(SPANDATA.GEN_AI_RESPONSE_ID, response_id)
136+
137+
response_model = accumulated_response.get("model")
138+
if response_model is not None:
139+
set_on_span(SPANDATA.GEN_AI_RESPONSE_MODEL, response_model)
137140

138141
if accumulated_response["usage_metadata"] is None:
139142
return

sentry_sdk/integrations/google_genai/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,10 @@ def prepare_embed_content_args(
10531053

10541054

10551055
def set_span_data_for_embed_request(
1056-
span: "Span", integration: "Any", contents: "Any", kwargs: "dict[str, Any]"
1056+
span: "Union[Span, StreamedSpan]",
1057+
integration: "Any",
1058+
contents: "Any",
1059+
kwargs: "dict[str, Any]",
10571060
) -> None:
10581061
"""Set span data for embedding request."""
10591062
# Include input contents if PII is allowed

0 commit comments

Comments
 (0)