Module llm_chain::traits

source ·
Expand description

Traits Module

Welcome to the traits module! This is where llm-chain houses its public traits, which define the essential behavior of steps and executors. These traits are the backbone of our library, and they provide the foundation for creating and working with different models in llm-chain.

Here’s a brief overview of the key concepts:

  • Steps: These are the building blocks that make up the chains. Steps define the parameters, including the prompt that is sent to the LLM (Large Language Model).
  • Executors: These are responsible for performing the steps. They take the output of a step, invoke the model with that input, and return the resulting output.

By implementing these traits, you can set up a new model and use it in your application. Your step defines the input to the model, and your executor invokes the model and returns the output. The output of the executor is then passed to the next step in the chain, and so on.

Enums

Traits

  • This marker trait is needed so the concrete VectorStore::Error can have a derived FromEmbeddings::Error
  • The Executor trait represents an executor that performs a single step in a chain. It takes a step, executes it, and returns the output.
  • Marker trait for errors in Executor method. It is needed so the concrete Errors can have a derived From<ExecutorError>
  • The Options trait represents an options type that is used to customize the behavior of a step or executor.
  • StepExtDeprecated
    A no-op. The StepExt trait previously extended the functionality of the Step trait, providing convenience methods for working with steps. Now it does nothing.
  • This marker trait is needed so users of VectorStore can derive FromVectorStore::Error