feat: Remove unnecessary delete_collection call in example

- Removed the `delete_collection` call from the Qdrant example
  to avoid unnecessary collection deletion. This simplifies the
  example and prevents potential issues if the collection doesn't
  exist.
- Updated `RetrievePointsParams` struct to use optional parameters
  for `shard_key`, `with_payload`, and `with_vectors`. This
  improves flexibility and reduces the required parameters.  The
  change simplifies the request structure.
This commit is contained in:
Mahmoud Emad
2025-03-16 11:56:55 +02:00
parent 025e8fba69
commit c3fe788a5b
2 changed files with 8 additions and 22 deletions

View File

@@ -29,11 +29,11 @@ get_collection := qdrant_client.get_collection(
println('Get Collection: ${get_collection}')
// 4. Delete the created collection
deleted_collection := qdrant_client.delete_collection(
collection_name: collection_name
)!
// deleted_collection := qdrant_client.delete_collection(
// collection_name: collection_name
// )!
println('Deleted Collection: ${deleted_collection}')
// println('Deleted Collection: ${deleted_collection}')
// 5. List all collections
list_collection := qdrant_client.list_collections()!

View File

@@ -3,24 +3,15 @@ module qdrant
import freeflowuniverse.herolib.core.httpconnection
import json
// Retrieves all details from multiple points.
pub struct RetrievePointsRequest {
pub mut:
ids []int @[json: 'ids'; required] // Look for points with ids
shard_key string // Specify in which shards to look for the points, if not specified - look in all shards
with_payload bool // Select which payload to return with the response. Default is true.
with_vectors bool // Options for specifying which vectors to include into response. Default is false.
}
// Retrieves all details from multiple points.
@[params]
pub struct RetrievePointsParams {
pub mut:
ids []int @[json: 'ids'; required] // Look for points with ids
collection_name string @[json: 'collection_name'; required] // Name of the collection
shard_key string // Specify in which shards to look for the points, if not specified - look in all shards
with_payload bool // Select which payload to return with the response. Default is true.
with_vectors bool // Options for specifying which vectors to include into response. Default is false.
shard_key ?string // Specify in which shards to look for the points, if not specified - look in all shards
with_payload ?bool // Select which payload to return with the response. Default is true.
with_vectors ?bool // Options for specifying which vectors to include into response. Default is false.
}
pub struct RetrievePointsResponse {
@@ -38,12 +29,7 @@ pub fn (mut self QDrantClient) retrieve_points(params RetrievePointsParams) !QDr
req := httpconnection.Request{
method: .post
prefix: '/collections/${params.collection_name}/points'
data: json.encode(RetrievePointsRequest{
ids: params.ids
shard_key: params.shard_key
with_payload: params.with_payload
with_vectors: params.with_vectors
})
data: json.encode(params)
}
mut response := http_conn.send(req)!