Replies: 1 comment
-
Consider this message transcript as a motivating example:
|
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
-
Checked
Feature request
I would like to be able to use ChatOpenAI to provide both tools and a response_format schema. The OpenAI API allows this directly by simply providing both tools and response format. It seems to provide a good mechanism for ensuring structured responses--especially taking advantage of constrained decoding--that both expect results from tool calls and do not.
Currently this seems to be possible if I manually bind result format and tools to the model, but that looses the helper functionality provided by the
with_structured_output
andbind_tools
helpers.https://openai.com/index/introducing-structured-outputs-in-the-api/
Motivation
I would like to directly take advantage of the model's choice of whether to call a tool or not based on the context, while still ensuring that if a tool call is not necessary the resulting message is structured.
Proposal (If applicable)
I think an ideal option would be to allow
with_structured_output
to accept a tools parameter, which, if provided, first binds the tools and then binds the response format, and builds the appropriate parser chain.Beta Was this translation helpful? Give feedback.
All reactions