Asking questions
Ask in plain language. You get exact passages, each with its file and version. When no supporting passage is returned, you get a flag your code can branch on.
Passages with their sources
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 answeredWhen no passage is returned
t = sc.query("What does clause 99.9 say?")
t.not_covered # True when no supporting passage was returned
t.quotes # emptynot_covered is a field, not an exception. It means no supporting passage was returned. It is not proof that no relevant passage exists, and the flag can be wrong both ways: a passage that answers may not be returned, and a returned passage may not answer. Your code decides what happens next, for example asking the user to add a document.
The shape your agent wants
r = sc.query(question)
if r.not_covered:
reply = "No supporting passage returned."
else:
reply = format_answer(r.quotes) # passages + sources, checkableAnswers are repeatable. The same question against the same version returns the same passages, which is what makes an answer from months ago auditable today.