Asking questions

Ask in plain language. You get exact passages with sources, or an honest no. Both are normal results your code can branch on.

A grounded answer

r = sc.query("What is the termination notice period?")

r.not_covered          # False
for q in r.quotes:
    q.text             # the passage, word for word from your document
    q.source_id        # which document it came from
r.version              # which version of the graph answered

The honest no

t = sc.query("What does clause 99.9 say?")

t.not_covered          # True
t.quotes               # empty. Nothing invented, zero tokens spent.

not_covered is a field, not an exception. It means the answer is not in your documents. Your code decides what happens next, for example asking the user to add the missing document.

The shape your agent wants

r = sc.query(question)
if r.not_covered:
    reply = "That is not in your documents."
else:
    reply = format_answer(r.quotes)   # passages + sources, checkable

Answers are repeatable. The same question against the same version returns the same passages, which is what makes an answer from months ago auditable today.

Next: Versions →