Format creation
Create a generic Response
model using a dynamically defined Pydantic schema.
This function allows you to define a custom set of fields (e.g., for QnA-style data),
and returns a typed Response[CustomQnA]
model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fields
|
dict
|
A dictionary of field definitions for the inner model. Example: fields = { "question": (str, ...), "answer": (str, ...), "explanation": (str, ...), } |
required |
Returns:
Type | Description |
---|---|
Type[Response]
|
Type[Response]: A |
Source code in urbanworm/format_creation.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|