Skip to content
API referencePreview what context a question would get

Preview what context a question would get

POST/v1/context-sources/retrieve

Preview what context a question would get.

Chooses the sections of the given sources for question exactly as a chat completion with x-context-source would, and returns them with their text, the selector's confidence and reason, and the status a request would get in x-context-status. No answer is generated. The selection is one model call on virtual_key (billed to it and logged as context_select), or none when the same question was asked of the same outline before (cached).

Requires a key of the virtual key's workspace (or an organization admin key) and a plan that includes context sources (402 otherwise). Returns 400 for an unknown or unusable virtual key, 403 when the key has no access to a source, 404 for an unknown source and 409 when a source is not READY.

Authorization

  • AuthorizationBearer va_

    A platform API key (va_...), created under Settings > API keys. Scoped to an organization or one workspace, with an admin or member role. Used by the management API.

Query parameters

  • organizationstringrequired

    The organization's identifier (slug).

Request body application/json

The question, the sources and the key to choose with.

  • virtual_keystringrequired

    The virtual key (vk-...) the selection runs on and is billed to. It must have access to every source.

    At least 1 characters

  • sourcesstring[]required

    Context source ids (ctx-...), 1 to 5.

    At most 5 items

  • questionstringrequired

    The question, as the last user message of a request would carry it. At most 20,000 characters.

    At least 0 characters · At most 20000 characters

  • budgetinteger<int32>

    Most tokens of section text to return, 200 to 100000. Default 6000.

  • modelstring

    The model that chooses the sections. Default gpt-6-luna.

    At least 0 characters · At most 200 characters

Responses

200application/json
  • statusstring

    APPLIED (sections chosen), LOW_CONFIDENCE (chosen, but the selector was not sure they answer it), NO_MATCH (nothing relevant), NO_QUESTION (empty question), SELECT_FAILED (the selection call failed or its answer could not be read) or SELECT_TIMEOUT (it took longer than the time limit). When every section fits the budget, all are added without a selection call (APPLIED, no confidence). The same value a request gets in x-context-status.

  • confidencestring

    The selector's confidence: high, medium or low. Absent when it did not answer.

  • reasonstring

    The selector's one-sentence reason for its choice. Absent when it did not give one.

  • cachedboolean

    True when the choice came from the cache of earlier selections for the same outline and question (no model call was billed).

  • select_msinteger<int64>

    Milliseconds spent choosing.

  • tokensinteger<int32>

    Estimated tokens of all the sections' text.

  • consideredinteger<int32>

    How many sections of the sources the selector could choose from.

  • chosenstring[]

    What the selector chose, <source>/<section>, in its order, before the budget: one here but not in sections was dropped because it did not fit.

  • modelstring

    The model that chose.

  • budgetinteger<int32>

    Tokens of section text allowed.

  • sectionsobject[]

    The sections chosen within the budget, most relevant first.

    Child attributes
    • sourcestring

      The source's id (ctx-...).

    • section_idstring

      The section's id in the source's outline (n12).

    • titlestring

      The section's title.

    • page_frominteger<int32>

      First page of the section (PDF only).

    • page_tointeger<int32>

      Last page of the section (PDF only).

    • tokensinteger<int32>

      Estimated tokens of the text below.

    • cited_bystring

      When the section was added because a chosen section refers to it ("subject to Section 9"): that section's id in the outline (n14). Absent for the sections the selection chose itself.

    • textstring

      The text that would be added, cut to the budget when it is the only section and too long.

NVIDIA Inception Program member

VectorAxis is built by GK Labs, a member of NVIDIA Inception.