Skip to main content
POST
/
v1
/
explainability
/
context-attributor
Get context attribution
curl --request POST \
  --url https://flow.seekr.com/v1/explainability/context-attributor \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "context": "<string>",
  "query": "<string>",
  "response": "<string>",
  "highlight": "<string>",
  "granularity": "sentence",
  "top_k": 5,
  "num_ablations": 123,
  "return_diagnostics": false
}
'
{
  "response_text": "<string>",
  "segments": [],
  "highlight": "<string>",
  "sources": [
    {
      "id": 123,
      "text": "<string>",
      "attribution": 123,
      "offset": 123,
      "tool_name": "<string>",
      "tool_call_id": "<string>",
      "tool": {
        "url": "<string>",
        "search_query": "<string>",
        "type": "web_search",
        "title": "<string>"
      },
      "source_type": "tool_response"
    }
  ],
  "diagnostics": {
    "num_sources": 123,
    "num_ablations": 123,
    "lasso_alpha": 123,
    "mask_probability": 123,
    "y_vector_stats": {},
    "raw_coef_stats": {},
    "scaler_stats": {}
  }
}
Determines which parts of the provided context contributed to the model’s response. Attribution can be returned for a specific highlight within the response, or broken into segments across the full response. Required fields
  • context — The context text provided to the model
  • query — The user’s query or question
  • response — The model’s response to attribute
Optional fields
  • model — Model used for attribution computation (default: Llama-3.1-8B-Instruct)
  • highlight — A specific portion of the response to attribute. If omitted, returns attributions for all response segments.
  • granularity — How to partition the context: sentence or chunk
  • top_k — Number of top sources to return per segment
  • num_ablations — Advanced tuning parameter (32–256)

Authorizations

Authorization
string
header
required

Seekr API Key without 'Bearer' Prefix

Body

application/json

Request model for context attribution.

Computes which parts of the context contributed to the model's response using the ContextCite algorithm.

context
string
required

The context text provided to the model.

query
string
required

The user's question/query.

response
string
required

The model's response to attribute.

highlight
string | null

Specific portion of response to attribute. If None, attributes all segments.

granularity
enum<string>
default:sentence

Granularity for partitioning context: sentence or paragraph.

Available options:
sentence,
paragraph
top_k
integer
default:5

Number of top attributed sources to return per segment.

Required range: x >= 1
num_ablations
integer | null

Number of ablation experiments to run. If None, computed dynamically using O(k log d) formula. Must be between 32 and 256 (inclusive) if specified.

return_diagnostics
boolean
default:false

If True, include diagnostic information in the response.

Response

Successful Response

Response model for context attribution.

response_text
string
required

The full response text that was attributed.

segments
SegmentAttribution · object[]

Attribution results for each response segment. Populated when highlight is not provided.

highlight
string | null

The highlighted portion of the response (if provided in request).

sources
(ToolResponseSource · object | RawContextSource · object)[] | null

Context sources for the highlight. Only populated when highlight is provided.

A context source that originated from a tool call.

This model contains the core attribution fields plus tool-specific metadata nested in the tool field.

diagnostics
ContextAttributionDiagnostics · object

Diagnostic information. Only populated when return_diagnostics=True.

Last modified on June 18, 2026