mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-09 21:08:31 +02:00
Regenerate snippet .md files
Run `./generate-md.py` to update generated markdown files after semi-manual changes made in the previous commit. This commit serves as a gist of fixed issues found in snippets. (it's easier to review 250 lines diff rather than 31k lines diff, isn't it?)
This commit is contained in:
+9
-7
@@ -7,6 +7,7 @@ import io.qdrant.client.grpc.Collections.SparseVectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
import io.qdrant.client.grpc.Collections.VectorParamsMap;
|
||||
import io.qdrant.client.grpc.Collections.VectorsConfig;
|
||||
import java.util.Map;
|
||||
|
||||
client
|
||||
.createCollectionAsync(
|
||||
@@ -23,13 +24,14 @@ client
|
||||
.setSize(384)
|
||||
.setDistance(Distance.Cosine)
|
||||
.build())))
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap(
|
||||
"bm25_sparse_vector",
|
||||
SparseVectorParams.newBuilder()
|
||||
.setModifier(Modifier.Idf)
|
||||
.build())))
|
||||
.build())
|
||||
.setSparseVectorsConfig(
|
||||
SparseVectorConfig.newBuilder()
|
||||
.putMap(
|
||||
"bm25_sparse_vector",
|
||||
SparseVectorParams.newBuilder()
|
||||
.setModifier(Modifier.Idf)
|
||||
.build()))
|
||||
.build())
|
||||
.get();
|
||||
```
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
```csharp
|
||||
var queryText = "What is relapsing polychondritis?"
|
||||
var queryText = "What is relapsing polychondritis?";
|
||||
```
|
||||
|
||||
+1
-5
@@ -1,9 +1,5 @@
|
||||
```go
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
import "github.com/qdrant/go-client/qdrant"
|
||||
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "xyz-example.cloud-region.cloud-provider.cloud.qdrant.io",
|
||||
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
```python
|
||||
from qdrant_client import QdrantClient
|
||||
|
||||
qdrant_client = QdrantClient(
|
||||
client = QdrantClient(
|
||||
"xyz-example.cloud-region.cloud-provider.cloud.qdrant.io",
|
||||
api_key="<paste-your-api-key-here>",
|
||||
cloud_inference=True,
|
||||
timeout=30.0
|
||||
timeout=30,
|
||||
)
|
||||
```
|
||||
|
||||
-2
@@ -1,7 +1,5 @@
|
||||
```rust
|
||||
use qdrant_client::Qdrant;
|
||||
use qdrant_client::qdrant::{Document};
|
||||
use qdrant_client::qdrant::{PointStruct, UpsertPointsBuilder};
|
||||
|
||||
let client = Qdrant::from_url("https://xyz-example.qdrant.io:6334")
|
||||
.api_key("<paste-your-api-key-here>")
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ prefetch := []*qdrant.PrefetchQuery{
|
||||
},
|
||||
}
|
||||
|
||||
client.Query(ctx, &qdrant.QueryPoints{
|
||||
client.Query(context.Background(), &qdrant.QueryPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Prefetch: prefetch,
|
||||
Query: qdrant.NewQueryFusion(qdrant.Fusion_RRF),
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ results = client.query_points(
|
||||
collection_name="{collection_name}",
|
||||
prefetch=[
|
||||
models.Prefetch(
|
||||
query=Document(
|
||||
query=models.Document(
|
||||
text=query_text,
|
||||
model=dense_model
|
||||
),
|
||||
@@ -11,7 +11,7 @@ results = client.query_points(
|
||||
limit=5
|
||||
),
|
||||
models.Prefetch(
|
||||
query=Document(
|
||||
query=models.Document(
|
||||
text=query_text,
|
||||
model=bm25_model
|
||||
),
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ let bm25_prefetch = PrefetchQueryBuilder::default()
|
||||
.using("bm25_sparse_vector")
|
||||
.build();
|
||||
|
||||
let query_request = QueryPointsBuilder::new(collection_name)
|
||||
let query_request = QueryPointsBuilder::new("{collection_name}")
|
||||
.add_prefetch(dense_prefetch)
|
||||
.add_prefetch(bm25_prefetch)
|
||||
.query(Query::new_fusion(Fusion::Rrf))
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
```typescript
|
||||
const results = await client.query(collectionName, {
|
||||
const results = await client.query("{collection_name}", {
|
||||
prefetch: [
|
||||
{
|
||||
query: {
|
||||
|
||||
+2
-2
@@ -23,8 +23,8 @@ for _, item := range dataset {
|
||||
}
|
||||
points = append(points, point)
|
||||
}
|
||||
_, err = client.Upsert(ctx, &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name},
|
||||
_, err = client.Upsert(context.Background(), &qdrant.UpsertPoints{
|
||||
CollectionName: "{collection_name}",
|
||||
Points: points,
|
||||
})
|
||||
```
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
```java
|
||||
import static io.qdrant.client.PointIdFactory.id;
|
||||
import static io.qdrant.client.VectorFactory.vector;
|
||||
import static io.qdrant.client.VectorsFactory.namedVectors;
|
||||
import static io.qdrant.client.VectorsFactory.vectors;
|
||||
|
||||
import io.qdrant.client.grpc.Points.Document;
|
||||
import io.qdrant.client.grpc.Points.PointStruct;
|
||||
@@ -26,10 +26,10 @@ for (Map<String, String> item : dataset) {
|
||||
namedVectors(
|
||||
Map.of(
|
||||
"dense_vector",
|
||||
vectors(
|
||||
vector(
|
||||
Document.newBuilder().setText(passage).setModel(denseModel).build()),
|
||||
"bm25_sparse_vector",
|
||||
vectors(
|
||||
vector(
|
||||
Document.newBuilder().setText(passage).setModel(bm25Model).build()))))
|
||||
.build();
|
||||
points.add(point);
|
||||
|
||||
+2
-1
@@ -3,6 +3,7 @@ use qdrant_client::qdrant::{
|
||||
Document, NamedVectors, PointStruct, UpsertPointsBuilder,
|
||||
};
|
||||
use qdrant_client::Payload;
|
||||
use uuid::Uuid;
|
||||
|
||||
let dense_model = "sentence-transformers/all-minilm-l6-v2";
|
||||
let bm25_model = "qdrant/bm25";
|
||||
@@ -29,6 +30,6 @@ let points: Vec<PointStruct> = dataset
|
||||
.collect();
|
||||
|
||||
client
|
||||
.upsert_points(UpsertPointsBuilder::new(collection_name, points))
|
||||
.upsert_points(UpsertPointsBuilder::new("{collection_name}", points))
|
||||
.await?;
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user