Conversation
Some model (incl. `o4-mini-deep-research`) aren't compatible with the chat/completion API. This PR introduces a new `Response` class, which - similarly to `Chat` (and inheriting from the same base `Conversation` class) - allows a user to target the `responses` endpoint.
|
This change would be backward compatible as it falls back to the chat completion API when you provide audio. |
|
Just some heads up, support for audio in the Responses API might be coming:
Don't see it in the docs yet. |
|
I'm interested in Responses API support so we can more easily connect to remote MCP servers. |
|
While there seem to be very few technical reasons to switch to the Responses API, it looks like OpenAI is set on pushing it hard. Ignoring the reasons why they're doing this (this is not the place to discuss that) I'm worried that they will start to release new features only on ResponsesAPI in order to force people to switch. I doubt they will deprecate the Completions API but I wouldn't be surprised if they decide to "leave it behind". In that case it would be good to have RubyLLM support ResponsesAPI at least as an optional non-default. I realise it's a problem due to RubyLLM not being designed to have multiple APIs per provider but is that a direction with less friction? Perhaps "OpenAIResponses" could be introduced as a new separate provider, with OpenAI provider still defaulting to Completions. I know that has some potential for confusion but at least it would make it very explicit that you need to intentionally switch to the Responses API. |
|
What are the scenarios, aside from audio inputs, where the completions API would provide value? I could change this to offer both options but I'm just not sure why. |
Kind of ridiculous that "Coming soon" has been so long. |
I don't think there's any. But there are also very few technical reasons why you'd need to switch to ResponsesAPI, other than OpenAI obviously being intent on pushing it hard as the default choice. Which I think is a good enough reason to add it to RubyLLM. It's kind of annoying that Audio is not supported because otherwise this could be a change to just switch the RubyLLM backend from Completion to Responses. And I don't think it's an option to just not support audio in RubyLLM so supporting both seem like the only option going forward. I'm wondering if a way forward would be to keep Responses vs Completions API as an implementation detail: Use Responses by default and transparently fallback to Completions with audio? This would remove the need to refactor RubyLLM to support multiple implementations per provider. It would be just one implementation that happens to use both APIs under the hood. |
That was my intent with the current state of this PR. Are you seeing something missing or different? |
Sorry! I noticed this PR some time ago and missed that development in the meantime. I see now the |
|
I'm a little confused to hear that there aren't any compelling reasons to want to use the response API. Better support for reasoning + being able to use web search while also using function calling seem like big advantages. |
|
@tpaulshippy Thank you for your work. To be honest, I don't understand why this isn't merged by @crmne. Our reason to switch to ruby_llm was mainly the better support of modern APIs and I honestly can't quite understand why this isn't a priority.
So unless there is a reson I am not seeing, I am strongly urging to merge this PR and use the recommended API. It's just a question of time when a new model won't be supported anymore with the Chat Responses API.
|
|
@tpaulshippy thank you for your work on this PR, are you planning to rebase it and clean conflicts? it's a great addition to ruby_llm and hopefully @crmne will merge it when ready! thanks again to both |
Started taking a look. Need to work a bit on the reasoning part and get cassettes updated. Should be able to push something here soon. |
|
Did what I could. Had some malloc issues updating cartridges on a couple of the PDF/image specs. Also noticed that we aren't really streaming the reasoning information from OpenAI, but I don't see it happening in main branch either - just getting a bunch of nils. |
|
Here are the first features only available in the responses API: https://x.com/openaidevs/status/2021286050623373500 Ceterum censeo ruby_LLM API responsorum sustinere debere, @crmne |
|
Super keen to see this shipped ❤️ |

What this does
As explained here there are numerous reasons to use the newer Responses API instead of the Chat Completions API. Features we get by switching include:
o4-mini-deep-researchThere is one feature not yet available - audio inputs are not supported by the Responses API. So, the library will detect any audio inputs and fall back to the Chat Completions API if they exist.
Type of change
Scope check
Quality check
overcommit --installand all hooks passmodels.json,aliases.json)API changes
Related issues
Replaces #290
Should enable resolution of #213