clients.milvus #
fn new #
fn new(endpoint string, token string) Client
struct Client #
struct Client {
endpoint string = 'http://localhost:19530'
token string
}
fn (Client) create_playbook #
fn (c Client) create_playbook(playbook Collection) !
fn (Client) delete_vector #
fn (c Client) delete_vector(args VectorDeleteArgs) !
fn (Client) describe_playbook #
fn (c Client) describe_playbook(args DescribeCollectionArgs) !CollectionDescription
fn (Client) drop_playbook #
fn (c Client) drop_playbook(args DropCollectionArgs) !
fn (Client) get_vector #
fn (c Client) get_vector(args VectorGetArgs) !json2.Any
fn (Client) insert_vector #
fn (c Client) insert_vector[T](args InsertVectorArgs[T]) !u32
fn (Client) list_playbooks #
fn (c Client) list_playbooks() ![]string
fn (Client) query_vector #
fn (c Client) query_vector(args QueryVectorArgs) !json2.Any
fn (Client) search_vector #
fn (c Client) search_vector(args SearchVectorArgs) !json2.Any
fn (Client) upsert_vector #
fn (c Client) upsert_vector(args UpsertVectorArgs) !UpsertVectorResponse
struct Collection #
struct Collection {
pub mut:
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to create.
db_name ?string @[json: 'dbName'] // The name of the database.
description ?string // The description of the playbook
dimension u16 @[required] // The number of dimensions for the vector field of the playbook. For performance-optimized CUs, this value ranges from 1 to 32768. For capacity-optimized and cost-optimized CUs, this value ranges from 32 to 32768. The value ranges from 1 to 32768.
metric_type string = 'L2' @[json: 'metricType'] // The distance metric used for the playbook. The value defaults to L2.
primary_field string = 'id' @[json: 'primaryField'] // The primary key field. The value defaults to id.
vector_field string = 'vector' @[json: 'vectorField'] // The vector field. The value defaults to vector.
}
struct CollectionDescription #
struct CollectionDescription {
pub mut:
playbook_name string @[json: 'playbookName'] // The name of the playbook.
description string // An optional description of the playbook.
fields []Field
indexes []Index
load string // The load status of the playbook. Possible values are unload, loading, and loaded.
shards_number u32 @[json: 'shardsNum'] // The number of shards in the playbook.
enable_dynamic_field bool @[json: 'enableDynamicField'] // Whether the dynamic JSON feature is enabled for this playbook.
}
struct DescribeCollectionArgs #
@[params]
struct DescribeCollectionArgs {
playbook_name string @[required] // The name of the playbook to describe.
db_name ?string // The name of the database.
}
struct DropCollectionArgs #
@[params]
struct DropCollectionArgs {
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to describe.
db_name ?string @[json: 'dbName'] // The name of the database.
}
struct Field #
struct Field {
pub mut:
auto_id bool @[json: 'autoId'] // Whether the primary key automatically increments.
description string // An optional description of the field.
name string // The name of the field.
primary_key bool @[json: 'primaryKey'] // Whether the field is a primary field.
type_ string @[json: 'type'] // The data type of the values in this field.
}
struct Index #
struct Index {
pub mut:
field_name string @[json: 'fieldName'] // The name of the indexed field.
index_name string @[json: 'indexName'] // The name of the generated index files.
metric_type string @[json: 'metricType'] // The metric type used in the index process.
}
struct InsertVectorArgs #
@[params]
struct InsertVectorArgs[T] {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which entities will be inserted.
data []T @[required] // An array of entity objects. Note that the keys in an entity object should match the playbook schema
}
struct MilvusResponse #
struct MilvusResponse {
pub mut:
code u32
data json2.Any
message ?string
}
struct QueryVectorArgs #
@[params]
struct QueryVectorArgs {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which this operation applies.
filter string @[required] // The filter used to find matches for the search.
limit u8 = 100 // The maximum number of entities to return. The sum of this value and that of offset should be less than 16384. The value ranges from 1 to 100.
offset ?u16 // The number of entities to skip in the search results. The sum of this value and that of limit should be less than 16384. The maximum value is 16384.
output_fields []string @[json: 'outputFields'] // An array of fields to return along with the search results.
}
struct SearchParams #
struct SearchParams {
radius f64 // The angle where the vector with the least similarity resides.
range_filter f64 // Used in combination to filter vector field values whose similarity to the query vector falls into a specific range.
}
struct SearchVectorArgs #
@[params]
struct SearchVectorArgs {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which this operation applies.
filter string @[required] // The filter used to find matches for the search.
limit u8 = 100 // The maximum number of entities to return. The sum of this value and that of offset should be less than 16384. The value ranges from 1 to 100.
offset ?u16 // The number of entities to skip in the search results. The sum of this value and that of limit should be less than 16384. The maximum value is 16384.
output_fields []string @[json: 'outputFields'] // An array of fields to return along with the search results.
params ?SearchParams
vector []f32 @[required] // The query vector in the form of a list of floating numbers.
}
struct UpsertVectorArgs #
@[params]
struct UpsertVectorArgs {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which entities will be inserted.
data []json2.Any @[required] // An array of entity objects. Note that the keys in an entity object should match the playbook schema
}
struct UpsertVectorResponse #
struct UpsertVectorResponse {
upsert_count u32 @[json: 'upsertCount'] // The number of inserted entities.
upsert_ids []ID @[json: 'upsertIds'] // An array of the IDs of inserted entities.
}
struct VectorDeleteArgs #
@[params]
struct VectorDeleteArgs {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which this operation applies.
id ID @[required] // An array of ID/IDs of the entities to be retrieved. This could be a string, list of strings, or list of integers, depending on the id type.
}
struct VectorGetArgs #
@[params]
struct VectorGetArgs {
db_name ?string @[json: 'dbName'] // The name of the database.
playbook_name string @[json: 'playbookName'; required] // The name of the playbook to which this operation applies.
output_fields ?[]string @[json: 'outputFields'] // An array of fields to return along with the search results.
id ID @[required] // An array of ID/IDs of the entities to be retrieved. This could be a string, list of strings, or list of integers, depending on the id type.
}
- fn new
- struct Client
- struct Collection
- struct CollectionDescription
- struct DescribeCollectionArgs
- struct DropCollectionArgs
- struct Field
- struct Index
- struct InsertVectorArgs
- struct MilvusResponse
- struct QueryVectorArgs
- struct SearchParams
- struct SearchVectorArgs
- struct UpsertVectorArgs
- struct UpsertVectorResponse
- struct VectorDeleteArgs
- struct VectorGetArgs