POST /v1/attributions.
Requires the attributions:write scope. See Raw heatmap for how to read the result.
Request body
string
required
The source text. 1 to 400,000 characters. The heatmap comes from a single model context and is never windowed. A document that does not fit fails with
413 prompt_too_long.string
required
The question or task the model was given. 1 to 10,000 characters.
string
required
The model’s answer. 1 to 10,000 characters.
string
default:"utf-16"
The unit for
answer_offsets and document_offsets: utf-16, utf-32, or utf-8. See Offsets and encoding.number
default:"0.001"
The smallest attention value to include. Range
0 to 1. Lower values return denser, larger responses.Response
array of integer
Answer token index of each cell.
array of integer
Document token index of each cell. Parallel to
row and data.array of number
The share of answer token
row[i]’s attention that lands on document token col[i], from 0 to 1.[integer, integer]
[answer_tokens, document_tokens], the size of the full dense matrix.array of [integer, integer]
[start, end] of every answer token in your answer, indexed by token.array of [integer, integer]
[start, end] of every document token in your document, indexed by token.object
prompt_tokens is the number of tokens the model processed, which is what you are billed for. document_tokens and answer_tokens are the parts of that count taken up by your document and answer.string
The unit both offset arrays are counted in.
[7, 16] is " improved"), and one word can span several tokens. Always slice with the returned offsets rather than splitting on whitespace.
