From 34a856b5564568236e578d6945bbac2d0099e820 Mon Sep 17 00:00:00 2001 From: Parikalp Bhardwaj Date: Wed, 27 May 2026 18:20:16 +0400 Subject: [PATCH] docs: fix quickstart install command --- pages/docs/quickstart/embeddings.mdx | 5 +++-- pages/docs/quickstart/getting_started.mdx | 13 ++++++++++--- pages/docs/quickstart/tools.mdx | 5 +++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pages/docs/quickstart/embeddings.mdx b/pages/docs/quickstart/embeddings.mdx index 4c3ac43..c96dc82 100644 --- a/pages/docs/quickstart/embeddings.mdx +++ b/pages/docs/quickstart/embeddings.mdx @@ -12,10 +12,11 @@ Before installing `rig`, make sure you have [the Rust programming language](http To install `rig`, you can do so with the following command in a Rust project (in your terminal): ```bash -cargo add rig-core tokio +cargo add rig +cargo add tokio --features macros,rt-multi-thread ``` -This will add the `rig-core` dependency in your Rust project, as well as Tokio which is an asynchronous Rust runtime which you will need to use `rig`. +This will add the `rig` dependency in your Rust project, as well as Tokio which is an asynchronous Rust runtime which you will need to use `rig`. ## Embeddings with Rig diff --git a/pages/docs/quickstart/getting_started.mdx b/pages/docs/quickstart/getting_started.mdx index d73df0b..90bc767 100644 --- a/pages/docs/quickstart/getting_started.mdx +++ b/pages/docs/quickstart/getting_started.mdx @@ -12,10 +12,11 @@ Before installing `rig`, make sure you have [the Rust programming language](http To install `rig`, you can do so with the following command in a Rust project (in your terminal): ```bash -cargo add rig-core tokio +cargo add rig anyhow dotenvy +cargo add tokio --features macros,rt-multi-thread ``` -This will add the `rig-core` dependency in your Rust project, as well as Tokio which is an asynchronous Rust runtime which you will need to use `rig`. +This will add `rig`, Tokio for the async runtime, `anyhow` for error handling, and `dotenvy` for loading environment variables from a local `.env` file. ## Basic Usage @@ -25,9 +26,13 @@ Below is a simple example of how you can use `rig` to prompt OpenAI's GPT-4 mode use rig::client::{CompletionClient, ProviderClient}; use rig::completion::Prompt; use rig::providers::openai; +use anyhow; #[tokio::main] async fn main() -> Result<(), anyhow::Error> { + // Load environment variables from a local `.env` file, if present. + dotenvy::dotenv().ok(); + // Create OpenAI client let client = openai::Client::from_env(); @@ -46,6 +51,8 @@ async fn main() -> Result<(), anyhow::Error> { } ``` -To run this, you will need an OpenAI API key as an environment variable (`OPENAI_API_KEY`). Then simply use `cargo run` and you'll see your response! +To run this, set your OpenAI API key as an environment variable or add it to a `.env` file: + +OPENAI_API_KEY=your-api-key Interested in using other providers like DeepSeek or Claude? Check out [our list of providers that we support.](/docs/integrations/model_providers) diff --git a/pages/docs/quickstart/tools.mdx b/pages/docs/quickstart/tools.mdx index 66ef2b3..1bd5eea 100644 --- a/pages/docs/quickstart/tools.mdx +++ b/pages/docs/quickstart/tools.mdx @@ -12,10 +12,11 @@ Before installing `rig`, make sure you have [the Rust programming language](http To install `rig`, you can do so with the following command in a Rust project (in your terminal): ```bash -cargo add rig-core tokio +cargo add rig anyhow serde serde_json +cargo add tokio --features macros,rt-multi-thread ``` -This will add the `rig-core` dependency in your Rust project, as well as Tokio which is an asynchronous Rust runtime which you will need to use `rig`. +This will add the `rig` dependency in your Rust project, as well as Tokio which is an asynchronous Rust runtime which you will need to use `rig`. ## Tool functions with Rig