|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from abc import ABC, abstractmethod |
|
|
from typing import Any, Dict |
|
|
|
|
|
|
|
|
class BaseConverter(ABC): |
|
|
r"""A base class for schema outputs that includes functionality |
|
|
for managing the response format. |
|
|
|
|
|
Args: |
|
|
output_schema (Optional[Type[BaseModel]], optional): The expected |
|
|
format of the response. (default: :obj:`None`) |
|
|
""" |
|
|
|
|
|
@abstractmethod |
|
|
def convert( |
|
|
self, content: str, *args: Any, **kwargs: Dict[str, Any] |
|
|
) -> Any: |
|
|
r"""Structures the input text into the expected response format. |
|
|
|
|
|
Args: |
|
|
text (str): The input text to be structured. |
|
|
output_schema (Optional[Type[BaseModel]], optional): |
|
|
The expected format of the response. Defaults to None. |
|
|
prompt (Optional[str], optional): The prompt to be used. |
|
|
|
|
|
Returns: |
|
|
Any: The converted response. |
|
|
""" |
|
|
pass |
|
|
|