mirror of
https://github.com/qdrant/landing_page.git
synced 2026-10-10 21:38:30 +02:00
Automated snippet conversion by scripts
These changes are purely mechanical to differentiate them from manual fixes/adjustments made in the next commit. This results in broken code as some snippets contain errors. Made in four steps: 1. Run ./migrate-snippet.py that converts `.md` files to code files and perhaps adds missing lines under `// @hide` comments. 2. Sort Java imports. 3. Remove old `.md` files. 4. Run ./generate.md to produce `*/generated/*.md` files.
This commit is contained in:
+21
@@ -0,0 +1,21 @@
|
||||
using Qdrant.Client;
|
||||
using Qdrant.Client.Grpc;
|
||||
|
||||
public class Snippet
|
||||
{
|
||||
public static async Task Run()
|
||||
{
|
||||
var client = new QdrantClient("localhost", 6334);
|
||||
|
||||
await client.CreateCollectionAsync(
|
||||
collectionName: "{collection_name}",
|
||||
vectorsConfig: new VectorParams {
|
||||
Size = 128,
|
||||
Distance = Distance.Cosine,
|
||||
MultivectorConfig = new() {
|
||||
Comparator = MultiVectorComparator.MaxSim
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
-1
@@ -1,5 +1,4 @@
|
||||
```python
|
||||
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package snippet
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/qdrant/go-client/qdrant"
|
||||
)
|
||||
|
||||
func Main() {
|
||||
client, err := qdrant.NewClient(&qdrant.Config{
|
||||
Host: "localhost",
|
||||
Port: 6334,
|
||||
})
|
||||
|
||||
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
|
||||
CollectionName: "{collection_name}",
|
||||
VectorsConfig: qdrant.NewVectorsConfig(&qdrant.VectorParams{
|
||||
Size: 128,
|
||||
Distance: qdrant.Distance_Cosine,
|
||||
MultivectorConfig: &qdrant.MultiVectorConfig{
|
||||
Comparator: qdrant.MultiVectorComparator_MaxSim,
|
||||
},
|
||||
}),
|
||||
})
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package com.example.snippets_amalgamation;
|
||||
|
||||
import io.qdrant.client.QdrantClient;
|
||||
import io.qdrant.client.QdrantGrpcClient;
|
||||
import io.qdrant.client.grpc.Collections.Distance;
|
||||
import io.qdrant.client.grpc.Collections.MultiVectorComparator;
|
||||
import io.qdrant.client.grpc.Collections.MultiVectorConfig;
|
||||
import io.qdrant.client.grpc.Collections.VectorParams;
|
||||
|
||||
public class Snippet {
|
||||
public static void run() throws Exception {
|
||||
QdrantClient client =
|
||||
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
|
||||
|
||||
client.createCollectionAsync("{collection_name}",
|
||||
VectorParams.newBuilder().setSize(128)
|
||||
.setDistance(Distance.Cosine)
|
||||
.setMultivectorConfig(MultiVectorConfig.newBuilder()
|
||||
.setComparator(MultiVectorComparator.MaxSim)
|
||||
.build())
|
||||
.build()).get();
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
|
||||
from qdrant_client import QdrantClient, models
|
||||
|
||||
client = QdrantClient(url="http://localhost:6333")
|
||||
|
||||
client.create_collection(
|
||||
collection_name="{collection_name}",
|
||||
vectors_config=models.VectorParams(
|
||||
size=128,
|
||||
distance=models.Distance.COSINE,
|
||||
multivector_config=models.MultiVectorConfig(
|
||||
comparator=models.MultiVectorComparator.MAX_SIM
|
||||
),
|
||||
),
|
||||
)
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
use qdrant_client::qdrant::{
|
||||
CreateCollectionBuilder, Distance, VectorParamsBuilder,
|
||||
MultiVectorComparator, MultiVectorConfigBuilder,
|
||||
};
|
||||
use qdrant_client::Qdrant;
|
||||
|
||||
pub async fn main() -> anyhow::Result<()> {
|
||||
let client = Qdrant::from_url("http://localhost:6334").build()?;
|
||||
|
||||
client
|
||||
.create_collection(
|
||||
CreateCollectionBuilder::new("{collection_name}")
|
||||
.vectors_config(
|
||||
VectorParamsBuilder::new(100, Distance::Cosine)
|
||||
.multivector_config(
|
||||
MultiVectorConfigBuilder::new(MultiVectorComparator::MaxSim)
|
||||
),
|
||||
),
|
||||
)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
import { QdrantClient } from "@qdrant/js-client-rest";
|
||||
|
||||
const client = new QdrantClient({ host: "localhost", port: 6333 });
|
||||
|
||||
client.createCollection("{collection_name}", {
|
||||
vectors: {
|
||||
size: 128,
|
||||
distance: "Cosine",
|
||||
multivector_config: {
|
||||
comparator: "max_sim"
|
||||
}
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user