Replies: 2 comments 5 replies
-
I was wondering if there have been any updates regarding support for the Responses API. |
Beta Was this translation helpful? Give feedback.
5 replies
-
Is this the way to support Responses API? Maybe this discussion can be closed? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Supporting Responses
I think we can support the responses model in a few ways but I would love to know if there are more things that we can integrate into our support for Responses itself that leverage this new API capability.
mode
and this operates as per original instructortools
kwarg and specify what they want to configure (Eg. WebSearch, FileSearch )The difference is that for 1, we have to allow multiple tool calls and parse it differently ( see below for how this might work ). I think this unlocks a new use-case for instructor which is to combine the web search results or File Search and from there obtain a structured output.
Without In-Built Tools
Without In Built Tools, we can support the responses API by simply modifying the
Instructor
class and then doing a manual mapping of the kwargs from the ChatCompletions API over to the new responses kwarg.To get the above to work, I needed to override the
create
method as seen below so that it would accept both a messageNote: Current implementation requires overriding the 'create' method and related methods so we would also need to supporting both response.create and chat.completions.create in future updates.
Under the hood since we’d be using the
responses.create
method, I think we would be able to support most API methods moving forward.Using In-Built Tools
When using in-built tools, we can provide multiple tools and allow the model to call a few of them. We can see an example below
This is also the same thing for the web search API as we’ll see below when we ask the model to do a quick search for great restaurants in Paris and ask it to return a structured output in the form of a single recomendation.
We can see that in both cases, the final result was a structured object which is consistent with the tool schema that we defined earlier. I think that by supporting this specific use case, instructor becomes a way for us to consolidate information which these built-in tools can support
Beta Was this translation helpful? Give feedback.
All reactions