UnieAI Studio

Advanced Search and Agent Retrieval

Use the current Hybrid Search API, Remote MCP tool, and iterative knowledge-base retrieval available to Customize Model agents.

UnieAI Studio uses Hybrid Search for direct knowledge-base queries. Customize Model agents build on the same retrieval engine by choosing focused queries, searching again when necessary, and combining evidence from their linked knowledge bases.

The current product does not expose auto, hyde, multi_query, rerank, or combined search modes. The Studio Search page, REST API, and Remote MCP tool support hybrid only.

Choose the correct search path

PathScopeWho controls the queryMain parameters
Knowledge base Search pageOne knowledge baseUserLimit, Min score
POST /v1/kb/searchOne authorized knowledge baseCalling applicationkb_id, query, limit, min_score, document_id
Remote MCP kb_searchOne authorized knowledge base per callMCP client or agentkb_id, query, limit, min_score, document_id
Customize Model agentAll knowledge bases linked to the modelBase model through tool callsFocused query and result limit; model RAG settings provide the retrieval threshold

The first three paths return chunks. They do not generate a final answer. A Customize Model agent can retrieve evidence and then use its base model to compose an answer.

Every direct query runs Dense vector retrieval and BM25 lexical retrieval. Runtime merges both candidate sets, calculates a Hybrid relevance score, applies min_score, sorts the chunks, and returns up to limit results.

Use a natural-language question when meaning matters. Keep exact identifiers, clause numbers, product names, and error codes in the query so BM25 can preserve those signals.

REST API

Send the request to the Runtime Base URL, not the Studio website URL:

curl -X POST "$UNIEAI_RUNTIME_BASE_URL/v1/kb/search" \
  -H "Authorization: Bearer $UNIEAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "kb_id": "kb_abc123",
    "query": "What are the overtime pay rules?",
    "mode": "hybrid",
    "limit": 8,
    "min_score": 0.18
  }'
FieldRequiredCurrent behavior
kb_idYesKnowledge base ID; access is checked for the API-key owner
queryYesNon-empty search text
modeNoDefaults to hybrid; any other value is rejected
limitNoDefaults to 8 and is clamped to 1–50
min_scoreNoDefaults to 0.18 and is clamped to 0–1
document_idNoRestricts results to one document in the knowledge base

The response reports mode: "hybrid", warnings, and result chunks with content, score, document and page identifiers, and available metadata. It does not contain detected_mode.

Remote MCP

The knowledge-base Remote MCP endpoint is:

POST {RUNTIME_BASE_URL}/v1/mcp/kb-search

Authenticate with a platform API key in the Bearer header. The server supports the standard initialize, tools/list, and tools/call JSON-RPC methods and exposes kb_search.

{
  "mcpServers": {
    "unieai-kb": {
      "url": "https://runtime.example.com/v1/mcp/kb-search",
      "headers": {
        "Authorization": "Bearer sk-your-api-key"
      }
    }
  }
}

The MCP tool performs Hybrid Search only. Its result limit defaults to 5 and is capped at 20; each returned chunk's text is capped for tool-context safety.

Customize Model agent retrieval

When a Customize Model has linked knowledge bases and its selected Agent Core exposes knowledge-base tools, the base model can call kb_search during a conversation.

The current agent flow can:

  1. Decide whether the uploaded documents are relevant to the question.
  2. Search all knowledge bases linked to the Customize Model with a focused query.
  3. Merge, sort, and deduplicate chunks across those knowledge bases.
  4. Refine the wording or use more specific terms and search again when the first result is insufficient.
  5. Use available source-follow-up tools when a promising result needs more surrounding document context.
  6. Compose an answer from the accumulated evidence.

This is agent-controlled iterative retrieval, not a request mode named auto. The model decides whether another tool call is useful; the server does not classify the query into HyDE or Multi-Query modes.

Agent tool schemas and source-follow-up behavior can differ by Agent Core version. Do not send mode, hyde, or reranking arguments to kb_search; use the tool schema advertised by the active core.

Result limits and thresholds

  • The knowledge-base Search page and REST API use the limit and min_score supplied with that request.
  • Remote MCP defaults to 5 chunks and caps the limit at 20.
  • A Customize Model uses the knowledge bases, Top K, and Min score saved in its Behavior → Agent Loop settings.
  • Search-page parameters do not update Customize Model settings.

When multiple knowledge bases are linked, the final Top K is applied after candidates compete across the linked knowledge bases; it is not a separate quota for every knowledge base.

Failure and fallback behavior

SituationCurrent behavior
Unsupported mode in RESTReturns a 400 error
API key cannot access the knowledge baseReturns an authorization or not-found error without leaking its content
One linked knowledge-base search failsOther linked searches can still return results, with a warning recorded
Retrieval returns no chunks and fallback is allowedCustomize Model retrieval can use page-level content marked as fallback_pages
Agent's first query is too broadThe agent can issue another, narrower kb_search call
No relevant evidence is foundThe agent should not claim that the knowledge base supports the answer

Page fallback is a resilience path, not another search mode, and fallback scores must not be interpreted as Milvus Hybrid scores.

Practical tuning

  • First verify that document parsing and indexing completed.
  • Test a distinctive term known to exist in the source document.
  • Lower Min score gradually when expected chunks are missing.
  • Raise Min score or lower Limit when weak chunks overwhelm the useful context.
  • Preserve exact identifiers in otherwise natural-language queries.
  • For agent retrieval, make the Customize Model's System Prompt require citations or explicit uncertainty when evidence is missing.
  • Review request logs and RAG metadata to confirm which query and sources actually produced the answer.