langchain.js
    Preparing search index...

    Class responsible for retrieving data from Vespa. It extends the RemoteRetriever class and includes methods for creating the JSON body for a query and processing the JSON response from Vespa.

    const retriever = new VespaRetriever({
    url: "https:
    auth: false,
    query_body: {
    yql: "select content from paragraph where userQuery()",
    hits: 5,
    ranking: "documentation",
    locale: "en-us",
    },
    content_field: "content",
    });
    const result = await retriever.getRelevantDocuments("what is vespa?");

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    asyncCaller: AsyncCaller

    The authentication method to use, currently implemented is

    • false: no authentication
    • { bearer: string }: Bearer token authentication
    content_field: string
    headers: Record<string, string>
    lc_namespace: string[] = ...
    query_body: object
    url: string

    The URL of the remote retriever server

    Accessors

    • get lc_secrets(): undefined | { [key: string]: string }

      Returns undefined | { [key: string]: string }

    Methods

    • Parameters

      • query: string

      Returns Promise<DocumentInterface[]>

    • Method that takes a query string as input and returns a JSON object that includes the query and the original query_body.

      Parameters

      • query: string

        The query string to be sent to Vespa.

      Returns RemoteRetrieverValues

      A JSON object that includes the query and the original query_body.

    • Method that processes the JSON response from Vespa into an array of Document instances. Each Document instance includes the content from the specified content_field and the document's ID.

      Parameters

      Returns DocumentInterface[]

      An array of Document instances.

    • Returns string