Skip to content

Commit

Permalink
Merge pull request #73 from 0xPlaygrounds/misc/cleanup-small-improvem…
Browse files Browse the repository at this point in the history
…ents

Small cleanup/changes before 0.3.0
  • Loading branch information
cvauclair authored Oct 24, 2024
2 parents 0d0083b + a0bee83 commit fb6bc54
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rig-core/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ pub struct CompletionRequest {
}

impl CompletionRequest {
pub fn prompt_with_context(&self) -> String {
pub(crate) fn prompt_with_context(&self) -> String {
if !self.documents.is_empty() {
format!(
"<attachments>\n{}</attachments>\n\n{}",
Expand Down
2 changes: 1 addition & 1 deletion rig-core/src/embeddings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub trait EmbeddingModel: Clone + Sync + Send {
/// Embed multiple documents in a single request
fn embed_documents(
&self,
documents: Vec<String>,
documents: impl IntoIterator<Item = String> + Send,
) -> impl std::future::Future<Output = Result<Vec<Embedding>, EmbeddingError>> + Send;
}

Expand Down
6 changes: 4 additions & 2 deletions rig-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@
//! Rig natively supports the following completion and embedding model providers:
//! - OpenAI
//! - Cohere
//! - Anthropic
//! - Perplexity
//!
//! Rig currently has the following integration companion crates:
//! - `rig-mongodb`: Vector store implementation for MongoDB
//!
//! - `rig-lancedb`: Vector store implementation for LanceDB
pub mod agent;
pub mod cli_chatbot;
pub mod completion;
pub mod embeddings;
pub mod extractor;
pub mod json_utils;
pub(crate) mod json_utils;
pub mod providers;
pub mod tool;
pub mod vector_store;
4 changes: 3 additions & 1 deletion rig-core/src/providers/cohere.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,10 @@ impl embeddings::EmbeddingModel for EmbeddingModel {

async fn embed_documents(
&self,
documents: Vec<String>,
documents: impl IntoIterator<Item = String>,
) -> Result<Vec<embeddings::Embedding>, EmbeddingError> {
let documents = documents.into_iter().collect::<Vec<_>>();

let response = self
.client
.post("/v1/embed")
Expand Down
4 changes: 3 additions & 1 deletion rig-core/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ impl embeddings::EmbeddingModel for EmbeddingModel {

async fn embed_documents(
&self,
documents: Vec<String>,
documents: impl IntoIterator<Item = String>,
) -> Result<Vec<embeddings::Embedding>, EmbeddingError> {
let documents = documents.into_iter().collect::<Vec<_>>();

let response = self
.client
.post("/v1/embeddings")
Expand Down

0 comments on commit fb6bc54

Please sign in to comment.