Class RemoteLangChainRetriever

Specific implementation of the RemoteRetriever class designed to retrieve documents from a remote source using a JSON-based API. It implements the RemoteLangChainRetrieverParams interface which defines the keys used to interact with the JSON API.

Hierarchy

Implements

Constructors

Properties

asyncCaller: AsyncCaller

The authentication method to use, currently implemented is

  • false: no authentication
  • { bearer: string }: Bearer token authentication
headers: Record<string, string>
inputKey: string

The key in the JSON body to put the query in

metadataKey: string

The key in the JSON response to get the metadata from

pageContentKey: string

The key in the JSON response to get the page content from

responseKey: string

The key in the JSON response to get the response from

url: string

The URL of the remote retriever server

Methods

  • Creates the JSON body of the request sent to the API. The inputKey is set to the query.

    Parameters

    • query: string

      Query string to be sent to the API.

    Returns RemoteRetrieverValues

    An object with the inputKey set to the query.

  • Processes the JSON response from the API. It returns an array of Document objects, each created with the page content and metadata extracted from the response using the pageContentKey and metadataKey, respectively.

    Parameters

    Returns Document<Record<string, any>>[]

    An array of Document objects.

Generated using TypeDoc