Repository navigation
Quick Start
Rishu edited this page Oct 21, 2026
·
1 revision
This page takes you from install to retrieved context. See Installation first.
import noema
result = noema.compress("Larry Page founded Google in 1998. Sundar Pichai is the CEO of Google.")
print(result.notation) # compact logical form
print(result.saved_percent) # token reduction versus the original text
print(result.confidence) # round-trip validation score, 0 to 1
print(noema.decode(result.notation))Short, fact-sparse text can produce notation that is longer than the original. In that case
saved_percent is 0, not negative. See Compressing Text.
kb = noema.KnowledgeBase()
report = kb.ingest([
"Larry Page founded Google in 1998.",
"Sundar Pichai is the CEO of Google.",
])
print(report.entities_after, report.relations_after, report.entities_merged)
kb.save("company_kb.noema")ingest() accepts a string, a Document, or a list of either. Entities that refer to the same
thing, such as "Google" and "Google Inc.", are merged into one node. See Knowledge Bases.
kb = noema.KnowledgeBase.load("company_kb.noema")
context = kb.retrieve("Who is Google's CEO?", max_tokens=200)
print(context.text) # notation, ready for a prompt
print(context.token_count) # tokens used
print(context.truncated) # True if the budget cut factsquestion = "Who is Google's CEO?"
prompt = f"Use these facts:\n{context.text}\n\nQuestion: {question}"The notation is compact but readable by an LLM. To give the model plain sentences instead, pass
format="natural_language" to retrieve(). See Retrieval.
kb.ingest("Google acquired YouTube in 2006.")
kb.save("company_kb.noema")New facts merge into the existing graph, and the retrieval index is rebuilt on the next
retrieve() call.
noema build-graph docs/a.txt docs/b.txt --output company_kb.noema
noema query company_kb.noema "Who is Google's CEO?"See CLI Reference.
- Core Concepts explains what Noema builds
-
Retrieval explains how to tune
top_k,hopsandmax_tokens