Skip to content

Commit d947899

Browse files
full responses api tests
1 parent c7263ea commit d947899

2 files changed

Lines changed: 256 additions & 64 deletions

File tree

sentry_sdk/integrations/openai.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
Union,
4040
)
4141
from sentry_sdk.tracing import Span
42+
from sentry_sdk._types import TextPart
4243

4344
from openai.types.responses import ResponseInputParam, ResponseInputItemParam
4445
from openai import Omit
@@ -289,16 +290,17 @@ def _set_responses_api_input_data(
289290
and should_send_default_pii()
290291
and integration.include_prompts
291292
):
292-
# Deliberate use of function accepting completions API type because
293-
# of shared structure FOR THIS PURPOSE ONLY.
294-
instructions_text_parts = _transform_system_instructions(system_instructions)
293+
instructions_text_parts: "list[TextPart]" = []
295294
if explicit_instructions is not None and _is_given(explicit_instructions):
296295
instructions_text_parts.append(
297296
{
298297
"type": "text",
299-
"content": explicit_instructions, # type: ignore
298+
"content": explicit_instructions,
300299
}
301300
)
301+
# Deliberate use of function accepting completions API type because
302+
# of shared structure FOR THIS PURPOSE ONLY.
303+
instructions_text_parts += _transform_system_instructions(system_instructions)
302304

303305
set_data_normalized(
304306
span,

0 commit comments

Comments
 (0)