Documentation/API Reference/Embeddings

Embeddings API

API endpoint for generating and managing vector embeddings.

What are Embeddings?

Embeddings are numerical representations of text that capture semantic meaning. They allow the chatbot to find relevant content based on meaning, not just keyword matching.

Example:

The text "What are your business hours?" becomes:

[0.023, -0.041, 0.089, -0.012, ... 1532 more numbers]
POST
/api/admin/generate-embeddings

Generates embeddings for documents that don't have them yet. Useful after importing content or if embeddings failed during crawling.

Request

Request Body
JSON payload with client identifier
FieldTypeRequiredDescription
clientId
string
Required
UUID of the client

Example

cURL Request
curl -X POST https://sensei-ai-eight.vercel.app/api/admin/generate-embeddings \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "d454991a-eddb-4e81-959d-87c868e050ca"
  }'

Response

200
Success
{
  "success": true,
  "processed": 45,
  "skipped": 123,
  "message": "Generated embeddings for 45 documents"
}

processed: Number of documents that received new embeddings

skipped: Number of documents that already had embeddings

Technical Details

Embedding Model
Model
text-embedding-3-small
Dimensions
1536
Max Input
8191 tokens
Cost
$0.00002/1K tokens
Provider
OpenAI
Storage
pgvector

When to Use

  • After manually importing documents to the database
  • If crawling completed but embeddings failed
  • To regenerate embeddings after OpenAI model updates
  • When troubleshooting poor search results