You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked for existing issues (including closed) about this
Feature Request
Add a new high level building block to Rig: the agent chain!
Motivation
Agentic chains (or agent chains, agent pipelines, etc.) have become a cornerstone of building LLM powered applications. Chains are flexible constructs that can be used to chain together multiple agents in a multistep process, define some agentic control flow based or simply to add data processing steps before and after prompting.
Whereas Rig Agents can be considered highly configurable blackboxes, chains make the prompting process explicit and declarative. They would therefore make a great addition to the library.
Proposal
Chains should provide a declarative interface for developers to define some arbitrary flow of operations. In fact, at their most general, chains are simply data processing pipelines where some steps happen to involve AI elements. As such, Rig chains should be implement as general processing pipeline, with some additional quality-of-life helpers for common LLM-related operations (e.g.: prompting a model/agent, RAGging documents, etc.). See the code snippet below for a proof of concept.
Chains would be analogous to Rust Iterators (or Streams) with two key differences:
They do not hold values (in other words, whereas Iterators have an associated type Item, chains would have two associated types Input and Output)
They operate on a single value at a time
// Proof of conceptlet chain = chain::new()// Retrieve top document from the index and return it with the prompt.lookup(index,2)// Format the prompt with the context documents if the previous step // was successful.map_ok(|(query, docs):(_,Vec<String>)| {format!("User question: {}\n\nWord definitions:\n{}",
query,
docs.join("\n"))})// Prompt the agent.prompt(&agent);let response = chain.call("What does \"glarb-glarb\" mean?").await?;
Alternatives
Alternatives explored included leveraging existing Rust Iterators and/or Streams to implement Rig chains, but these proved to be inadequate.
The text was updated successfully, but these errors were encountered:
I super like your implementation in Rust and I learned a lot from reading it.
I have to comment on this Langchain sourced marketing nonsense:
"Agentic chains (or agent chains, agent pipelines, etc.) have become a cornerstone of building LLM powered applications."
No not really. A cornerstone has a specific meaning in construction and masonry and certain concepts in computing have parallels. It would be correct to say that TCP/IP is a cornerstone of computer networking. While Agentic chains are a useful data structure to describe it as "the cornerstone of agentic systems" is a marketing statement and not an engineering one.
"Chains are flexible constructs that can be used to chain together multiple agents in a multistep process, define some agentic control flow based or simply to add data processing steps before and after prompting."
Sure and that's fine but that is not what most people who deploy agents want and in exchange for this feature it introduces computational cost and latency, and introduces complexity that is difficult for human programmers to keep track of. How do you manage to scale chains? At what point is adding more "chains" a waste of time and money? I know that's a job for the programmer to figure out but it's something to be mindful about when introducing complexity for the sake of introducing complexity when most people don't need this.
Whereas Rig Agents can be considered highly configurable blackboxes, chains make the prompting process explicit and declarative. They would therefore make a great addition to the library.
They can also be considered not as blackboxes but as carefully designed lightweight interfaces, making your point moot. I'm not entirely sure what you mean by "chains make the prompting process explicit and declarative." Prompting is already inherent and explicit and declarative in LLMs. Try making an LLM without a prompt and get back to us on how it goes. I am not sure how writing multiple prompts for multiple agents makes the process more explicit and declarative in the way that writing declarative infrastructure as code is. I'm open to becoming better informed on this if there is something I am explicitly missing. Chains as a data structure make the prompting process for inputs and outputs across multiple agents explicit but is not strictly necessary or desirable in a lot of use cases. Engineering cool things is fine misleading statements in order to make a case for it is tired.
Feature Request
Add a new high level building block to Rig: the agent chain!
Motivation
Agentic chains (or agent chains, agent pipelines, etc.) have become a cornerstone of building LLM powered applications. Chains are flexible constructs that can be used to chain together multiple agents in a multistep process, define some agentic control flow based or simply to add data processing steps before and after prompting.
Whereas Rig
Agents
can be considered highly configurable blackboxes, chains make the prompting process explicit and declarative. They would therefore make a great addition to the library.Proposal
Chains should provide a declarative interface for developers to define some arbitrary flow of operations. In fact, at their most general, chains are simply data processing pipelines where some steps happen to involve AI elements. As such, Rig chains should be implement as general processing pipeline, with some additional quality-of-life helpers for common LLM-related operations (e.g.: prompting a model/agent, RAGging documents, etc.). See the code snippet below for a proof of concept.
Chains would be analogous to Rust
Iterators
(orStreams
) with two key differences:Iterators
have an associated typeItem
, chains would have two associated typesInput
andOutput
)Alternatives
Alternatives explored included leveraging existing Rust
Iterators
and/orStreams
to implement Rig chains, but these proved to be inadequate.The text was updated successfully, but these errors were encountered: