LiyaEngine Docs

Retrieval profiles

/v1/retrieval-profiles — create, list, update and delete search profiles, and preview one against your content.

Dashboard

A retrieval profile is a saved set of search settings that collections search with. These endpoints do what Knowledge → Retrieval does in the dashboard.

Which keys can call them

Key scopeList and getCreate, update, deletePreview
fullYesYesYes
read and run_readYesNoNo (it is a POST)
runtimeNoNoNo

The profile

{
  "id": "cmx2k...",
  "name": "Policy answers",
  "description": "Strict matching for HR and legal documents",
  "config": {
    "search_mode": "hybrid",
    "top_k": 4,
    "min_similarity": 0.8,
    "semantic_weight": 0.45,
    "fusion_algorithm": "rrf",
    "rerank": true
  },
  "is_default": false,
  "collection_count": 2
}
config fieldValuesDefault
search_modehybrid, semantichybrid
top_k1 to 205
min_similarity0 to 1. In hybrid mode it filters meaning matches; a passage with the exact words is kept regardless.0.7
semantic_weight0 to 1. Hybrid only. The rest goes to exact keywords.0.7
fusion_algorithmrrf, weighted_average. Hybrid only.rrf
reranktrue, falsetrue

Endpoints

GET    /v1/retrieval-profiles
POST   /v1/retrieval-profiles
GET    /v1/retrieval-profiles/{id}
PATCH  /v1/retrieval-profiles/{id}
DELETE /v1/retrieval-profiles/{id}
POST   /v1/retrieval-profiles/preview

Create

curl -X POST https://api.liyaengine.ai/v1/retrieval-profiles \
  -H "Authorization: Bearer $LIYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "name": "Policy answers", "config": { "top_k": 4, "min_similarity": 0.8, "semantic_weight": 0.45 }, "is_default": false }'

Settings you leave out take the defaults. Names are unique within a workspace (409 PROFILE_NAME_TAKEN). Setting is_default: true clears the previous default. Only one profile can be the default.

Delete

DELETE returns { "id": "...", "collections_reset": 2 }. Those collections fall back to the workspace default profile, then the built-in settings.

Preview

Runs a query the way a profile would and explains each passage. Send profile_id for a saved profile, or config for unsaved settings (it wins over profile_id). Omit collection_ids to search every collection in the workspace.

curl -X POST https://api.liyaengine.ai/v1/retrieval-profiles/preview \
  -H "Authorization: Bearer $LIYA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "query": "What is the refund window?", "config": { "top_k": 3, "min_similarity": 0.6 } }'
{
  "applied": { "config": { "...": "..." }, "source": "draft", "profile": null },
  "results": [
    {
      "rank": 1,
      "content": "Refunds are issued within 30 days of purchase...",
      "similarity": 0.91,
      "meaning_score": 0.91,
      "keyword_score": 3.4,
      "rerank_score": 0.8,
      "found_by": ["meaning", "keywords"],
      "document": { "id": "...", "name": "Refund policy", "category": "policy" },
      "collections": [{ "slug": "handbook", "label": "Handbook" }]
    }
  ],
  "metrics": { "latency_ms": 120, "returned": 1, "top_similarity": 0.91, "lowest_similarity": 0.91, "documents_searched": 4, "collections_searched": 2, "reranked": true }
}

meaning_score is null when only the exact keywords found a passage. Preview changes nothing and does not count against your knowledge query quota.

Choosing a profile for a collection

PATCH /v1/collections/{id}     { "retrieval_profile_id": "cmx2k..." }   # or null to clear
POST  /v1/collections/query    { "query": "...", "profile_id": "cmx2k..." }

POST /v1/collections/query now also returns which settings ran:

{ "results": [], "total": 0, "retrieval": { "profile": { "id": "...", "name": "Policy answers" }, "source": "collection" } }

source is request, collection, workspace_default or built_in. A top_k sent on the request wins over the profile's.

On this page