Skip to content

fix<(responses)>: parsing Error if multiple instructions are given #399

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

p4r4d0xb0x
Copy link

While Using Responses api, I found that instructions Fields can be Listed response.

Expected:

{
  ...
  "instructions": "Structure My Json"
}

Response:

{
  "instructions": [
    {
      "type": "message",
      "content": [
        {
          "type": "input_text",
          "text": "You are ~~~~ ( hide ) ~~~ ract paragraphs, body text, bibliographic references, and image/table references,\n ~~~"
        }
      ],
      "role": "system"
    },
    {
      "type": "message",
      "content": [
        {
          "type": "input_text",
          "text": "structure my uploaded file"
        }
      ],
      "role": "user"
    }
  ]
}

So I Added Untagged enum

#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(untagged)]
pub enum ResponseInstructions {
  /// The instructions that were inserted as the first item in context.
  Single(String),

  Multiple(Vec<InputMessage>)
}

@p4r4d0xb0x p4r4d0xb0x changed the title fix<(responses)>: Fix parsing Error if multiple instructions are given. Fix parsing Error if multiple instructions are given ( Responses ) Jul 1, 2025
@p4r4d0xb0x p4r4d0xb0x changed the title Fix parsing Error if multiple instructions are given ( Responses ) fix<(responses)>: parsing Error if multiple instructions are given ( Responses ) Jul 1, 2025
@p4r4d0xb0x p4r4d0xb0x changed the title fix<(responses)>: parsing Error if multiple instructions are given ( Responses ) fix<(responses)>: parsing Error if multiple instructions are given Jul 1, 2025
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.

1 participant