Skip to content

Responses API #136

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
mattgi opened this issue Apr 16, 2025 · 1 comment
Open

Responses API #136

mattgi opened this issue Apr 16, 2025 · 1 comment

Comments

@mattgi
Copy link

mattgi commented Apr 16, 2025

When trying to convert to using the new Responses API, whilst the input does accept an array of items, it is not possible afaict to pass an array of items that include user/assistant messages.

I've since refactored the code I had back to ChatCompletions, but it was using InputItems and the error was:

OpenAI chat error: responseUnsuccessful(description: "status code 400 Invalid value: \'input_text\'. Supported values are: \'output_text\' and \'refusal\'.", statusCode: 400)

I also printed out the input array it was sending:

[
  SwiftOpenAI.InputItem(role: "user", content: [SwiftOpenAI.ContentItem.text(SwiftOpenAI.TextContent(text: "just wanted to test this works. tell me 3 dad jokes.", type: "input_text"))]),
  SwiftOpenAI.InputItem(role: "assistant", content: [SwiftOpenAI.ContentItem.text(SwiftOpenAI.TextContent(text: "Sure thing! Here are three dad jokes for you:\n\n1. Why don\'t skeletons fight each other?  \n   They don\'t have the guts!\n\n2. What do you call cheese that isn\'t yours?  \n   Nacho cheese!\n\n3. Why did the scarecrow win an award?  \n   Because he was outstanding in his field!", type: "input_text"))]),
  SwiftOpenAI.InputItem(role: "user", content: [SwiftOpenAI.ContentItem.text(SwiftOpenAI.TextContent(text: "ok, this is promising. I mean, not funny, but its good to see u can chat.", type: "input_text"))])
]

It might be the way I am working, but I feel like its more related to the library not setting the content type correctly for non-user messages.

@jamesrochabrun
Copy link
Owner

Thanks! can you please share:

  • The request with paramtere
  • The response or error
    Thanks

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

No branches or pull requests

2 participants