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:
@@ -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()!
|
||||
|
||||
@@ -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)!
|
||||
|
||||
Reference in New Issue
Block a user