Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pages/docs/quickstart/embeddings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 10 additions & 3 deletions pages/docs/quickstart/getting_started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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();

Expand All @@ -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)
5 changes: 3 additions & 2 deletions pages/docs/quickstart/tools.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down