API ReferenceRetrievals

Semantic‐vector retrieval

Given a natural‐language `query`, retrieves up to `top_chunk` chunks whose embeddings best match. Optionally filters by arbitrary metadata conditions, applies a minimum score threshold, and can rerank using a hypothetical answer embedding.

POST
/api/retrievals

Authorization

AuthorizationRequiredBearer <token>

Bearer token authentication required

In: header

Request Body

application/jsonRequired
queryRequiredstring

The user’s natural‐language query (min length 2)

Minimum length: 2
top_chunkinteger

Number of chunks to return

Default: 5Minimum: 1
filterobject

Logical combination of conditions. At least one of must, should, or must_not must be non‐empty.

rerankboolean

If true, rerank top candidates by hypothetical‐answer similarity

Default: false
min_score_thresholdnumber

Discard chunks with score below this

Minimum: 0
curl -X POST "https://app.dcup.dev/api/retrievals" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "What is the capital of France?",
    "top_chunk": 5,
    "filter": {
      "must": [
        {
          "key": "string",
          "match": {
            "value": "string"
          }
        }
      ],
      "should": [
        {
          "key": "string",
          "match": {
            "value": "string"
          }
        }
      ],
      "must_not": [
        {
          "key": "string",
          "match": {
            "value": "string"
          }
        }
      ]
    },
    "rerank": false,
    "min_score_threshold": 0
  }'

Retrieved and (optionally) reranked chunks

{
  "scored_chunks": [
    {
      "id": "string",
      "document_name": "string",
      "page_number": 0,
      "chunk_number": 0,
      "source": "string",
      "title": "string",
      "summary": "string",
      "content": "string",
      "type": "string",
      "metadata": {},
      "score": 0
    }
  ]
}