Architecture
- file.rs
- pdf.rs
- ...(other loaders)
- mod.rs
- client.rs
- completion.rs
- lib.rs
Core concepts
Completion and embedding models
Rig provides a consistent API for working with LLMs and embeddings. Specifically,
each provider (e.g. OpenAI, Cohere) has a Client
struct that can be used to initialize completion
and embedding models. These models implement the CompletionModel
and EmbeddingModel traits respectively, which provide a common,
low-level interface for creating completion and embedding requests and executing them.
Agents
Rig also provides high-level abstractions over LLMs in the form of the Agent type.
The Agent type can be used to create anything from simple agents that use vanilla models to full blown RAG systems that can be used to answer questions using a knowledge base.
Vector stores and indexes
Rig defines a common interface for working with vector stores and indexes. Specifically, the library provides the VectorStore and VectorStoreIndex traits, which can be implemented on a given type to define vector stores and indices respectively. Those can then be used as the knowledge base for a RAG enabled Agent, or as a source of context documents in a custom architecture that use multiple LLMs or agents.