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
6 changes: 6 additions & 0 deletions sentry_sdk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,12 @@ class SPANDATA:
Example: 0.1
"""

GEN_AI_REQUEST_REASONING_LEVEL = "gen_ai.request.reasoning.level"
"""
The reasoning or thinking effort level requested for a GenAI model.
Example: "high"
"""

GEN_AI_REQUEST_SEED = "gen_ai.request.seed"
"""
The seed, ideally models given the same seed and same other parameters will produce the exact same output.
Expand Down
11 changes: 11 additions & 0 deletions sentry_sdk/integrations/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ def _set_responses_api_input_data(
if conversation_id is not None:
set_on_span(SPANDATA.GEN_AI_CONVERSATION_ID, conversation_id)

reasoning = kwargs.get("reasoning")
if isinstance(reasoning, dict) and "effort" in reasoning:
set_on_span(
SPANDATA.GEN_AI_REQUEST_REASONING_LEVEL,
reasoning["effort"],
)
Comment thread
alexander-alderman-webb marked this conversation as resolved.
Comment thread
alexander-alderman-webb marked this conversation as resolved.

if not should_send_default_pii() or not integration.include_prompts:
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, "responses")
return
Expand Down Expand Up @@ -489,6 +496,10 @@ def _set_completions_api_input_data(
if top_p is not None and _is_given(top_p):
set_on_span(SPANDATA.GEN_AI_REQUEST_TOP_P, top_p)

reasoning_level = kwargs.get("reasoning_effort")
if reasoning_level is not None and _is_given(reasoning_level):
set_on_span(SPANDATA.GEN_AI_REQUEST_REASONING_LEVEL, reasoning_level)

if (
not should_send_default_pii()
or not integration.include_prompts
Expand Down
Loading
Loading