Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tls plugin #23

Merged
merged 3 commits into from
Apr 29, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
- name: Install WasmEdge
run: |
VERSION=0.13.5
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- --plugins wasmedge_rustls --version=$VERSION -p /usr/local
curl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | sudo bash -s -- --version=$VERSION -p /usr/local
- name: MySQL async examples
run: |
Expand Down
1 change: 1 addition & 0 deletions qdrant/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[build]
target = "wasm32-wasi"
rustflags = ["--cfg", "wasmedge", "--cfg", "tokio_unstable"]

[target.wasm32-wasi]
runner = "wasmedge"
10 changes: 8 additions & 2 deletions qdrant/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ name = "qdrant_examples"
version = "0.1.0"
edition = "2021"

[patch.crates-io]
socket2 = { git = "https://github.com/second-state/socket2.git", branch = "v0.5.x" }
reqwest = { git = "https://github.com/second-state/wasi_reqwest.git", branch = "0.11.x" }
hyper = { git = "https://github.com/second-state/wasi_hyper.git", branch = "v0.14.x" }
tokio = { git = "https://github.com/second-state/wasi_tokio.git", branch = "v1.36.x" }

[dependencies]
anyhow = "1.0"
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
url = "2.3"
tokio_wasi = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }
qdrant_rest_client = "0.0.1"
tokio = { version = "1", features = ["io-util", "fs", "net", "time", "rt", "macros"] }
qdrant_rest_client = { version = "0.0.4", git="https://github.com/L-jasmine/qdrant-rest-client.git", branch = "bump/remove_rustls_plugin" }
58 changes: 39 additions & 19 deletions qdrant/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use serde_json::{json};
use qdrant::*;
use serde_json::json;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
Expand All @@ -9,47 +9,67 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
println!("Create collection result is {:?}", r);

let mut points = Vec::<Point>::new();
points.push(Point{
id: PointId::Num(1), vector: vec!(0.05, 0.61, 0.76, 0.74), payload: json!({"city": "Berlin"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(1),
vector: vec![0.05, 0.61, 0.76, 0.74],
payload: json!({"city": "Berlin"}).as_object().map(|m| m.to_owned()),
});
points.push(Point{
id: PointId::Num(2), vector: vec!(0.19, 0.81, 0.75, 0.11), payload: json!({"city": "London"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(2),
vector: vec![0.19, 0.81, 0.75, 0.11],
payload: json!({"city": "London"}).as_object().map(|m| m.to_owned()),
});
points.push(Point{
id: PointId::Num(3), vector: vec!(0.36, 0.55, 0.47, 0.94), payload: json!({"city": "Moscow"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(3),
vector: vec![0.36, 0.55, 0.47, 0.94],
payload: json!({"city": "Moscow"}).as_object().map(|m| m.to_owned()),
});
points.push(Point{
id: PointId::Num(4), vector: vec!(0.18, 0.01, 0.85, 0.80), payload: json!({"city": "New York"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(4),
vector: vec![0.18, 0.01, 0.85, 0.80],
payload: json!({"city": "New York"})
.as_object()
.map(|m| m.to_owned()),
});
points.push(Point{
id: PointId::Num(5), vector: vec!(0.24, 0.18, 0.22, 0.44), payload: json!({"city": "Beijing"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(5),
vector: vec![0.24, 0.18, 0.22, 0.44],
payload: json!({"city": "Beijing"}).as_object().map(|m| m.to_owned()),
});
points.push(Point{
id: PointId::Num(6), vector: vec!(0.35, 0.08, 0.11, 0.44), payload: json!({"city": "Mumbai"}).as_object().map(|m| m.to_owned())
points.push(Point {
id: PointId::Num(6),
vector: vec![0.35, 0.08, 0.11, 0.44],
payload: json!({"city": "Mumbai"}).as_object().map(|m| m.to_owned()),
});

let r = client.upsert_points("my_test", points).await;
println!("Upsert points result is {:?}", r);

println!("The collection size is {}", client.collection_info("my_test").await);
println!(
"The collection size is {}",
client.collection_info("my_test").await
);

let p = client.get_point("my_test", 2).await;
println!("The second point is {:?}", p);

let ps = client.get_points("my_test", vec!(1, 2, 3, 4, 5, 6)).await;
let ps = client.get_points("my_test", vec![1, 2, 3, 4, 5, 6]).await;
println!("The 1-6 points are {:?}", ps);

let q = vec![0.2, 0.1, 0.9, 0.7];
let r = client.search_points("my_test", q, 2).await;
let r = client.search_points("my_test", q, 2, None).await;
println!("Search result points are {:?}", r);

let r = client.delete_points("my_test", vec!(1, 4)).await;
let r = client.delete_points("my_test", vec![1, 4]).await;
println!("Delete points result is {:?}", r);

println!("The collection size is {}", client.collection_info("my_test").await);
println!(
"The collection size is {}",
client.collection_info("my_test").await
);

let q = vec![0.2, 0.1, 0.9, 0.7];
let r = client.search_points("my_test", q, 2).await;
let r = client.search_points("my_test", q, 2, None).await;
println!("Search result points are {:?}", r);
Ok(())
}
Loading