Skip to content

Commit

Permalink
Make type signatures more consistent (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
anchpop authored Dec 26, 2024
1 parent c0b35e6 commit 25b1062
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ victor.clear_db().await.unwrap();
victor
.add_many(
vec!["Pineapple", "Rocks"], // documents
vec!["PizzaToppings"], // tags (only used for filtering)
vec!["Pizza Toppings"], // tags (only used for filtering)
)
.await;

victor.add("Cheese pizza", vec![]).await; // Add another entry with no tags
victor.add("Cheese pizza", vec!["Pizza Flavors"]).await; // Add another entry with no tags

// read the 10 closest results from victor that are tagged with "tags"
// read the 10 closest results from victor that are tagged with "Pizza Toppings"
// (only 2 will be returned because we only inserted two embeddings)
let nearest = victor
.search("Hawaiian pizza", vec!["PizzaToppings"], 10)
.search("Hawaiian pizza", vec!["Pizza Toppings"], 10)
.await
.first()
.unwrap()
Expand Down
8 changes: 4 additions & 4 deletions examples/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ async fn main() {
victor
.add_many(
vec!["Pineapple", "Rocks"], // documents
vec!["PizzaToppings"], // tags (only used for filtering)
vec!["Pizza Toppings"], // tags (only used for filtering)
)
.await;

victor.add("Cheese pizza", vec![]).await; // Add another entry with no tags
victor.add("Cheese pizza", vec!["Pizza Flavors"]).await; // Add another entry with no tags

// read the 10 closest results from victor that are tagged with "tags"
// read the 10 closest results from victor that are tagged with "Pizza Toppings"
// (only 2 will be returned because we only inserted two embeddings)
let nearest = victor
.search("Hawaiian pizza", vec!["PizzaToppings"], 10)
.search("Hawaiian pizza", vec!["Pizza Toppings"], 10)
.await
.first()
.unwrap()
Expand Down
8 changes: 4 additions & 4 deletions examples/native_filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ async fn main() {
victor
.add_many(
vec!["Pineapple", "Rocks"], // documents
vec!["PizzaToppings"], // tags (only used for filtering)
vec!["Pizza Toppings"], // tags (only used for filtering)
)
.await;

victor.add("Cheese pizza", vec![]).await; // Add another entry with no tags
victor.add("Cheese pizza", vec!["Pizza Flavors"]).await; // Add another entry with no tags

// read the 10 closest results from victor that are tagged with "tags"
// read the 10 closest results from victor that are tagged with "Pizza Toppings"
// (only 2 will be returned because we only inserted two embeddings)
let nearest = victor
.search("Hawaiian pizza", vec!["PizzaToppings"], 10)
.search("Hawaiian pizza", vec!["Pizza Toppings"], 10)
.await
.first()
.unwrap()
Expand Down
2 changes: 1 addition & 1 deletion src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<D: DirectoryHandle> Victor<D> {
/// Embedding will be generated for the document.
/// When adding many documents, it is more efficient to use `add_many`.
#[cfg(not(target_arch = "wasm32"))]
pub async fn add(&mut self, content: impl Into<String>, tags: Vec<String>) {
pub async fn add(&mut self, content: impl Into<String>, tags: Vec<impl Into<String>>) {
self.add_many(vec![content], tags).await;
}

Expand Down

0 comments on commit 25b1062

Please sign in to comment.