Skip to main content

Module prelude

Module prelude 

Source
Expand description

Common imports for Rig’s classic runtime.

Re-exports§

pub use crate::agent::Agent;
pub use crate::agent::MultiTurnStreamItem;
pub use crate::agent::StreamingResult;
pub use crate::client::AgentClientExt;
pub use crate::client::AgentModelExt;
pub use crate::completion::Chat;
pub use crate::completion::Prompt;
pub use crate::completion::PromptError;
pub use crate::completion::StructuredOutputError;
pub use crate::completion::TypedPrompt;
pub use crate::streaming::StreamingChat;
pub use crate::streaming::StreamingPrompt;
pub use crate::tool::Tool;
pub use crate::tool::ToolSet;

Structs§

EmbeddingsBuilder
Builder for creating embeddings from one or more documents of type T. Note: T can be any type that implements the Embed trait.
InMemoryVectorStore
InMemoryVectorStore is a simple in-memory vector store that stores embeddings in-memory using a HashMap.
OneOrMany
Struct containing either a single item or a list of items of type T. If a single item is present, first will contain it and rest will be empty. If multiple items are present, first will contain the first item and rest will 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().
VectorSearchRequest
A vector search request for querying a super::VectorStoreIndex.

Enums§

CompletionError
Errors returned by completion models.
Message
A provider-agnostic chat message.
VerifyError
Errors from provider client verification.

Traits§

AudioGenerationClientaudio
A provider client with audio generation capabilities. Clone is required for conversions between client types.
CompletionClient
A provider client with completion capabilities. Clone is required for conversions between client types.
CompletionModel
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.
EmbeddingModel
Trait for embedding models that can generate embeddings for documents.
EmbeddingsClient
A provider client with embedding capabilities. Clone is required for conversions between client types.
ImageGenerationClientimage
A provider client with image generation capabilities. Clone is required for conversions between client types.
ModelListingClient
A provider client with model listing capabilities.
ProviderClient
Abstracts over the ability to instantiate a client, either via environment variables or some Self::Input
TranscriptionClient
A provider client with transcription capabilities. Clone is required for conversions between client types.
VectorStoreIndex
Trait for querying a vector store by similarity.
VerifyClient
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::Embed trait by deriving it. Usage can be found below: