Skip to content

Commit 936064e

Browse files
committed
fix(integrations): do not exit early when config is not passed as it is not required and prohibits setting gen_ai.request.messages
1 parent 828e513 commit 936064e

File tree

1 file changed

+2
-7
lines changed
  • sentry_sdk/integrations/google_genai

1 file changed

+2
-7
lines changed

sentry_sdk/integrations/google_genai/utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,14 @@ def set_span_data_for_request(span, integration, model, contents, kwargs):
442442
if kwargs.get("stream", False):
443443
span.set_data(SPANDATA.GEN_AI_RESPONSE_STREAMING, True)
444444

445-
config = kwargs.get("config")
446-
447-
if config is None:
448-
return
449-
450-
config = cast(GenerateContentConfig, config)
445+
config = kwargs.get("config") # type: Optional[GenerateContentConfig]
451446

452447
# Set input messages/prompts if PII is allowed
453448
if should_send_default_pii() and integration.include_prompts:
454449
messages = []
455450

456451
# Add system instruction if present
457-
if hasattr(config, "system_instruction"):
452+
if config and hasattr(config, "system_instruction"):
458453
system_instruction = config.system_instruction
459454
if system_instruction:
460455
system_text = extract_contents_text(system_instruction)

0 commit comments

Comments
 (0)