Skip to content
Closed
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
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ members = [
"rig-bedrock",
"rig-milvus",
"rig-wasm",
"rig-s3vectors", "rig-helixdb",
"rig-s3vectors", "rig-helixdb", "rig-vertex",
]

[profile.release]
Expand Down
34 changes: 34 additions & 0 deletions rig-core/examples/agent_with_vertex.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use rig::prelude::*;

use rig::providers::gemini::completion::gemini_api_types::{
AdditionalParameters, GenerationConfig,
};
use rig::{completion::Prompt, providers};

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
// Create OpenAI client
let client = providers::vertex::Client::from_env();

let gen_cfg = GenerationConfig {
top_k: Some(1),
top_p: Some(0.95),
candidate_count: Some(1),
..Default::default()
};
let cfg = AdditionalParameters::default().with_config(gen_cfg);

// Create agent with a single context prompt
let comedian_agent = client
.agent("gemini-2.5-flash")
.preamble("You are a comedian here to entertain the user using humour and jokes.")
.additional_params(serde_json::to_value(cfg).unwrap())
.build();

// Prompt the agent and print the response
let response = comedian_agent.prompt("Entertain me!").await?;

println!("{response}");

Ok(())
}
1 change: 1 addition & 0 deletions rig-core/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,6 @@
pub mod openrouter;
pub mod perplexity;
pub mod together;
pub mod vertex;

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / test

file not found for module `vertex`

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / check rig-core wasm target

file not found for module `vertex`

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / clippy

file not found for module `vertex`

error[E0583]: file not found for module `vertex` --> rig-core/src/providers/mod.rs:65:1 | 65 | pub mod vertex; | ^^^^^^^^^^^^^^^ | = help: to create the module `vertex`, create file "rig-core/src/providers/vertex.rs" or "rig-core/src/providers/vertex/mod.rs" = note: if there is a `mod vertex` elsewhere in the crate already, import it with `use crate::...` instead

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / clippy

file not found for module `vertex`

error[E0583]: file not found for module `vertex` --> rig-core/src/providers/mod.rs:65:1 | 65 | pub mod vertex; | ^^^^^^^^^^^^^^^ | = help: to create the module `vertex`, create file "rig-core/src/providers/vertex.rs" or "rig-core/src/providers/vertex/mod.rs" = note: if there is a `mod vertex` elsewhere in the crate already, import it with `use crate::...` instead

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / clippy

file not found for module `vertex`

error[E0583]: file not found for module `vertex` --> rig-core/src/providers/mod.rs:65:1 | 65 | pub mod vertex; | ^^^^^^^^^^^^^^^ | = help: to create the module `vertex`, create file "rig-core/src/providers/vertex.rs" or "rig-core/src/providers/vertex/mod.rs" = note: if there is a `mod vertex` elsewhere in the crate already, import it with `use crate::...` instead

Check failure on line 65 in rig-core/src/providers/mod.rs

View workflow job for this annotation

GitHub Actions / stable / doc

file not found for module `vertex`
pub mod voyageai;
pub mod xai;
22 changes: 22 additions & 0 deletions rig-vertex/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "rig-vertex"
version = "0.1.0"
edition = { workspace = true }
license = "MIT"
readme = "README.md"
description = "Google Vertex model provider Rig integration."
repository = "https://github.com/0xPlaygrounds/rig"

[dependencies]
rig-core = { path = "../rig-core", version = "0.21.0" }
reqwest = { workspace = true, features = ["json"] }
serde = { workspace = true, features = ["derive"] }
serde_json = { workspace = true }
tracing = { workspace = true }
schemars = { workspace = true }
async-stream = { workspace = true }

[dev-dependencies]
anyhow = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tracing-subscriber = { workspace = true }
Loading
Loading