Loading...
Loading...
Generate vector embeddings for text and search your document knowledge base using semantic similarity.
/api/embeddings{
"texts": [
"What is the company refund policy?",
"How do I contact support?"
]
}{
"embeddings": [
[0.023, -0.041, 0.087, ...], // 768-dimensional vector
[0.015, -0.033, 0.092, ...] // 768-dimensional vector
],
"model": "text-embedding-004",
"dimensions": 768
}/api/embeddings/search{
"query": "What is the refund policy?",
"topK": 5,
"minScore": 0.7,
"documentIds": ["doc_abc123"] // optional, filters by specific documents
}{
"results": [
{
"chunkId": "chunk_001",
"documentId": "doc_abc123",
"documentName": "terms-of-service.pdf",
"content": "Refunds are available within 30 days of purchase...",
"score": 0.94,
"metadata": {
"page": 4,
"chunkIndex": 12
}
}
],
"query": "What is the refund policy?"
}The embedding pipeline uses the configured provider (default: Google Gemini) to convert text into high-dimensional vectors. These vectors are stored in PostgreSQL with the pgvector extension, enabling fast cosine similarity search using HNSW indexes.
The database schema uses vector(768). If you change the embedding provider (e.g. to OpenAI which produces 1536D vectors), you must also update the schema dimension. The app validates this at startup and warns about mismatches.