async-openai
async-openai copied to clipboard
fix<(responses)>: `parsing Error if multiple instructions are given`
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>)
}