Skip to main content

Types

OnFailAction

class OnFailAction(str, Enum)

OnFailAction is an Enum that represents the different actions that can be taken when a validation fails.

Attributes:

  • REASK Literal["reask"] - On failure, Reask the LLM.
  • FIX Literal["fix"] - On failure, apply a static fix.
  • FILTER Literal["filter"] - On failure, filter out the invalid values.
  • REFRAIN Literal["refrain"] - On failure, refrain from responding; return an empty value.
  • NOOP Literal["noop"] - On failure, do nothing.
  • EXCEPTION Literal["exception"] - On failure, raise a ValidationError.
  • FIX_REASK Literal["fix_reask"] - On failure, apply a static fix, check if the fixed value passed validation, if not then reask the LLM.
  • CUSTOM Literal["custom"] - On failure, call a custom function with the invalid value and the FailResult's from any validators run on the value.

RailTypes

class RailTypes(str, Enum)

RailTypes is an Enum that represents the builtin tags for RAIL xml.

Attributes:

  • STRING Literal["string"] - A string value.
  • INTEGER Literal["integer"] - An integer value.
  • FLOAT Literal["float"] - A float value.
  • BOOL Literal["bool"] - A boolean value.
  • DATE Literal["date"] - A date value.
  • TIME Literal["time"] - A time value. DATETIME (Literal["date-time: - A datetime value.
  • PERCENTAGE Literal["percentage"] - A percentage value represented as a string. Example "20.5%".
  • ENUM Literal["enum"] - An enum value.
  • LIST Literal["list"] - A list/array value.
  • OBJECT Literal["object"] - An object/dictionary value.
  • CHOICE Literal["choice"] - The options for a discrimated union.
  • CASE Literal["case"] - A dictionary that contains a discrimated union.

MessageHistory

MessageHistory = List[Dict[str, Union[Prompt, str]]]

ModelOrListOfModels

ModelOrListOfModels = Union[Type[BaseModel], Type[List[Type[BaseModel]]]]

ModelOrListOrDict

ModelOrListOrDict = Union[Type[BaseModel], Type[List[Type[BaseModel]]],
Type[Dict[str, Type[BaseModel]]]]

ModelOrModelUnion

ModelOrModelUnion = Union[Type[BaseModel], Union[Type[BaseModel], Any]]

PydanticValidatorTuple

PydanticValidatorTuple = Tuple[Union[Validator, str, Callable], str]

PydanticValidatorSpec

PydanticValidatorSpec = Union[Validator, PydanticValidatorTuple]

UseValidatorSpec

UseValidatorSpec = Union[Validator, Type[Validator]]

UseManyValidatorTuple

UseManyValidatorTuple = Tuple[
Type[Validator],
Optional[Union[List[Any], Dict[str, Any]]],
Optional[Dict[str, Any]],
]

UseManyValidatorSpec

UseManyValidatorSpec = Union[Validator, UseManyValidatorTuple]

ValidatorMap

ValidatorMap = Dict[str, List[Validator]]