Skip to content

Comments

Fix InstructionsType decoding for reusable prompts (issue #187)#190

Merged
jamesrochabrun merged 1 commit intomainfrom
jroch-issue
Dec 27, 2025
Merged

Fix InstructionsType decoding for reusable prompts (issue #187)#190
jamesrochabrun merged 1 commit intomainfrom
jroch-issue

Conversation

@jamesrochabrun
Copy link
Owner

Summary

  • Fixes Decoding Error on Response Create #187: Decoding error when using reusable prompts with variables
  • Added messages([InputMessage]) case to InstructionsType to handle array of message objects returned by the API
  • Added 3 tests to cover all InstructionsType variants (string, array of strings, array of messages)

Test plan

  • Run swift test --filter ResponseModelValidationTests - all 10 tests pass
  • testInstructionsTypeStringDecoding - verifies string instructions still work
  • testInstructionsTypeArrayOfStringsDecoding - verifies array of strings still works
  • testInstructionsTypeMessagesDecoding - verifies the fix for reusable prompts

🤖 Generated with Claude Code

When using OpenAI's reusable prompts with variables, the `instructions`
field returns as an array of message objects instead of String or [String].
This adds support for decoding [InputMessage] in InstructionsType.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jamesrochabrun jamesrochabrun merged commit b138a46 into main Dec 27, 2025
3 checks passed
@jamesrochabrun jamesrochabrun deleted the jroch-issue branch December 27, 2025 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Decoding Error on Response Create

1 participant