Skip to content

RestApi Retriever

RestApi Retriever sends a question to the document search service your company already runs, through its web address, and returns the passages it finds. This lets you use your own search service inside a flow without loading the documents into NappAI.

A retriever receives a question and returns the document pieces that best answer it, so an agent or model can reply with your information.

When to use it

  • Your company already has a search service over its documents and you want to use it from a flow.
  • You want to combine your own search service with other NappAI retrievers in an Ensemble Retriever.

Configuration

FieldWhat it does
URLThe web address of your search service. It comes with a sample address that you have to replace with your service’s.
Search QueryThe question or words to search for, for the Search Results output.
Number of ResultsHow many passages are requested from the search service. Default: 10.

It does not use a credential and does not send access keys, so the service has to accept requests without authentication from NappAI.

What your search service must do

The component sends the request with the POST method and a JSON body with two fields: text, the question, and topK, the number of results requested. The service must reply with a JSON list where each item has:

  • content: the text of the passage.
  • score: the relevance score.
  • documentId: the document’s identifier.

If the service replies with an error or a different format, the component fails.

Output

  • Retriever: the search engine, to connect to components that ask for one, such as Retrieval QA or Retriever Tool.
  • Search Results: the passages found for Search Query, each with its score and its document’s identifier. You can pass them to a prompt or an agent.

Example

Seguros Atalaya has an internal search service over its policy terms:

  1. Type the service’s address in URL, for example https://search.atalaya.example/api/search/query.
  2. Connect the Retriever output to Retriever on a Retrieval QA.
  3. Connect the customer’s question and a model to the Retrieval QA.

When a customer asks “does my policy cover water damage?”, Atalaya’s search service returns the passages of the terms and the model answers from them.

Good practices

  • Check with Search Results that your service returns useful passages before connecting it to an agent.
  • Adjust Number of Results: too few passages can leave information out; too many give the model a lot of text it does not need.