Skip to main content
Version: 2.0

Simple Single Corpus Query

GET 

/v2/corpora/:corpus_key/query

Search a single corpus with a straightforward query request, specifying the corpus key and query parameters.

  • Specify the unique corpus_key identifying the corpus to query. The corpus_key is created in the Vectara Console UI or the Create Corpus API definition. When creating a new corpus, you have the option to assign a custom corpus_key following your preferred naming convention. This key serves as a unique identifier for the corpus, allowing it to be referenced in search requests. For more information, see Corpus Key Definition.
  • Enter the search query string for the corpus, which is the question you want to ask.
  • Set the maximum number of results (limit) to return. Default: 10, minimum: 1
  • Define the offset position from which to start in the result set.

For more detailed information, see this Query API guide.

Request

Path Parameters

    corpus_key CorpusKeyrequired

    Possible values: <= 50 characters, Value must match regular expression [a-zA-Z0-9_\=\-]+$

    The unique key identifying the corpus to query.

Query Parameters

    query stringrequired

    The search query string for the corpus, which is the question the user is asking.

    limit integer

    Possible values: >= 1

    Default value: 10

    The maximum number of results to return.

    offset integer

    The position from which to start in the result set.

Header Parameters

    Request-Timeout integer

    Possible values: >= 1

    The API will make a best effort to complete the request in the specified seconds or time out.

    Request-Timeout-Millis integer

    Possible values: >= 1

    The API will make a best effort to complete the request in the specified milliseconds or time out.

Responses

A response to a query.

Schema
    summary string

    The summary of the search results.

    response_language Language

    Possible values: [auto, eng, deu, fra, zho, kor, ara, rus, tha, nld, ita, por, spa, jpn, pol, tur, vie, ind, ces, ukr, ell, heb, fas, hin, urd, swe, ben, msa, ron]

    Default value: auto

    Languages that the Vectara platform supports.

    search_results object[]

    The ranked search results.

  • Array [
  • text string

    The document part altered by the context configuration that matches the query.

    score double

    The score of the individual result.

    part_metadata object

    The metadata for the document part.

    property name* any

    The metadata for the document part.

    document_metadata object

    The metadata for the document that contains the document part.

    property name* any

    The metadata for the document that contains the document part.

    document_id string

    The ID of the document that contains the document part.

    request_corpora_index int32

    A query request can search over multiple corpora at a time. This property is set to the index in the list of corpora in the original search request that this search result originated from.

    If the query request is only over one corpus, this property is 0.

  • ]
  • factual_consistency_score float

    The probability that the summary is factually consistent with the results.

    rendered_prompt string

    The rendered prompt sent to the LLM. Useful when creating customer prompt_text templates. Only available to Scale customers.

Loading...