more docs

This commit is contained in:
Jason
2023-07-09 12:46:46 +08:00
parent b0c3c56317
commit abe6ebcabf
7 changed files with 102 additions and 51 deletions
+14 -1
View File
@@ -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