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
}
'import requests
url = "https://flow.seekr.com/v1/explainability/context-attributor"
payload = {
"context": "<string>",
"query": "<string>",
"response": "<string>",
"highlight": "<string>",
"granularity": "sentence",
"top_k": 5,
"num_ablations": 123,
"return_diagnostics": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: '<string>',
query: '<string>',
response: '<string>',
highlight: '<string>',
granularity: 'sentence',
top_k: 5,
num_ablations: 123,
return_diagnostics: false
})
};
fetch('https://flow.seekr.com/v1/explainability/context-attributor', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://flow.seekr.com/v1/explainability/context-attributor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'context' => '<string>',
'query' => '<string>',
'response' => '<string>',
'highlight' => '<string>',
'granularity' => 'sentence',
'top_k' => 5,
'num_ablations' => 123,
'return_diagnostics' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://flow.seekr.com/v1/explainability/context-attributor"
payload := strings.NewReader("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://flow.seekr.com/v1/explainability/context-attributor")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flow.seekr.com/v1/explainability/context-attributor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}"
response = http.request(request)
puts response.read_body{
"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,
"tool_context_note": "<string>",
"y_vector_stats": {},
"raw_coef_stats": {},
"scaler_stats": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Get context attribution
Compute context attribution scores for a model response given a set of source documents.
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
}
'import requests
url = "https://flow.seekr.com/v1/explainability/context-attributor"
payload = {
"context": "<string>",
"query": "<string>",
"response": "<string>",
"highlight": "<string>",
"granularity": "sentence",
"top_k": 5,
"num_ablations": 123,
"return_diagnostics": False
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
context: '<string>',
query: '<string>',
response: '<string>',
highlight: '<string>',
granularity: 'sentence',
top_k: 5,
num_ablations: 123,
return_diagnostics: false
})
};
fetch('https://flow.seekr.com/v1/explainability/context-attributor', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://flow.seekr.com/v1/explainability/context-attributor",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'context' => '<string>',
'query' => '<string>',
'response' => '<string>',
'highlight' => '<string>',
'granularity' => 'sentence',
'top_k' => 5,
'num_ablations' => 123,
'return_diagnostics' => false
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://flow.seekr.com/v1/explainability/context-attributor"
payload := strings.NewReader("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://flow.seekr.com/v1/explainability/context-attributor")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://flow.seekr.com/v1/explainability/context-attributor")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"context\": \"<string>\",\n \"query\": \"<string>\",\n \"response\": \"<string>\",\n \"highlight\": \"<string>\",\n \"granularity\": \"sentence\",\n \"top_k\": 5,\n \"num_ablations\": 123,\n \"return_diagnostics\": false\n}"
response = http.request(request)
puts response.read_body{
"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,
"tool_context_note": "<string>",
"y_vector_stats": {},
"raw_coef_stats": {},
"scaler_stats": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}context– The context text provided to the modelquery– The user’s query or questionresponse– The model’s response to attribute
highlight– A specific portion of the response to attribute. If omitted, returns attributions for all response segments.granularity– How to partition the context:sentenceorparagraphtop_k– Number of top sources to return per segmentnum_ablations– Number of ablation experiments to run (32–256). Auto-computed if not set.return_diagnostics– Iftrue, includes internal diagnostic information in the response. Defaults tofalse.
Authorizations
Your Seekr API key, sent in the Authorization header with no 'Bearer' prefix.
Body
Request model for context attribution.
Computes which parts of the context contributed to the model's response using the ContextCite algorithm.
The context text provided to the model.
1The user's question/query.
1The model's response to attribute.
1Specific portion of response to attribute. If None, attributes all segments.
1Granularity for partitioning context: sentence or paragraph.
sentence, paragraph Number of top attributed sources to return per segment.
x >= 1Number of ablation experiments to run. If None, computed dynamically using O(k log d) formula. Must be between 32 and 256 (inclusive) if specified.
If True, include diagnostic information in the response.
Response
Success
Response model for context attribution.
The full response text that was attributed.
Attribution results for each response segment. Populated when highlight is not provided.
Show child attributes
Show child attributes
The highlighted portion of the response (if provided in request).
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.
- ToolResponseSource
- RawContextSource
- SystemPromptSource
Show child attributes
Show child attributes
Diagnostic information. Only populated when return_diagnostics=True.
Show child attributes
Show child attributes
Was this page helpful?