Milvus is an open-source vector database built for GenAI applications. It is built to be performant and scale to tens of billions of vectors with minimal performance loss.

Portkey provides a proxy to Milvus, allowing you to use virtual keys and observability features.

Portkey SDK Integration with Milvus

Portkey provides a consistent API to interact with models from various providers. To integrate Milvus with Portkey:

1. Install the Portkey SDK

Add the Portkey SDK to your application to interact with Milvus through Portkey’s gateway.

npm install --save portkey-ai

2. Initialize Portkey with a Virtual Key

To use Milvus with Portkey, get your Milvus API key from here, then add it to Portkey to create your Milvus virtual key.

import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
    virtualKey: "VIRTUAL_KEY" // Your Milvus Virtual Key
})

3. Use the Portkey SDK to interact with Milvus

from portkey_ai import Portkey

portkey = Portkey(
    api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
    virtual_key="MILVUS_VIRTUAL_KEY",
    custom_host="MILVUS_HOST" # Replace with your Milvus host example: https://in03-34d7b37f7ee12c7.serverless.gcp-us-west1.cloud.zilliz.com
)

response = portkey.post(
    url="v2/vectordb/collections/list", # Replace with the endpoint you want to call
)

print(response)