Skip to content
Merged
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: 4 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
resolver = "2"
resolver = "3"
members = [
"rig-core",
"rig-lancedb",
Expand All @@ -15,6 +15,9 @@ members = [
"rig-bedrock", "rig-milvus",
]

[workspace.package]
edition = "2024"

[workspace.dependencies]
anyhow = "1.0.94"
arrow-array = "55.1"
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rig-bedrock"
version = "0.2.0"
edition = "2021"
edition = { workspace = true }
license = "MIT"
readme = "README.md"
description = "AWS Bedrock model provider for Rig integration."
Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/examples/document_with_bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use reqwest::Client;

use rig::{
completion::{message::Document, Prompt},
completion::{Prompt, message::Document},
message::{ContentFormat, DocumentMediaType},
};

use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::client::CompletionClient;
use rig_bedrock::{client::ClientBuilder, completion::AMAZON_NOVA_LITE};
use tracing::info;
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/examples/embedding_with_bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rig::client::EmbeddingsClient;
use rig::Embed;
use rig::client::EmbeddingsClient;
use rig_bedrock::{client::ClientBuilder, embedding::AMAZON_TITAN_EMBED_TEXT_V2_0};
use tracing::info;

Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/examples/image_with_bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use reqwest::Client;

use rig::{
completion::{message::Image, Prompt},
completion::{Prompt, message::Image},
message::{ContentFormat, ImageMediaType},
};

use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::client::CompletionClient;
use rig_bedrock::{client::ClientBuilder, completion::AMAZON_NOVA_LITE};
use tracing::info;
Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/examples/rag_with_bedrock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ use std::vec;

use rig::client::{CompletionClient, EmbeddingsClient};
use rig::{
completion::Prompt, embeddings::EmbeddingsBuilder,
vector_store::in_memory_store::InMemoryVectorStore, Embed,
Embed, completion::Prompt, embeddings::EmbeddingsBuilder,
vector_store::in_memory_store::InMemoryVectorStore,
};
use rig_bedrock::{
client::ClientBuilder, completion::AMAZON_NOVA_LITE, embedding::AMAZON_TITAN_EMBED_TEXT_V2_0,
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/examples/streaming_with_bedrock.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rig::client::CompletionClient;
use rig::streaming::{stream_to_stdout, StreamingPrompt};
use rig::streaming::{StreamingPrompt, stream_to_stdout};
use rig_bedrock::{client::ClientBuilder, completion::AMAZON_NOVA_LITE};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/examples/streaming_with_bedrock_and_tools.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use rig::client::CompletionClient;
use rig::streaming::{stream_to_stdout, StreamingPrompt};
use rig::streaming::{StreamingPrompt, stream_to_stdout};
use rig_bedrock::{client::ClientBuilder, completion::AMAZON_NOVA_LITE};
mod common;

Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/src/types/assistant_content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use aws_sdk_bedrockruntime::operation::converse::ConverseOutput;
use aws_sdk_bedrockruntime::types as aws_bedrock;

use rig::{
OneOrMany,
completion::CompletionError,
message::{AssistantContent, Text, ToolCall, ToolFunction},
OneOrMany,
};

use crate::types::message::RigMessage;
Expand Down Expand Up @@ -116,7 +116,7 @@ mod tests {

use super::AwsConverseOutput;
use aws_sdk_bedrockruntime::types as aws_bedrock;
use rig::{completion, message::AssistantContent, OneOrMany};
use rig::{OneOrMany, completion, message::AssistantContent};

#[test]
fn aws_converse_output_to_completion_response() {
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/src/types/completion_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use aws_sdk_bedrockruntime::types::{
InferenceConfiguration, SystemContentBlock, Tool, ToolConfiguration, ToolInputSchema,
ToolSpecification,
};
use rig::OneOrMany;
use rig::completion::{CompletionError, Message};
use rig::message::{ContentFormat, DocumentMediaType, UserContent};
use rig::OneOrMany;

pub struct AwsCompletionRequest(pub rig::completion::CompletionRequest);

Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/src/types/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rig::{
};

pub(crate) use crate::types::media_types::RigDocumentMediaType;
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use uuid::Uuid;

#[derive(Clone)]
Expand Down Expand Up @@ -76,7 +76,7 @@ impl TryFrom<aws_bedrock::DocumentBlock> for RigDocument {
#[cfg(test)]
mod tests {
use aws_sdk_bedrockruntime::types as aws_bedrock;
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::{
completion::CompletionError,
message::{ContentFormat, Document, DocumentMediaType},
Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/src/types/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rig::{
message::{ContentFormat, Image, ImageMediaType, MimeType},
};

use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};

#[derive(Clone)]
pub struct RigImage(pub Image);
Expand Down Expand Up @@ -80,7 +80,7 @@ impl TryFrom<aws_bedrock::ImageBlock> for RigImage {
#[cfg(test)]
mod tests {
use aws_sdk_bedrockruntime::types as aws_bedrock;
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::{
completion::CompletionError,
message::{ContentFormat, Image, ImageMediaType},
Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/src/types/message.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use aws_sdk_bedrockruntime::types as aws_bedrock;

use rig::{
OneOrMany,
completion::CompletionError,
message::{AssistantContent, Message, UserContent},
OneOrMany,
};

use super::{assistant_content::RigAssistantContent, user_content::RigUserContent};
Expand Down Expand Up @@ -90,8 +90,8 @@ mod tests {
use crate::types::message::RigMessage;
use aws_sdk_bedrockruntime::types as aws_bedrock;
use rig::{
message::{Message, UserContent},
OneOrMany,
message::{Message, UserContent},
};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/src/types/text_to_image.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use base64::prelude::BASE64_STANDARD;
use base64::Engine;
use base64::prelude::BASE64_STANDARD;
use rig::image_generation;
use rig::image_generation::ImageGenerationError;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion rig-bedrock/src/types/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl TryFrom<aws_bedrock::ToolResultContentBlock> for RigToolResultContent {
#[cfg(test)]
mod tests {
use aws_sdk_bedrockruntime::types as aws_bedrock;
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::{
completion::CompletionError,
message::{ContentFormat, Image, ImageMediaType, Text, ToolResultContent},
Expand Down
4 changes: 2 additions & 2 deletions rig-bedrock/src/types/user_content.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use aws_sdk_bedrockruntime::types as aws_bedrock;

use rig::{
OneOrMany,
completion::CompletionError,
message::{Text, ToolResult, ToolResultContent, UserContent},
OneOrMany,
};

use super::{document::RigDocument, image::RigImage, tool::RigToolResultContent};
Expand Down Expand Up @@ -96,9 +96,9 @@ mod tests {
use crate::types::user_content::RigUserContent;
use aws_sdk_bedrockruntime::types as aws_bedrock;
use rig::{
OneOrMany,
completion::CompletionError,
message::{ToolResultContent, UserContent},
OneOrMany,
};

#[test]
Expand Down
2 changes: 1 addition & 1 deletion rig-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "rig-core"
version = "0.13.0"
edition = "2021"
edition = { workspace = true }
license = "MIT"
readme = "README.md"
description = "An opinionated library for building LLM powered applications."
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/agent_parallelization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rig::providers::openai::client::Client;

use rig::{
parallel,
pipeline::{self, passthrough, Op},
pipeline::{self, Op, passthrough},
};

use schemars::JsonSchema;
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/agent_with_echochambers.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use reqwest::header::{HeaderMap, HeaderValue, CONTENT_TYPE};
use reqwest::header::{CONTENT_TYPE, HeaderMap, HeaderValue};
use rig::prelude::*;
use rig::{
cli_chatbot::cli_chatbot,
Expand Down
5 changes: 4 additions & 1 deletion rig-core/examples/agent_with_mira.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ async fn main() -> Result<(), anyhow::Error> {
println!("\nProceeding with chat completion...\n");
}
Err(e) => {
return Err(anyhow::anyhow!("Failed to connect to Mira API: {}. Please verify your API key and network connection.", e));
return Err(anyhow::anyhow!(
"Failed to connect to Mira API: {}. Please verify your API key and network connection.",
e
));
}
}

Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/anthropic_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rig::prelude::*;
use rig::{
providers::anthropic::{self, CLAUDE_3_5_SONNET},
streaming::{stream_to_stdout, StreamingPrompt},
streaming::{StreamingPrompt, stream_to_stdout},
};
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::env;
use rig::{
embeddings::EmbeddingsBuilder,
parallel,
pipeline::{self, agent_ops::lookup, passthrough, Op},
pipeline::{self, Op, agent_ops::lookup, passthrough},
providers::openai::{Client, TEXT_EMBEDDING_ADA_002},
vector_store::in_memory_store::InMemoryVectorStore,
};
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/cohere_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rig::prelude::*;
use rig::providers::cohere;
use rig::streaming::{stream_to_stdout, StreamingPrompt};
use rig::streaming::{StreamingPrompt, stream_to_stdout};

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/gemini_embeddings.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rig::Embed;
use rig::prelude::*;
use rig::providers::gemini;
use rig::Embed;

#[derive(Embed, Debug)]
struct Greetings {
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/gemini_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rig::prelude::*;
use rig::{
providers::gemini::{self, completion::GEMINI_1_5_FLASH},
streaming::{stream_to_stdout, StreamingPrompt},
streaming::{StreamingPrompt, stream_to_stdout},
};

#[tokio::main]
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/huggingface_streaming.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::env;

use rig::{
providers::huggingface::{self},
streaming::{stream_to_stdout, StreamingPrompt},
streaming::{StreamingPrompt, stream_to_stdout},
};

#[tokio::main]
Expand Down
4 changes: 2 additions & 2 deletions rig-core/examples/image.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use reqwest::Client;
use rig::prelude::*;
use rig::{
completion::{message::Image, Prompt},
completion::{Prompt, message::Image},
message::{ContentFormat, ImageMediaType},
providers::anthropic::{self, CLAUDE_3_5_SONNET},
};

use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};

const IMAGE_URL: &str =
"https://upload.wikimedia.org/wikipedia/commons/a/a7/Camponotus_flavomarginatus_ant.jpg";
Expand Down
4 changes: 2 additions & 2 deletions rig-core/examples/image_ollama.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use base64::{prelude::BASE64_STANDARD, Engine};
use base64::{Engine, prelude::BASE64_STANDARD};
use rig::prelude::*;
use rig::providers::ollama;
use rig::{
completion::{message::Image, Prompt},
completion::{Prompt, message::Image},
message::{ContentFormat, ImageMediaType},
};
use tokio::fs;
Expand Down
4 changes: 2 additions & 2 deletions rig-core/examples/mistral_embeddings.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use rig::Embed;
use rig::client::{EmbeddingsClient, ProviderClient};
use rig::embeddings::EmbeddingsBuilder;
use rig::providers::mistral;
use rig::vector_store::in_memory_store::InMemoryVectorStore;
use rig::vector_store::VectorStoreIndex;
use rig::Embed;
use rig::vector_store::in_memory_store::InMemoryVectorStore;
use serde::{Deserialize, Serialize};

#[derive(Embed, Debug, Serialize, Deserialize, Eq, PartialEq)]
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/multi_extract.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rig::prelude::*;
use rig::{
pipeline::{self, agent_ops, TryOp},
pipeline::{self, TryOp, agent_ops},
providers::openai,
try_parallel,
};
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/multi_turn_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use futures::{Stream, StreamExt};
use rig::{
OneOrMany,
agent::Agent,
client::{CompletionClient, ProviderClient},
completion::{self, CompletionError, CompletionModel, PromptError, ToolDefinition},
message::{AssistantContent, Message, Text, ToolResultContent, UserContent},
providers::anthropic,
streaming::StreamingCompletion,
tool::{Tool, ToolSetError},
OneOrMany,
};
use serde::{Deserialize, Serialize};
use serde_json::json;
Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/ollama_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rig::prelude::*;
use rig::providers::ollama;

use rig::streaming::{stream_to_stdout, StreamingPrompt};
use rig::streaming::{StreamingPrompt, stream_to_stdout};

#[tokio::main]

Expand Down
2 changes: 1 addition & 1 deletion rig-core/examples/openai_streaming.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rig::prelude::*;
use rig::providers::openai;
use rig::streaming::{stream_to_stdout, StreamingPrompt};
use rig::streaming::{StreamingPrompt, stream_to_stdout};

#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
Expand Down
6 changes: 3 additions & 3 deletions rig-core/examples/openai_streaming_with_tools.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use anyhow::Result;
use futures::{stream, StreamExt};
use futures::{StreamExt, stream};
use rig::OneOrMany;
use rig::agent::Agent;
use rig::completion::{CompletionError, CompletionModel};
use rig::message::{AssistantContent, UserContent};
use rig::prelude::*;
use rig::streaming::{stream_to_stdout, StreamingChat};
use rig::streaming::{StreamingChat, stream_to_stdout};
use rig::tool::ToolSetError;
use rig::OneOrMany;
use rig::{
completion::{Message, ToolDefinition},
providers,
Expand Down
Loading