ProcessorBase#

class council.llm.llm_function.ProcessorBase[source]#

Bases: Generic[T_Input, T_Output], ABC

Base class for a Processor, transforming an input object into an output object. List of processors can be then used to create a PipelineProcessor.

LLMProcessor#

class council.llm.llm_function.LLMProcessor(llm: LLMBase | LLMMiddlewareChain, output_obj_type: Type[T_LLMOutput], name: str | None = None)[source]#

Bases: ProcessorBase[T_LLMInput, T_LLMOutput]

ProcessorBase that uses an LLM to convert an input object into an output object. Keeps track of records processed by this instance.

property records: List[LLMProcessorRecord]#

List of all records processed by this instance.

property records_with_exceptions: Sequence[LLMProcessorRecord]#

List of records processed by this instance that resulted in an exception.

NaivePipelineProcessor#

class council.llm.llm_function.NaivePipelineProcessor(processors: Sequence[ProcessorBase])[source]#

Bases: PipelineProcessorBase[T_Input, T_Output]

PipelineProcessor that executes processors in a linear order without any error handling. Each processor should be able to handle errors independently.

flowchart LR A(Processor A) --> B(Processor B) A --> A B --> B

BacktrackingPipelineProcessor#

class council.llm.llm_function.BacktrackingPipelineProcessor(processors: Sequence[ProcessorBase], max_backtracks: int = 3)[source]#

Bases: PipelineProcessorBase[T_Input, T_Output]

PipelineProcessor that executes processors in a linear order backtracking errors. If a processor fails, the pipeline will backtrack to the previous processor (or specified in the exception) and try again.

flowchart LR A(Processor A) --> B(Processor B) A --> A B --> B B --> A