feat: add a simple, verb-first Python API for all media types#2298
Draft
jdye64 wants to merge 2 commits into
Draft
feat: add a simple, verb-first Python API for all media types#2298jdye64 wants to merge 2 commits into
jdye64 wants to merge 2 commits into
Conversation
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>
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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/Retrieverengine via lazy imports, so importing it adds no new import-time cost.Design principles applied:
MEDIA_TYPESis covered by a test asserting it stays in sync with the engine's supported file extensions, so media coverage cannot silently drift.nemo_retriever.simplemodule rather than the top-level namespace, to avoid colliding with the existingnemo_retriever.ingestsubpackage.Checklist