Official Python SDK for the Poma document-processing API
Project description
POMA: Preserving Optimal Markdown Architecture
Quick-Start Guide
Installation
Requires Python 3.10+. Install the core package:
pip install poma
For different integrations:
pip install 'poma[langchain]'
pip install 'poma[llamaindex]'
pip install 'poma[qdrant]'
# Or LangChain/LlamaIndex/Qdrant including example extras:
pip install 'poma[all]'
- You may also want:
pip install python-dotenvto load API keys from a .env file. - API keys required (POMA_API_KEY) for the POMA AI client via environment variables.
- To request a POMA_API_KEY, please contact us at sdk@poma-ai.com
Usage
from poma import PrimeCut, generate_cheatsheets
pc = PrimeCut(api_key="your_key")
# Ingest a document — submits the file, polls, and returns typed results
result = pc.ingest("document.pdf")
print(result.chunksets[0])
print(result.chunks[0].content)
# Eco ingestion uses the same flow against the eco endpoints
eco_result = pc.ingest_eco("document.pdf")
To test this flow from the command line (requires POMA_API_KEY in the environment):
python -m poma document.pdf # run both ingest and ingest_eco
python -m poma path/to/file.pdf # custom file
python -m poma document.pdf --no-eco # standard ingest only
python -m poma document.pdf --eco # eco ingest only
Generate cheatsheets as a top-level utility:
cheatsheets = generate_cheatsheets(
relevant_chunksets=result.chunksets,
all_chunks=result.chunks,
)
print(cheatsheets[0]["content"])
If you already have a .poma archive, unpack it directly:
from poma import unpack
archived_result = unpack("document.poma")
print(archived_result.chunks[0].content)
Async clients use the same API shape:
import asyncio
from poma import AsyncPrimeCut
async def main() -> None:
async with AsyncPrimeCut(api_key="your_key") as pc:
result = await pc.ingest("document.pdf")
print(result.chunksets[0])
asyncio.run(main())
Grill (RAG / hybrid search)
Grill ingests documents into a per-project namespace and serves prompt-ready retrieval context for RAG.
Auth note: Grill endpoints require a project-level key (prefix
poma_proj_gr_...), not the account-levelPOMA_API_KEY. SetPOMA_GRILL_API_KEYin your environment. The SDK validates the prefix at construction and raisesInvalidGrillApiKeyErrorif you accidentally use the wrong one.
from poma import Grill
g = Grill() # reads POMA_GRILL_API_KEY
# 1. Ingest a document. Grill indexes it into your project namespace
# (no archive download). `result.status == "done"` when ready.
result = g.ingest("document.pdf")
print(result.job_id, result.status, result.usage)
# 2. Run hybrid search across all documents in the namespace.
# Returns a prompt-ready XML+Markdown block — drop it into an LLM prompt.
ctx = g.search("How do I configure retries?", target_tokens=2048)
print(ctx.context)
# 3. List, inspect, and delete documents in the namespace.
# To find the doc you just ingested, match source_job_id to the job_id.
for doc in g.list_docs():
print(doc.doc_id, doc.filename, doc.pages)
deleted = g.delete_doc(doc.doc_id)
print(deleted.vectors_deleted, deleted.storage_deleted)
The async client mirrors the same surface:
import asyncio
from poma import AsyncGrill
async def main() -> None:
async with AsyncGrill() as g:
ctx = await g.search_in_doc("summarize section 3", "doc_abc123")
print(ctx.context)
asyncio.run(main())
Example Implementations
All examples, integrations, and additional information can be found in our GitHub repository: poma-ai/poma
We provide example implementations to help you get started with POMA AI:
- example.py — A standalone implementation for documents, showing the basic POMA AI workflow with simple keyword-based retrieval
- example_langchain.py — Integration with LangChain, demonstrating how easy it is to use POMA AI with LangChain
- example_llamaindex.py — Integration with LlamaIndex, showing how simple it is to use POMA AI with LlamaIndex
Note: The integration examples use OpenAI embeddings. Make sure to set your OPENAI_API_KEY environment variable, or replace the embeddings with your preferred ones.
All examples follow the same two-phase process (ingest → retrieve) but demonstrate different integration options for your RAG pipeline.
! Please do NOT send any sensitive and/or personal information to POMA AI endpoints without having a signed contract & DPA !
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file poma-0.5.1.tar.gz.
File metadata
- Download URL: poma-0.5.1.tar.gz
- Upload date:
- Size: 52.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12d56a2a17ab2f2f10434453fa9d49da11d5976273b6382851f27c36dab38153
|
|
| MD5 |
c16579a8164fec74fa86b68df555ace5
|
|
| BLAKE2b-256 |
08d7930a74a274f3942c35d05c334b4f2fa67a6597794a5ce4c06a8e44d80736
|
Provenance
The following attestation bundles were made for poma-0.5.1.tar.gz:
Publisher:
python-publish.yml on poma-ai/poma-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poma-0.5.1.tar.gz -
Subject digest:
12d56a2a17ab2f2f10434453fa9d49da11d5976273b6382851f27c36dab38153 - Sigstore transparency entry: 1704009615
- Sigstore integration time:
-
Permalink:
poma-ai/poma-sdk@eeb04c6b0da922e60b45f592ccb1667187f110e9 -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/poma-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@eeb04c6b0da922e60b45f592ccb1667187f110e9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file poma-0.5.1-py3-none-any.whl.
File metadata
- Download URL: poma-0.5.1-py3-none-any.whl
- Upload date:
- Size: 49.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
23d0900cf83af407c0817f8a4326d4e632b051485abb33944842cf9a41c09c2c
|
|
| MD5 |
dbae9a42aaf97f9e5b35e0b6364ebc10
|
|
| BLAKE2b-256 |
c82793d32f994d24547e31fb1a1c413a4cb734d438c3bcce932d7b9889a254b5
|
Provenance
The following attestation bundles were made for poma-0.5.1-py3-none-any.whl:
Publisher:
python-publish.yml on poma-ai/poma-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
poma-0.5.1-py3-none-any.whl -
Subject digest:
23d0900cf83af407c0817f8a4326d4e632b051485abb33944842cf9a41c09c2c - Sigstore transparency entry: 1704009622
- Sigstore integration time:
-
Permalink:
poma-ai/poma-sdk@eeb04c6b0da922e60b45f592ccb1667187f110e9 -
Branch / Tag:
refs/tags/0.5.1 - Owner: https://github.com/poma-ai
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@eeb04c6b0da922e60b45f592ccb1667187f110e9 -
Trigger Event:
push
-
Statement type: