Skip to content
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: 1 addition & 1 deletion sentry_sdk/integrations/google_genai/streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def set_span_data_for_streaming_response(

if accumulated_response.get("tool_calls"):
if has_data_collection_enabled(client.options):
if client.options["data_collection"]["gen_ai"]["inputs"]:
if client.options["data_collection"]["gen_ai"]["outputs"]:
set_on_span(
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS,
safe_serialize(accumulated_response["tool_calls"]),
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/integrations/google_genai/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,7 @@ def set_span_data_for_response(
tool_calls = extract_tool_calls(response)
if tool_calls:
if has_data_collection_enabled(client.options):
if client.options["data_collection"]["gen_ai"]["inputs"]:
if client.options["data_collection"]["gen_ai"]["outputs"]:
set_on_span(
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS, safe_serialize(tool_calls)
)
Expand Down
36 changes: 12 additions & 24 deletions tests/integrations/google_genai/test_google_genai.py
Original file line number Diff line number Diff line change
Expand Up @@ -3841,21 +3841,15 @@ def test_generate_content_data_collection(
),
pytest.param(
{"gen_ai": {"inputs": True, "outputs": False}},
[
SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS,
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS,
],
[],
id="gen-ai-inputs-enabled-outputs-disabled-tools-collected",
[SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS],
[SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS],
id="gen-ai-inputs-enabled-outputs-disabled-drops-tool-calls-only",
),
pytest.param(
{"gen_ai": {"inputs": False, "outputs": True}},
[],
[
SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS,
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS,
],
id="gen-ai-inputs-disabled-outputs-enabled-tools-not-collected",
[SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS],
[SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS],
id="gen-ai-inputs-disabled-outputs-enabled-drops-available-tools-only",
),
pytest.param(
{"gen_ai": {}},
Expand Down Expand Up @@ -4201,21 +4195,15 @@ def test_streaming_generate_content_data_collection(
),
pytest.param(
{"gen_ai": {"inputs": True, "outputs": False}},
[
SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS,
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS,
],
[],
id="gen-ai-inputs-enabled-outputs-disabled-tools-collected",
[SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS],
[SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS],
id="gen-ai-inputs-enabled-outputs-disabled-drops-tool-calls-only",
),
pytest.param(
{"gen_ai": {"inputs": False, "outputs": True}},
[],
[
SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS,
SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS,
],
id="gen-ai-inputs-disabled-outputs-enabled-tools-not-collected",
[SPANDATA.GEN_AI_RESPONSE_TOOL_CALLS],
[SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS],
id="gen-ai-inputs-disabled-outputs-enabled-drops-available-tools-only",
),
pytest.param(
{"gen_ai": {}},
Expand Down
Loading