README.md
<a href="https://docs.rig.rs"></a> <a href="https://docs.rs/rig-core/latest/rig/"></a> <a href="https://crates.io/crates/rig-core"></a> <a href="https://crates.io/crates/rig-core"></a> </br> <a href="https://discord.gg/playgrounds"></a> <a href=""></a> <a href="https://github.com/0xPlaygrounds/rig"></a>
</p> <div align="center">📑 Docs <span> • </span> 🌐 Website <span> • </span> 🤝 Contribute <span> • </span> ✍🏽 Blogs
</div>✨ If you would like to help spread the word about Rig, please consider starring the repo!
[!WARNING] Here be dragons! As we plan to ship a torrent of features in the following months, future updates will contain breaking changes. With Rig evolving, we'll annotate changes and highlight migration paths as we encounter them.
Rig is a Rust library for building scalable, modular, and ergonomic LLM-powered applications.
More information about this crate can be found in the official & crate (API Reference) documentations.
Below is a non-exhaustive list of companies and people who are using Rig:
proteinpaint, a genomics visualisation tool.rig for simplifying LLM calls and implement model picker.For a full list, check out our ECOSYSTEM.md file.
Are you also using Rig? Open an issue to have your name added!
cargo add rig-core
use rig::client::{CompletionClient, ProviderClient};
use rig::completion::Prompt;
use rig::providers::openai;
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Create OpenAI client
let client = openai::Client::from_env();
// Create agent with a single context prompt
let comedian_agent = client
.agent("gpt-5.2")
.preamble("You are a comedian here to entertain the user using humour and jokes.")
.build();
// Prompt the agent and print the response
let response = comedian_agent.prompt("Entertain me!").await?;
println!("{response}");
Ok(())
}
Note using #[tokio::main] requires you enable tokio's macros and rt-multi-thread features
or just full to enable all features (cargo add tokio --features macros,rt-multi-thread).
You can find more examples each crate's examples (ie. rig/rig-core/examples) directory. More detailed use cases walkthroughs are regularly published on our Dev.to Blog and added to Rig's official documentation (docs.rig.rs).
Vector stores are available as separate companion-crates:
rig-mongodbrig-lancedbrig-neo4jrig-qdrantrig-sqliterig-surrealdbrig-milvusrig-scylladbrig-s3vectorsrig-helixdbThe following providers are available as separate companion-crates:
rig-bedrockrig-fastembedrig-vertexaiWe also have some other associated crates that have additional functionality you may find helpful when using Rig:
rig-onchain-kit - the Rig Onchain Kit. Intended to make interactions between Solana/EVM and Rig much easier to implement.