Skip to main content
Noema: Python library for knowledge graph RAG and LLM context compression

Noema

Convert text into compact logical form: fewer tokens, no lost context, built for RAG

Noema is a Python library for token-efficient RAG. It turns documents into a deduplicated knowledge graph and sends your LLM only the facts a question needs, in a compact notation.

PyPI version License: Apache 2.0 Python 3.13+ Code style: ruff


What is Noema?

Noema is a Python library for knowledge graph construction, LLM context compression and Retrieval-Augmented Generation (RAG). Instead of treating documents as flat strings, it parses text into a structured logical form of entities and relations, and organizes that structure into a canonical, deduplicated graph.

At query time, only the sub-graph relevant to the question is rendered as a short, line-oriented notation and placed in the prompt. The same compact representation that reduces token usage is also the retrieval layer, so token savings and retrieval quality come from one design rather than two systems bolted together.

Larry Page founded Google in 1998. Sundar Pichai is the CEO of Google.

        becomes

#1 Larry Page :PERSON
#2 Google :ORG
#3 Sundar Pichai :PERSON
#1 -found-> #2
#3 -ceo_of-> #2

A typical RAG pipeline stores and re-embeds raw text chunks. Noema stores canonical facts, merges repeated mentions of the same fact into one node, and checks its compact notation by decoding it back to natural language and scoring the result (round-trip validation).

Why Noema? How it differs from other approaches

Plain-text RAG (chunk and embed) Text-only prompt compressors Noema
What is stored Raw text chunks Nothing (stateless) Canonical, deduplicated facts
Multi-hop questions Weak Not applicable Graph traversal connects facts across documents
Same fact in many documents Repeated in every retrieval Not addressed Merged into one node
Context sent per query Whole chunks The compressed prompt Only the relevant sub-graph
Meaning-loss check None Text similarity Round-trip validation with a confidence score
Adding documents Re-chunk and re-embed Not applicable Merges into the existing graph

Features

  • Text to semantic graph: entity and relation extraction, with optional coreference resolution and transformer-based relations
  • Canonicalization and deduplication: one canonical node per fact, across one document or many
  • Compact notation: a low-token representation for LLM context injection, decodable back to natural language
  • Hybrid retrieval: vector similarity search plus multi-hop graph traversal, under a max_tokens budget
  • Round-trip validation: a confidence score for how much meaning the notation keeps
  • Incremental knowledge base: new documents merge into the existing graph; save and load as a single .noema file
  • Streaming ingestion: batched ingestion with checkpoints for large document sets
  • Persistent backends: optional Neo4j and RDF stores for larger knowledge bases
  • Framework integrations: LangChain and LlamaIndex retrievers, plus OpenAI and Anthropic token counting
  • Command-line tool: noema for compression, graph building, querying and inspection
  • Benchmark suite: reproducible comparison against plain-chunk RAG and full-context stuffing

Quick look

import noema

kb = noema.KnowledgeBase()
kb.ingest(documents)
context = kb.retrieve("Who is Google's CEO?", max_tokens=200)

prompt = f"{context.text}\n\nQuestion: Who is Google's CEO?"

Use cases

  • Cutting LLM token costs in RAG pipelines and long-context applications
  • Multi-hop question answering over facts spread across several documents
  • Building a lightweight knowledge graph from text without hand-written schemas
  • Keeping a knowledge base up to date as new documents arrive

Documentation

Installation, usage guides, CLI and integration docs are on the project Wiki.

Project status

Noema is under active development. The core pipeline, storage, retrieval, integrations, CLI and benchmark suite are implemented; the public API may still change before 1.0.

License

Noema is licensed under the Apache License 2.0.

Keywords: RAG, retrieval-augmented generation, knowledge graph, GraphRAG, LLM context compression, prompt compression, token reduction, semantic compression, entity and relation extraction, multi-hop question answering, LangChain, LlamaIndex, Neo4j, RDF, Python.

Metadata

Release files for noema-rag 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for noema-rag 0.1.1
File Size Uploaded Provenance Actions
noema_rag-0.1.1.tar.gz 100.7 kB Without provenance Details for noema_rag-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for noema-rag 0.1.1
File Interpreter ABI Platform Actions
noema_rag-0.1.1-py3-none-any.whl Python 3 none any Details for noema_rag-0.1.1-py3-none-any.whl

Total release size: 166.4 kB

Release files / noema_rag-0.1.1.tar.gz

Download URL noema_rag-0.1.1.tar.gz
Size 100.7 kB
Tags Source
SHA-256 checksum
How to use checksums
427b6e3e637b0dcc6703990cc5147a75d0f9ea5d076cb1f72fc8a64cdaa97f75
BLAKE2b-256 checksum
How to use checksums
fd9fd49e25ace7504e6fcb80b94507be5ba023a2c7ada290b4ddcb196d3e6f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Release files / noema_rag-0.1.1-py3-none-any.whl

Download URL noema_rag-0.1.1-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e2c15e8e88945ff3c68d103993458716a7a17a06e8335d2ebff18ca6e383968a
BLAKE2b-256 checksum
How to use checksums
6ec9bb0aa9e5f48f37e2e1fb6c6815748d68dfaf1ae902c6d658b138d03f42cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.2

Security for noema-rag 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page