Module llm_chain::chains

source ·
Expand description

Chains are multi-step modes of execution for LLMs such as Sequential or MapReduce.

This module contains submodules for various types of chains. Chains are powerful tools that allow you to connect multiple steps together in a sequence. They take a set of parameters and an executor, perform the steps, and return the result.

Currently, we support two types of chains that cater to different use cases. But worry not! We will be adding more in the future

Here are the supported chain types:

  1. Sequential: This chain type executes the steps one after another in a linear sequence. It’s perfect for tasks that need a clear and simple order of execution.
  2. MapReduce: This chain type follows the MapReduce paradigm, where the steps are divided into mapping and reducing phases. It’s great for tasks that require parallel processing and data aggregation.
  3. Converstation: This chain type models a conversation between the LLM and some other entity. It’s great for tasks that require a back-and-forth between the LLM and the user. Stay tuned for more chain types, and feel free to contribute your own! 🎉

Modules

  • The Chain module models a conversation between an entity and an LLM. It manages the conversation state and provides methods for sending messages and receiving responses.
  • The map_reduce module contains the Chain struct, which represents a map-reduce chain.
  • A module for implementing a sequential chain of LLM steps.