Hide boilerplate in snippets.

This commit is contained in:
István Zoltán Szabó
2026-07-21 14:04:28 +02:00
parent 3fecc10c89
commit 4bc89cd833
44 changed files with 46 additions and 64 deletions
@@ -5,7 +5,9 @@ public class Snippet
{
public static async Task Run()
{
// @hide-start
var client = new QdrantClient("localhost", 6334);
// @hide-end
await client.CreateCollectionAsync(
collectionName: "{collection_name}",
@@ -2,8 +2,6 @@
using Qdrant.Client;
using Qdrant.Client.Grpc;
var client = new QdrantClient("localhost", 6334);
await client.CreateCollectionAsync(
collectionName: "{collection_name}",
// ... other collection parameters
@@ -5,11 +5,6 @@ import (
"github.com/qdrant/go-client/qdrant"
)
client, err := qdrant.NewClient(&qdrant.Config{
Host: "localhost",
Port: 6334,
})
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
CollectionName: "{collection_name}",
// ... other collection parameters
@@ -6,9 +6,6 @@ import io.qdrant.client.QdrantGrpcClient;
import io.qdrant.client.grpc.Collections.CreateCollection;
import io.qdrant.client.grpc.Collections.ShardingMethod;
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
client
.createCollectionAsync(
CreateCollection.newBuilder()
@@ -1,8 +1,6 @@
```python
from qdrant_client import QdrantClient, models
client = QdrantClient(url="http://localhost:6333")
client.create_collection(
collection_name="{collection_name}",
shard_number=1,
@@ -4,8 +4,6 @@ use qdrant_client::qdrant::{
};
use qdrant_client::Qdrant;
let client = Qdrant::from_url("http://localhost:6334").build()?;
client
.create_collection(
CreateCollectionBuilder::new("{collection_name}")
@@ -1,8 +1,6 @@
```typescript
import { QdrantClient } from "@qdrant/js-client-rest";
const client = new QdrantClient({ host: "localhost", port: 6333 });
client.createCollection("{collection_name}", {
shard_number: 1,
sharding_method: "custom",
@@ -7,12 +7,14 @@ import (
)
func Main() {
// @hide-start
client, err := qdrant.NewClient(&qdrant.Config{
Host: "localhost",
Port: 6334,
})
if err != nil { panic(err) } // @hide
if err != nil { panic(err) }
// @hide-end
client.CreateCollection(context.Background(), &qdrant.CreateCollection{
CollectionName: "{collection_name}",
@@ -9,8 +9,10 @@ import io.qdrant.client.grpc.Collections.ShardingMethod;
public class Snippet {
public static void run() throws Exception {
// @hide-start
QdrantClient client =
new QdrantClient(QdrantGrpcClient.newBuilder("localhost", 6334, false).build());
// @hide-end
client
.createCollectionAsync(
@@ -1,6 +1,8 @@
from qdrant_client import QdrantClient, models
# @hide-start
client = QdrantClient(url="http://localhost:6333")
# @hide-end
client.create_collection(
collection_name="{collection_name}",
@@ -4,7 +4,9 @@ use qdrant_client::qdrant::{
use qdrant_client::Qdrant;
pub async fn main() -> anyhow::Result<()> {
// @hide-start
let client = Qdrant::from_url("http://localhost:6334").build()?;
// @hide-end
client
.create_collection(
@@ -1,6 +1,8 @@
import { QdrantClient } from "@qdrant/js-client-rest";
// @hide-start
const client = new QdrantClient({ host: "localhost", port: 6333 });
// @hide-end
client.createCollection("{collection_name}", {
shard_number: 1,