From 3688b78e2f162d598381c53254164de73be4dac3 Mon Sep 17 00:00:00 2001 From: Garance Date: Fri, 18 Oct 2024 15:22:54 -0400 Subject: [PATCH] fix: add feature flag to examples in mongodb and lancedb crates --- Cargo.toml | 3 +-- rig-lancedb/Cargo.toml | 18 +++++++++++++++++- .../examples/fixtures/{lib.rs => main.rs} | 2 +- .../examples/vector_search_local_ann.rs | 2 +- .../examples/vector_search_local_enn.rs | 2 +- rig-lancedb/examples/vector_search_s3_ann.rs | 2 +- rig-mongodb/Cargo.toml | 6 +++++- 7 files changed, 27 insertions(+), 8 deletions(-) rename rig-lancedb/examples/fixtures/{lib.rs => main.rs} (98%) diff --git a/Cargo.toml b/Cargo.toml index faafb5f4..82134804 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,5 +3,4 @@ resolver = "2" members = [ "rig-core", "rig-core/rig-core-derive", "rig-mongodb", - "rig-lancedb" -] + "rig-lancedb"] diff --git a/rig-lancedb/Cargo.toml b/rig-lancedb/Cargo.toml index 91877f1c..1020e36e 100644 --- a/rig-lancedb/Cargo.toml +++ b/rig-lancedb/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" [dependencies] lancedb = "0.10.0" -rig-core = { path = "../rig-core", version = "0.2.1", features = ["derive"] } +rig-core = { path = "../rig-core", version = "0.2.1" } arrow-array = "52.2.0" serde_json = "1.0.128" serde = "1.0.210" @@ -14,3 +14,19 @@ futures = "0.3.30" [dev-dependencies] tokio = "1.40.0" anyhow = "1.0.89" + +[[example]] +name = "fixtures" +required-features = ["rig-core/derive"] + +[[example]] +name = "vector_search_local_ann" +required-features = ["rig-core/derive"] + +[[example]] +name = "vector_search_local_enn" +required-features = ["rig-core/derive"] + +[[example]] +name = "vector_search_s3_ann" +required-features = ["rig-core/derive"] diff --git a/rig-lancedb/examples/fixtures/lib.rs b/rig-lancedb/examples/fixtures/main.rs similarity index 98% rename from rig-lancedb/examples/fixtures/lib.rs rename to rig-lancedb/examples/fixtures/main.rs index 780b42ca..d6e02a5a 100644 --- a/rig-lancedb/examples/fixtures/lib.rs +++ b/rig-lancedb/examples/fixtures/main.rs @@ -2,7 +2,7 @@ use std::sync::Arc; use arrow_array::{types::Float64Type, ArrayRef, FixedSizeListArray, RecordBatch, StringArray}; use lancedb::arrow::arrow_schema::{DataType, Field, Fields, Schema}; -use rig::embeddings::embedding::Embedding; +use rig::embeddings::Embedding; use rig::{Embeddable, OneOrMany}; use serde::Deserialize; diff --git a/rig-lancedb/examples/vector_search_local_ann.rs b/rig-lancedb/examples/vector_search_local_ann.rs index 1b7870fb..5518f0cb 100644 --- a/rig-lancedb/examples/vector_search_local_ann.rs +++ b/rig-lancedb/examples/vector_search_local_ann.rs @@ -10,7 +10,7 @@ use rig::{ }; use rig_lancedb::{LanceDbVectorStore, SearchParams}; -#[path = "./fixtures/lib.rs"] +#[path = "./fixtures/main.rs"] mod fixture; #[tokio::main] diff --git a/rig-lancedb/examples/vector_search_local_enn.rs b/rig-lancedb/examples/vector_search_local_enn.rs index 630acc1a..7d0bec9c 100644 --- a/rig-lancedb/examples/vector_search_local_enn.rs +++ b/rig-lancedb/examples/vector_search_local_enn.rs @@ -9,7 +9,7 @@ use rig::{ }; use rig_lancedb::{LanceDbVectorStore, SearchParams}; -#[path = "./fixtures/lib.rs"] +#[path = "./fixtures/main.rs"] mod fixture; #[tokio::main] diff --git a/rig-lancedb/examples/vector_search_s3_ann.rs b/rig-lancedb/examples/vector_search_s3_ann.rs index 8c10409b..b6bdcb3e 100644 --- a/rig-lancedb/examples/vector_search_s3_ann.rs +++ b/rig-lancedb/examples/vector_search_s3_ann.rs @@ -10,7 +10,7 @@ use rig::{ }; use rig_lancedb::{LanceDbVectorStore, SearchParams}; -#[path = "./fixtures/lib.rs"] +#[path = "./fixtures/main.rs"] mod fixture; // Note: see docs to deploy LanceDB on other cloud providers such as google and azure. diff --git a/rig-mongodb/Cargo.toml b/rig-mongodb/Cargo.toml index 8673bda8..66fef77a 100644 --- a/rig-mongodb/Cargo.toml +++ b/rig-mongodb/Cargo.toml @@ -12,7 +12,7 @@ repository = "https://github.com/0xPlaygrounds/rig" [dependencies] futures = "0.3.30" mongodb = "2.8.2" -rig-core = { path = "../rig-core", version = "0.2.1", features = ["derive"] } +rig-core = { path = "../rig-core", version = "0.2.1" } serde = { version = "1.0.203", features = ["derive"] } serde_json = "1.0.117" @@ -21,3 +21,7 @@ tracing = "0.1.40" [dev-dependencies] anyhow = "1.0.86" tokio = { version = "1.38.0", features = ["macros"] } + +[[example]] +name = "vector_search_mongodb" +required-features = ["rig-core/derive"] \ No newline at end of file