Skip to content
Catalog

cn8/text-qa

Send a question and a context passage, and get back the exact span of text in that

Learn more about Question Answering
Text NLPsyncInstant previewtextanalysisnlp

Try it

Context
Question

Result

Results show up here

The sample input is ready — just hit Run.

Overview

Send a question and a context passage, and get back the exact span of text in that passage that answers it. The response includes the answer, a confidence score, the start and end character offsets of the answer in the context, and an is_confident flag. Because the answer is quoted directly from your text, there's no hallucination. Responses are synchronous — one request, one result.

Key capabilities

Answers quoted from your text

The answer is an exact span pulled from your context — never paraphrased or invented.

Character offsets

start and end give the exact position of the answer in your context string, ready for highlighting.

Confidence flag

is_confident is a simple boolean you can use to decide when to show the answer or fall back.

Multilingual

Question and context can be in many languages, not just English.

When to use it

Document QA

Let users ask questions over a retrieved document chunk or article.

FAQ from passages

Match questions to policy text, help articles, or product documentation.

Support automation

Retrieve the right passage first (with Semantic Search), then extract the precise answer here.

Input & output

input

A question and a context passage.

JSON body

output

The answer span, a confidence score, start/end offsets, and an is_confident flag.

JSON

Guides & tips

How it works

  • You provide a question and a context passage, and the service finds the span of the context that answers it.
  • The answer is always an exact quote from your context, located by the start and end character offsets — handy for highlighting in your UI.
  • Use is_confident (or the score) to decide whether to show the answer or fall back to "I don't know".

When the answer isn't in the passage

  • If the context doesn't contain the answer, is_confident will be false and the score will be low. Show a fallback message instead of the extracted span.
  • For questions over a larger knowledge base, pair this with Semantic Search: retrieve the best passage first, then ask the question here.

Specs

Latency
Typically 1–3 seconds
Async
false
Rate Limit
Per API key
Max Input
Long contexts are handled automatically

Schema

Request body

questionrequiredstring

The question to answer.

contextrequiredstring

The passage that should contain the answer. Send a single passage per request.

Response

answerstring

The exact answer span, quoted from your context.

scorenumber

Confidence in the answer, from 0 to 1.

startinteger

Start character offset of the answer in the context.

endinteger

End character offset of the answer in the context.

is_confidentboolean

True when the answer is reliable — a convenient flag for deciding when to show it.

Pricing

Billed per request.

ServiceUnitPrice
Question Answeringitem$0.006/request

FAQ

Related models