Skip to main content

Crate rig

Crate rig 

Source
Expand description

Public facade for Rig.

The rig crate is the user-facing entry point for Rig. It re-exports the full public API of rig_core, so core traits, builders, providers, tools, vector-store abstractions, and request/response types are available through rig::... paths.

§Companion integrations

Companion provider and vector-store crates are exposed as feature-gated modules on this facade. Enable only the integrations your application uses:

[dependencies]
rig = { version = "0.36.0", features = ["lancedb", "fastembed"] }

This enables modules such as rig::lancedb and rig::fastembed. Other companion integrations follow the same pattern, with feature names aligned to their facade module paths wherever Rust module naming allows it.

§When to use rig-core directly

Depend on the rig-core package directly when you only need the core Rig implementation crate, including provider abstractions, built-in core providers, tools, memory traits, and vector-store traits, without the root facade’s companion integration feature surface.

Modules§

agent
This module contains the implementation of the Agent struct and its builder.
audio_generationaudio
Everything related to audio generation (ie, Text To Speech). Rig abstracts over a number of different providers using the AudioGenerationModel trait.
bedrockbedrock
client
This module provides traits for defining and creating provider clients. Clients are used to create models for completion, embeddings, etc.
completion
Provider-agnostic completion and chat abstractions.
embeddings
Provider-agnostic embedding abstractions.
evalsexperimental
Evals. From OpenAI’s evals repo:
extractor
This module provides high-level abstractions for extracting structured data from text using LLMs.
fastembedfastembed or fastembed-hf-hub or fastembed-ort-download-binaries
gemini_grpcgemini-grpc
helixdbhelixdb
http_client
image_generationimage
Everything related to core image generation abstractions in Rig. Rig allows calling a number of different providers (that support image generation) using the ImageGenerationModel trait.
integrations
lancedblancedb
loaders
File loading utilities for preparing local documents as model or embedding input.
markers
Common marker traits and structs for type-safe builders.
memory
Conversation memory APIs and optional memory policy helpers.
milvusmilvus
model
Model metadata returned by providers with model listing support.
mongodbmongodb
neo4jneo4j
one_or_many
pipeline
This module defines a flexible pipeline API for defining a sequence of operations that may or may not use AI components (e.g.: semantic search, LLMs prompting, etc).
postgrespostgres
prelude
providers
Provider integrations included in rig-core.
qdrantqdrant
s3vectorss3vectors
scylladbscylladb
sqlitesqlite
streaming
This module provides functionality for working with streaming completion models. It provides traits and types for generating streaming completion requests and handling streaming completion responses.
surrealdbsurrealdb
telemetry
This module primarily concerns being able to orchestrate telemetry across a given pipeline or workflow. This includes tracing, being able to send traces to an OpenTelemetry collector, setting up your agents with the correct tracing style so you can emit the right traces for platforms like Langfuse, and more.
test_utilstest-utils
Test utilities for deterministic completion-model tests.
tool
Module defining tool related structs and traits.
tools
transcription
This module provides functionality for working with audio transcription models. It provides traits, structs, and enums for generating audio transcription requests, handling transcription responses, and defining transcription models.
vector_store
Vector store abstractions for semantic search and retrieval.
vectorizevectorize
vertexaivertexai
wasm_compat

Macros§

conditional
Creates an Op that conditionally dispatches to one of multiple sub-ops based on the variant of the input enum.
if_not_wasm
if_wasm
parallel
parallel_internal
parallel_op
try_conditional
Creates a TryOp that conditionally dispatches to one of multiple sub-ops based on the variant of the input enum, returning a Result.
try_parallel
try_parallel_internal
tuple_pattern

Structs§

EmptyListError
Error type for when trying to create a OneOrMany object with an empty vector.
ExtractionResponse
Response from an extraction operation containing the extracted data and usage information.
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().

Traits§

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.

Attribute Macros§

tool_macro
A procedural macro that transforms a function into a rig::tool::Tool that can be used with a rig::agent::Agent.

Derive Macros§

Embed
A macro that allows you to implement the rig::embedding::Embed trait by deriving it. Usage can be found below: