Skip to content

Rail

RAIL (Reliable AI Language) is a dialect of XML that allows users to specify guardrails for large language models (LLMs).

A RAIL file contains a root element called <rail version="x.y"> that contains the following elements as children: 1. <input strict=True/False>, which contains the input schema 2. <output strict=True/False>, which contains the output schema 3. <prompt>, which contains the prompt to be passed to the LLM 4. <instructions>, which contains the instructions to be passed to the LLM

input_schema instance-attribute

input_schema: Optional[Schema]

output_schema instance-attribute

output_schema: Schema

instructions instance-attribute

instructions: Optional[Instructions]

prompt instance-attribute

prompt: Optional[Prompt]

version class-attribute instance-attribute

version: str = '0.1'

from_file classmethod

from_file(file_path: str) -> Rail

from_string classmethod

from_string(string: str) -> Rail

from_xml classmethod

from_xml(xml: ET._Element)

from_pydantic classmethod

from_pydantic(output_class: Type[BaseModel], prompt: Optional[str] = None, instructions: Optional[str] = None, reask_prompt: Optional[str] = None, reask_instructions: Optional[str] = None)

from_string_validators classmethod

from_string_validators(validators: List[Validator], description: Optional[str] = None, prompt: Optional[str] = None, instructions: Optional[str] = None, reask_prompt: Optional[str] = None, reask_instructions: Optional[str] = None)