Isaacus

Endpoints

Extractive question answering

POST /extractions/qa

Extract information from documents with an Isaacus extractive question answering model.

Base URL: https://api.isaacus.com/v1

Request body

FieldTypeDescription
modelstringThe ID of the model to use for extractive question answering.
querystringThe query to extract the answer to.
textsarray[string]The texts to search for the answer in and extract the answer from.
ignore_inextractabilitybooleanWhether to, if the model’s score of the likelihood that an answer can not be extracted from a text is greater than the highest score of all possible answers, still return the highest scoring answers for that text.
top_kintegerThe number of highest scoring answers to return.
chunking_optionsobject | nullSettings for how texts should be chunked into smaller segments by semchunk before extraction.

model string

The ID of the model to use for extractive question answering.

query string

The query to extract the answer to.

The query must contain at least one non-whitespace character.

Unlike the texts from which the answer will be extracted, the query cannot be so long that it exceeds the maximum input length of the model.

texts array[string]

The texts to search for the answer in and extract the answer from.

There must be at least one text.

Each text must contain at least one non-whitespace character.

ignore_inextractability boolean

Whether to, if the model’s score of the likelihood that an answer can not be extracted from a text is greater than the highest score of all possible answers, still return the highest scoring answers for that text.

If you have already determined that the texts answer the query, for example, by using one of our classification or reranker models, then you should set this to true.

top_k integer

The number of highest scoring answers to return.

If null, which is the default, all answers will be returned.

chunking_options object

Settings for how texts should be chunked into smaller segments by semchunk before extraction.

If null, the texts will not be chunked and will instead be truncated to the maximum input length of the model less overhead if found to exceed that limit.

Chunking is enabled by default.

size integer

The maximum number of tokens allowed in a chunk.

If null, the maximum input length of the model will be used less overhead.

overlap_ratio number

The proportion of the chunk size by which chunks should overlap.

The ratio must be less than 1.

If null, no overlapping will occur unless overlap_tokens is set.

overlap_ratio and overlap_tokens cannot both be set.

overlap_tokens integer

The number of tokens by which chunks should overlap.

If null, no overlapping will occur unless overlap_ratio is set.

overlap_tokens and overlap_ratio cannot both be set.

Response

FieldTypeDescription
extractionsarray[object]The results of extracting answers from the texts, ordered from highest to lowest answer confidence score (or else lowest to highest inextractability score if there are no answers for a text).
usageobjectStatistics about the usage of resources in the process of extracting answers from the texts.

extractions array[object]

The results of extracting answers from the texts, ordered from highest to lowest answer confidence score (or else lowest to highest inextractability score if there are no answers for a text).

index integer

The index of the text in the input array of texts that this result represents, starting from 0 (and, therefore, ending at the number of texts minus 1).

answers array[object]

Answers extracted from the text, ordered from highest to lowest score.

text string

The text of the answer.

start integer

The index of the first character of the answer in the text, starting from 0 (and, therefore, ending at the number of characters in the text minus 1).

end integer

The index of the character immediately after the last character of the answer in the text, starting from 0 (such that, in Python, the answer is equivalent to text[start:end]).

score number

A score between 0 and 1, inclusive, representing the strength of the answer.

inextractability_score number

A score between 0 and 1, inclusive, representing the likelihood that an answer can not be extracted from the text.

Where this score is greater than the highest score of all possible answers, the text should be regarded as not having an extractable answer to the query. If that is the case and ignore_inextractability is false, no answers will be returned.

usage object

Statistics about the usage of resources in the process of extracting answers from the texts.

input_tokens integer

The number of tokens inputted to the model.

See making requests for authentication, SDK usage, and errors.