mirror of
https://github.com/kennethreitz/instructor.git
synced 2026-06-05 22:50:18 +00:00
more docs
This commit is contained in:
+14
-1
@@ -1,5 +1,18 @@
|
||||
# MultiTask
|
||||
|
||||
We define a helper function `MultiTask` that dynamitcally creates a new schema that has a task attribute defined as a list of the task subclass, it including some prebuild prompts and allows us to avoid writing some extra code.
|
||||
Defining a task and creating a list of classes is a common enough pattern that we define a helper function `MultiTask` that dynamitcally creates a new schema that has a task attribute defined as a list of the task subclass, it including some prebuild prompts and allows us to avoid writing some extra code.
|
||||
|
||||
!!! example "Extending user details"
|
||||
|
||||
Using the previous example with extracting `UserDetails` we might want to extract multiple users rather than a single user, `MultiTask` makes it easy!
|
||||
|
||||
```python
|
||||
class UserDetails(OpenAISchema):
|
||||
"""Details of a user"""
|
||||
name: str = Field(..., description="users's full name")
|
||||
age: int
|
||||
|
||||
MultiUserDetails = MultiTask(UserDetails)
|
||||
```
|
||||
|
||||
::: openai_function_call.dsl.multitask
|
||||
Reference in New Issue
Block a user