Skip to main content

Intelligence

The Intelligence API provides Retrieval-Augmented Generation (RAG) capabilities — query your datasets with natural language and receive AI-generated answers grounded in your data. Supports both streaming (SSE) and non-streaming responses, plus persistent chat sessions. All endpoints live under the unprefixed /intelligence namespace.

Unprefixed paths

Use the unprefixed /intelligence/... paths. The legacy /v1/intelligence/... prefix is deprecated, and /api/v1/... is not routed (404).


RAG Query

POST /intelligence/query

Request Body

NameTypeRequiredDescription
querystringNatural language question
dataset_idUUID | "all" | nullDataset to search. Use "all" to search across all datasets, or null for default behavior
top_kintegerNumber of chunks to retrieve (1–50, default 5)
conversation_historyarrayPrior conversation turns for context
streambooleanEnable SSE streaming (default true)
include_sourcesbooleanInclude source citations (default true)

Conversation History Item:

NameTypeDescription
rolestringuser or assistant
contentstringMessage content
curl -X POST https://api.vectoramp.com/intelligence/query \
-H "X-API-Key: <api_key>" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the key features of our product?",
"dataset_id": "550e8400-e29b-41d4-a716-446655440000",
"top_k": 5,
"stream": true,
"conversation_history": [
{"role": "user", "content": "Tell me about the product"},
{"role": "assistant", "content": "Our product is a vector database..."}
]
}'

Non-Streaming Response

{
"answer": "The key features include real-time vector search, hybrid search combining dense and sparse vectors...",
"sources": [
{
"name": "product-overview.pdf",
"path": "gdrive://1abc2def3ghi",
"url": null,
"source_type": "gdrive",
"dataset_id": "550e8400-e29b-41d4-a716-446655440000",
"dataset_document_id": "doc_01HZY...",
"content_type": "application/pdf",
"relevance": 0.95,
"pages": [3, 4],
"sheet_names": [],
"chunk_count": 2,
"preview": "Our platform supports real-time vector search...",
"preview_ref": "prev_eyJhbGciOi...",
"chunks": [
{
"chunk_id": "chunk-001",
"score": 0.95,
"text": "Our platform supports real-time vector search...",
"chunk_index": null,
"sheet_name": null,
"row_start": null,
"row_end": null,
"column_names": null
}
],
"timestamp_start": null,
"timestamp_end": null,
"file_id": "1abc2def3ghi",
"thumbnail_url": null
}
],
"chunks": [
{
"id": "chunk-001",
"text": "Our platform supports real-time vector search...",
"score": 0.95,
"source": "product-overview.pdf",
"source_url": null,
"page": 3,
"metadata": {
"source": "gdrive://1abc2def3ghi",
"content_type": "application/pdf"
}
}
],
"message": null,
"metadata": {}
}
Public metadata

Chunk metadata returned by /intelligence/query is sanitized. Internal storage fields such as document_storage_key, document_storage_bucket, and payload_ref are never returned.

Citations and previews

Inline numeric citations in answer use 1-based source ordering: [1] refers to sources[0], [2] to sources[1], and so on. preview_ref is an opaque signed reference for authenticated preview/download flows; do not treat it as a storage key or construct object URLs from it.

Streaming Response (SSE)

When stream: true, the response is sent as Server-Sent Events. Each event contains a JSON chunk:

data: {"chunk_type": "text", "content": "The key ", "metadata": {}}
data: {"chunk_type": "text", "content": "features include ", "metadata": {}}
data: {"chunk_type": "citation", "content": "", "metadata": {"source": "product-overview.pdf"}}
data: {"chunk_type": "done", "content": "", "metadata": {}}

Chunk Types:

TypeDescription
textText content of the answer
imageImage reference
audioAudio reference
videoVideo reference
codeCode block content
citationSource citation
errorError message
metadataAdditional metadata
visualizationData visualization
doneStream complete

Persistent Sessions

Persistent Intelligence sessions let clients store workspace-scoped chat state and replay message history around /intelligence/query.

Create a session

POST /intelligence/sessions

NameTypeRequiredDescription
titlestringHuman-readable session title
workspace_idstringOptional workspace identifier
dataset_idUUIDOptional default dataset scope
metadataobjectClient metadata
curl -X POST https://api.vectoramp.com/intelligence/sessions \
-H "X-API-Key: <api_key>" \
-H "Content-Type: application/json" \
-d '{"title":"Q4 planning","dataset_id":"550e8400-e29b-41d4-a716-446655440000"}'

List sessions

GET /intelligence/sessions?limit=50

Returns:

{ "sessions": [{ "id": "sess_01HZ...", "title": "Q4 planning" }] }

Get a session

GET /intelligence/sessions/{id}

Returns an IntelligenceSession.

Delete a session

DELETE /intelligence/sessions/{id}

Permanently deletes the session and its messages. Returns 204 No Content.

curl -X DELETE https://api.vectoramp.com/intelligence/sessions/sess_01HZ... \
-H "X-API-Key: vsk_<64hex>"

Append a message

POST /intelligence/sessions/{id}/messages

NameTypeRequiredDescription
roleuser | assistant | system | toolMessage role
contentstringMessage content
metadataobjectClient metadata
{ "role": "user", "content": "Summarize the latest planning docs" }

List messages

GET /intelligence/sessions/{id}/messages?limit=100

Returns:

{ "messages": [{ "id": "msg_01HZ...", "role": "user", "content": "Summarize the latest planning docs" }] }