Expand description
The rig prelude.
Bringing this module into scope with use rig::prelude::* pulls in the
portable provider-client, completion, embedding, tool, and vector-store
contracts.
This is deliberately the common path, not the whole crate. Advanced surfaces — the hook system, the run-loop stepping types, message content blocks, tool authoring internals, extraction/loaders/memory, etc. — are imported explicitly from their modules so those imports document intent.
Structs§
- Embeddings
Builder - Builder for creating embeddings from one or more documents of type
T. Note:Tcan be any type that implements the Embed trait. - InMemory
Vector Store - InMemoryVectorStore is a simple in-memory vector store that stores embeddings in-memory using a HashMap.
- OneOr
Many - Struct containing either a single item or a list of items of type T.
If a single item is present,
firstwill contain it andrestwill be empty. If multiple items are present,firstwill contain the first item andrestwill contain the rest. IMPORTANT: this struct cannot be created with an empty vector. OneOrMany objects can only be created using OneOrMany::from() or OneOrMany::try_from(). - Vector
Search Request - A vector search request for querying a
super::VectorStoreIndex.
Enums§
- Completion
Error - Errors returned by completion models.
- Message
- A provider-agnostic chat message.
- Verify
Error - Errors from provider client verification.
Traits§
- Audio
Generation Client - A provider client with audio generation capabilities. Clone is required for conversions between client types.
- Completion
Client - A provider client with completion capabilities. Clone is required for conversions between client types.
- Completion
Model - Trait defining a completion model that can be used to generate completion responses. This trait is meant to be implemented by the user to define a custom completion model, either from a third party provider (e.g.: OpenAI) or a local model.
- Embed
- Derive this trait for objects that need to be converted to vector embeddings. The Embed::embed method accumulates string values that need to be embedded by adding them to the TextEmbedder. If an error occurs, the method should return EmbedError.
- Embedding
Model - Trait for embedding models that can generate embeddings for documents.
- Embeddings
Client - A provider client with embedding capabilities. Clone is required for conversions between client types.
- Image
Generation Client - A provider client with image generation capabilities. Clone is required for conversions between client types.
- Model
Listing Client - A provider client with model listing capabilities.
- Portable
Tool - A context-free typed tool that can be executed by any Rig runtime.
- Provider
Client - Abstracts over the ability to instantiate a client, either via environment variables or some
Self::Input - Transcription
Client - A provider client with transcription capabilities. Clone is required for conversions between client types.
- Vector
Store Index - Trait for querying a vector store by similarity.
- Verify
Client - A provider client that can verify the configuration. Clone is required for conversions between client types.
Derive Macros§
- Embed
- A macro that allows you to implement the
rig::embedding::Embedtrait by deriving it. Usage can be found below: