Ecosystem
LLM Integrations
- Overview
- OpenAI
- Anthropic
- Google Gemini
- Google Vertex AI
- Azure
- Bedrock
- AWS SageMaker
- Ollama
- More
- Bring Your Own LLM
Cloud Platforms
Guardrails
Plugins
Agents
AI Apps
Libraries
Tracing Providers
Qdrant
Qdrant is an open-source vector similarity search engine built for production-ready vector search applications. It provides a convenient API to store, search, and manage vectors with additional payload data.
Portkey provides a proxy to Qdrant, allowing you to use virtual keys and observability features.
Portkey SDK Integration with Qdrant
Portkey provides a consistent API to interact with models from various providers. To integrate Qdrant with Portkey:
1. Install the Portkey SDK
Add the Portkey SDK to your application to interact with Qdrant through Portkey’s gateway.
Copy
Ask AI
npm install --save portkey-ai
Copy
Ask AI
npm install --save portkey-ai
Copy
Ask AI
pip install portkey-ai
2. Initialize Portkey with a Virtual Key
To use Qdrant with Portkey, get your API key from Qdrant App, then add it to Portkey to create your Qdrant virtual key.
You will also need your Portkey API Key from Portkey’s Dashboard.
Copy
Ask AI
import Portkey from 'portkey-ai'
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
virtualKey: "VIRTUAL_KEY" // Your Qdrant Virtual Key
})
Copy
Ask AI
import Portkey from 'portkey-ai'
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
virtualKey: "VIRTUAL_KEY" // Your Qdrant Virtual Key
})
Copy
Ask AI
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="VIRTUAL_KEY" # Replace with your virtual key for Qdrant
)
Copy
Ask AI
from openai import OpenAI
from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
client = OpenAI(
api_key="QDRANT_API_KEY",
base_url=PORTKEY_GATEWAY_URL,
default_headers=createHeaders(
api_key="PORTKEY_API_KEY",
provider="qdrant",
custom_host="QDRANT_HOST" # Replace with your Qdrant host
)
)
Copy
Ask AI
import OpenAI from "openai";
import { PORTKEY_GATEWAY_URL, createHeaders } from "portkey-ai";
const client = new OpenAI({
apiKey: "QDRANT_API_KEY",
baseURL: PORTKEY_GATEWAY_URL,
defaultHeaders: createHeaders({
provider: "qdrant",
apiKey: "PORTKEY_API_KEY",
customHost: "QDRANT_HOST" // Replace with your Qdrant host
}),
});
3. Use the Portkey SDK to interact with Qdrant
Copy
Ask AI
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="QDRANT_VIRTUAL_KEY",
custom_host="QDRANT_HOST" # Replace with your Qdrant host
)
response = portkey.post(
url="https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io", # Qdrant search endpoint, you can use any Qdrant endpoint
)
print(response)
Copy
Ask AI
from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY", # Replace with your Portkey API key
virtual_key="QDRANT_VIRTUAL_KEY",
custom_host="QDRANT_HOST" # Replace with your Qdrant host
)
response = portkey.post(
url="https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io", # Qdrant search endpoint, you can use any Qdrant endpoint
)
print(response)
Copy
Ask AI
import Portkey from 'portkey-ai';
const portkey = new Portkey({
apiKey: "PORTKEY_API_KEY", // Replace with your Portkey API key
virtualKey: "QDRANT_VIRTUAL_KEY", // Add your Qdrant's virtual key
customHost: "QDRANT_HOST" // Replace with your Qdrant host
});
async function makeRequest() {
const response = await portkey.post(
"https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io",
{ /* Your request body here */ }
);
console.log(response);
}
makeRequest();
Copy
Ask AI
import OpenAI from 'openai';
import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'
const portkey = new OpenAI({
apiKey: 'QDRANT_API_KEY',
baseURL: PORTKEY_GATEWAY_URL,
defaultHeaders: createHeaders({
virtualKey: "QDRANT_VIRTUAL_KEY",
apiKey: "PORTKEY_API_KEY",
customHost: "QDRANT_HOST" // Replace with your Qdrant host
})
});
async function makeRequest() {
const response = await portkey.post(
"https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io",
{ /* Your request body here */ }
);
console.log(response);
}
makeRequest();
Copy
Ask AI
from openai import OpenAI
from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
openai = OpenAI(
api_key='QDRANT_API_KEY',
base_url=PORTKEY_GATEWAY_URL,
default_headers=createHeaders(
provider="qdrant",
api_key="PORTKEY_API_KEY",
custom_host="QDRANT_HOST" # Replace with your Qdrant host
)
)
response = openai.post(
url="https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io", # Qdrant search endpoint, You can use any Qdrant endpoint
)
print(response)
Copy
Ask AI
curl --location --request POST 'https://xxxx-xxx-xxx-xx-xxxxxx.us-west-2-0.aws.cloud.qdrant.io' \
--header 'x-portkey-custom-host: QDRANT_HOST' \
--header 'x-portkey-virtual-key: QDRANT_VIRTUAL_KEY' \
--header 'x-portkey-api-key: PORTKEY_API_KEY'
Was this page helpful?
Assistant
Responses are generated using AI and may contain mistakes.