Skip to content

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