Replies: 2 comments
-
I take it back using union with instructor output forms parallel function calls |
Beta Was this translation helpful? Give feedback.
0 replies
-
addressed in #378 |
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
-
Abstract
This proposal introduces a Multitool Response Mode, allowing simultaneous use of multiple response models in a single operation. This approach aims to simplify complex data extraction tasks by enabling flexible and efficient handling of various data types.
Rationale
Current limitations require using polymorphism or unions for tasks that could benefit from multiple response types. This enhancement proposes a straightforward method to employ multiple models, improving developer experience and operational efficiency.
Specification
The enhancement introduces
Mode.MULTITOOL
and allows definingresponse_model
asList[Union[A, B, C]]
. This explicit typing informs developers of the returned data types, ensuring clarity and type safety.Before
Before, I would force you to either use polymorphism or create a third type that contains a union.
If we had two capabilities like search email and search calendar:
You would have to either use polymorphism.
Polymorphism
Union w/ Extra level
Specification
The enhancement introduces
Mode.MULTITOOL
and allows definingresponse_model
asList[Union[A, B, C]]
. This explicit typing informs developers of the returned data types, ensuring clarity and type safety.Example
Implementation
The feature prioritizes compatibility with existing IDEs and type systems, focusing on a seamless integration that does not disrupt current library use. The
stream=True
option will be considered in future iterations.Compatibility
This extension is designed to be backward compatible, offering additional functionality without affecting existing implementations. It provides an optional tool for developers requiring advanced data handling capabilities.
Additional Notes
Parallel function calling.
Parallel function calling is enabled by the tools call: https://platform.openai.com/docs/guides/function-calling/parallel-function-calling
I want to separate tools and multi tools because of this
If we know that we want to force a single response object, we can set the tool choice specifically to the function name. If you want multiple tools, there is a non-zero chance that we return nothing. Which means we have to write more prompts to ask it to always call a tool.
Will always return boy since we end up parsing:
Whereas if we had parallel function calling... we'd be parsing
Which would correctly allow us to use the name attribute. For these parallel calls
Beta Was this translation helpful? Give feedback.
All reactions