Skip to content

Index

BasePydanticProgram #

Bases: DispatcherSpanMixin, ABC, Generic[Model]

A base class for LLM-powered function that return a pydantic model.

Note: this interface is not yet stable.

Source code in llama-index-core/llama_index/core/types.py
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
class BasePydanticProgram(DispatcherSpanMixin, ABC, Generic[Model]):
    """A base class for LLM-powered function that return a pydantic model.

    Note: this interface is not yet stable.
    """

    @property
    @abstractmethod
    def output_cls(self) -> Type[Model]:
        pass

    @abstractmethod
    def __call__(self, *args: Any, **kwds: Any) -> Model:
        pass

    async def acall(self, *args: Any, **kwds: Any) -> Model:
        return self(*args, **kwds)