docs: Rust client usage update (#497)

* docs: explore updates rust-client

* docs: rust client usage fixes
This commit is contained in:
Anush
2024-01-04 17:17:24 +05:30
committed by GitHub
parent dc402ac2f2
commit 6b824222bb
4 changed files with 125 additions and 3 deletions
@@ -327,6 +327,26 @@ client.recommend("{collection_name}", {
});
```
```rust
use qdrant_client::qdrant::{LookupLocation, RecommendPoints};
client
.recommend(&RecommendPoints {
collection_name: "{collection_name}".to_string(),
positive: vec![100.into(), 231.into()],
negative: vec![718.into()],
using: Some("image".to_string()),
limit: 10,
lookup_from: Some(LookupLocation {
collection_name: "{external_collection_name}".to_string(),
vector_name: Some("{external_vector_name}".to_string()),
..Default::default()
}),
..Default::default()
})
.await?;
```
```java
import java.util.List;
@@ -660,6 +680,49 @@ client.discover("{collection_name}", {
});
```
```rust
use qdrant_client::{
client::QdrantClient,
qdrant::{
target_vector::Target, vector_example::Example, ContextExamplePair, DiscoverPoints,
TargetVector, VectorExample,
},
};
let client = QdrantClient::from_url("http://localhost:6334").build()?;
client
.discover(&DiscoverPoints {
collection_name: "{collection_name}".to_string(),
target: Some(TargetVector {
target: Some(Target::Single(VectorExample {
example: Some(Example::Vector(vec![0.2, 0.1, 0.9, 0.7].into())),
})),
}),
context: vec![
ContextExamplePair {
positive: Some(VectorExample {
example: Some(Example::Id(100.into())),
}),
negative: Some(VectorExample {
example: Some(Example::Id(718.into())),
}),
},
ContextExamplePair {
positive: Some(VectorExample {
example: Some(Example::Id(200.into())),
}),
negative: Some(VectorExample {
example: Some(Example::Id(300.into())),
}),
},
],
limit: 10,
..Default::default()
})
.await?;
```
```java
import java.util.List;
@@ -789,6 +852,41 @@ client.discover("{collection_name}", {
});
```
```rust
use qdrant_client::{
client::QdrantClient,
qdrant::{vector_example::Example, ContextExamplePair, DiscoverPoints, VectorExample},
};
let client = QdrantClient::from_url("http://localhost:6334").build()?;
client
.discover(&DiscoverPoints {
collection_name: "{collection_name}".to_string(),
context: vec![
ContextExamplePair {
positive: Some(VectorExample {
example: Some(Example::Id(100.into())),
}),
negative: Some(VectorExample {
example: Some(Example::Id(718.into())),
}),
},
ContextExamplePair {
positive: Some(VectorExample {
example: Some(Example::Id(200.into())),
}),
negative: Some(VectorExample {
example: Some(Example::Id(300.into())),
}),
},
],
limit: 10,
..Default::default()
})
.await?;
```
```java
import java.util.List;