Retrieval

Retrieval related APIs

Alli Retrieval API

post

The Retrieval API allows you to obtain the top N page information related to a question from documents uploaded to Alli. This API combines keyword search and semantic search capabilities to provide the most relevant document pages for your queries.

Authorizations
Header parameters
AGENT-EMAILstringOptional

Optional: Email of the agent to use for this request

USER-EMAILstringOptional

Optional: Email address to associate with the user

OWN-USER-IDstringOptional

Optional: User ID to identify or create a user

Body
questionstringOptional

Question to search for in the document base

maxDocumentCluesintegerOptional

Determines how many related pages to retrieve. The default value is 3.

bm25_score_weightnumber · floatOptional

This is the weight for keyword search. The higher this value, the more the keyword score is reflected. Values between 0-9 are appropriate, with a value of 0 meaning keyword search is not used. The default value is 9.

text_vector_score_weightnumber · floatOptional

This is the weight for semantic search on document content. The higher this value, the more it is reflected. Values between 0-9 are appropriate, with a value of 0 meaning semantic search on document content is not used. The default value is 1.

title_vector_score_weightnumber · floatOptional

This is the weight for semantic search on document titles. Similarly, values between 0-9 are appropriate, with a value of 0 meaning semantic search on document titles is not used. The default value is 0.

hashtagsstring[]Optional

Filter results to include only documents with these hashtags

hashtags_operatorstring · enumOptional

Logical operator for hashtags (default is "or")

Possible values:
exclude_hashtagsstring[]Optional

Filter results to exclude documents with these hashtags

exclude_hashtags_operatorstring · enumOptional

Logical operator for exclude_hashtags (default is "or")

Possible values:
targetFoldersstring[]Optional

Names of folders to search within

folderIdsstring[]Optional

IDs of folders to search within

knowledgeBaseIdsstring[]Optional

IDs of specific knowledge bases to search within

use_keywordsbooleanOptional

Whether to extract and use keywords for search

use_clue_feedbackbooleanOptional

Whether to use feedback data to improve search results

Responses
200

Successfully retrieved results

application/json
post
POST /webapi/retrieval HTTP/1.1
Host: backend.alli.ai
API-KEY: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 348

{
  "question": "text",
  "maxDocumentClues": 1,
  "bm25_score_weight": 1,
  "text_vector_score_weight": 1,
  "title_vector_score_weight": 1,
  "hashtags": [
    "text"
  ],
  "hashtags_operator": "and",
  "exclude_hashtags": [
    "text"
  ],
  "exclude_hashtags_operator": "and",
  "targetFolders": [
    "text"
  ],
  "folderIds": [
    "text"
  ],
  "knowledgeBaseIds": [
    "text"
  ],
  "use_keywords": true,
  "use_clue_feedback": true
}
{
  "result": [
    {
      "ranking": 1,
      "title": "text",
      "text": "text",
      "pageNo": 1,
      "kb_id": "text"
    }
  ]
}

Was this helpful?