Skip to content

feat: add a simple, verb-first Python API for all media types#2298

Draft
jdye64 wants to merge 2 commits into
mainfrom
cursor/simple-media-api-9245
Draft

feat: add a simple, verb-first Python API for all media types#2298
jdye64 wants to merge 2 commits into
mainfrom
cursor/simple-media-api-9245

Conversation

@jdye64

@jdye64 jdye64 commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds nemo_retriever.simple, a clean, user-facing Python API that reads like plain English and hides every implementation detail behind a handful of verbs. The goal is that a user immediately understands what happens when they call something, without needing to know about run modes, Ray, NIM endpoints, OCR/ASR, embedding models, or the vector store.

Import it as:

from nemo_retriever import simple as nr

Every verb works across all supported media types — documents (PDF, Word, PowerPoint), plain text, web pages (HTML), images, audio, and video — auto-detecting how to read each file. A source can be a single file, a folder, a wildcard pattern, or a list of any of those.

The verbs (the API options)

Read content out of your files:

  • extract(source) — read anything and return everything found inside (text, tables, charts, pictures, transcribed speech).
  • extract_documents(source) — PDFs, Word, PowerPoint.
  • extract_text(source) — plain-text files.
  • extract_web_pages(source) — saved HTML pages.
  • extract_images(source) — pictures and scans.
  • extract_audio(source) — audio recordings (transcribed to text).
  • extract_video(source) — videos (on-screen text + spoken words).

Make content searchable and use it:

  • ingest(source, *, into=None) — read files and make them searchable; into="a-name" saves a named library.
  • search(index, question, *, limit=10) — find the passages that best match a question.
  • ask(index, question, *, model) — get an answer written from your own content.

Discoverability:

  • MEDIA_TYPES / supported_media() — enumerate every supported file type in plain language.

The facade is a thin, dependency-light layer that delegates to the existing create_ingestor / Retriever engine via lazy imports, so importing it adds no new import-time cost.

Design principles applied:

  • Verb names and parameters contain no implementation details — descriptions say what happens, not how.
  • Sensible defaults are chosen for the user so a first call just works.
  • MEDIA_TYPES is covered by a test asserting it stays in sync with the engine's supported file extensions, so media coverage cannot silently drift.
  • The API lives in its own nemo_retriever.simple module rather than the top-level namespace, to avoid colliding with the existing nemo_retriever.ingest subpackage.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.
Open in Web Open in Cursor 

Introduce nemo_retriever.simple, a clean user-facing API that reads like
plain English and hides all implementation details behind a handful of
verbs: extract, ingest, search, ask (plus per-media-type extract_* helpers
for documents, text, web pages, images, audio, and video).

Verbs are re-exported lazily at the package top level so users can call
nemo_retriever.extract(...), nemo_retriever.ingest(..., into=...), etc.
MEDIA_TYPES / supported_media() enumerate every supported file type in
plain language.

Co-authored-by: Jeremy Dyer <jdye64@gmail.com>
@copy-pr-bot

copy-pr-bot Bot commented Jul 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

…kage

Expose the verb-first API only via the nemo_retriever.simple module instead
of re-exporting verbs at the package top level. The top-level 'ingest' name
collided with the existing nemo_retriever.ingest subpackage, which shadowed
the function. Resolve reformat (black) and update docs/tests to the
'from nemo_retriever import simple' entry point.

Co-authored-by: Jeremy Dyer <jdye64@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants