A minimal and unofficial implementation of Milvus VectorDB client for Julia. This library wraps their REST API in Julia functions.
Note: This library should be considered WIP pre-alpha.
using Milvus
using Random
dbname = "default"
collectionName = "myCollection"
host = MilvusClient("http://localhost:19530", dbname=dbname)
# List collections
r = list_collections(host)
println("Avialable collections: $r")
# Define a collection (dbname, collectionName, vectorLength)
collection = create_collection( host, collectionName, 768)
# Describe collection
describe_collection(host, collectionName)
# generate a record with random values and "vector"
function recordGen()
rec = Dict(
"title" => randstring(10),
"content" => randstring(60),
"vector" => rand(768)
)
end
# Generate 100 records
n = 100
data = [recordGen() for i in 1:n]
# insert records 16 at a time. Returns list of ID's of the created objects
r = insert( host, collection, data, batch_size=16)