Repository navigation
Conversation
…ed-by: IBM Bob Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
planetf1
left a comment
There was a problem hiding this comment.
Overall this looks good, apart from the inline comments. I ran 101_with_gen_stubs.py, advanced_with_m_instruct.py, mify.py and table.py against granite4.2:3b and they run, and every ollama pull tag matches the model the script actually uses. The comments are mostly about link depth and install commands.
Separately, not for this PR: docs/docs/examples/data-extraction-pipeline.md mirrors 101_with_gen_stubs.py and still shows the model_ids import this PR removes, and it and legacy-code-integration.md tell readers to pull granite4.1:3b while the session default is granite4.2:3b. That page could do with its own pass.
| This directory demonstrates the `@mify` decorator for making custom Python objects work seamlessly with Mellea. | ||
| Examples demonstrating the `@mify` decorator for making custom Python objects | ||
| LLM-compatible with Mellea. For a conceptual overview, see | ||
| [MObjects and mify](../../docs/docs/concepts/mobjects-and-mify.md). |
There was a problem hiding this comment.
The link resolves one directory too deep: from docs/examples/mify/, ../../docs/docs/... lands on docs/docs/docs/..., which doesn't exist. Dropping one docs/ segment fixes it and matches the form mcp/README.md and telemetry/README.md already use.
The concepts page covers fields_include and funcs_include but has nothing on stringify_func, query_type or template_order, which the old README's advanced section and mify.py both feature. That content lives in the legacy code integration example, so a second link covers it:
| [MObjects and mify](../../docs/docs/concepts/mobjects-and-mify.md). | |
| [MObjects and mify](../../docs/concepts/mobjects-and-mify.md) and | |
| [Legacy Code Integration with @mify](../../docs/examples/legacy-code-integration.md). |
| [MObjects and mify](../../docs/docs/concepts/mobjects-and-mify.md) and | ||
| [Working with Data](../../docs/docs/how-to/working-with-data.md). |
There was a problem hiding this comment.
Same link-depth issue as the mify README, on both links:
| [MObjects and mify](../../docs/docs/concepts/mobjects-and-mify.md) and | |
| [Working with Data](../../docs/docs/how-to/working-with-data.md). | |
| [MObjects and mify](../../docs/concepts/mobjects-and-mify.md) and | |
| [Working with Data](../../docs/how-to/working-with-data.md). |
Also, the old README pointed to notebooks/table_mobject.ipynb, which still exists and is the interactive version of this directory's only example. Dropping it is fine if deliberate, just confirming it was a choice; a one-line pointer would keep it discoverable.
There was a problem hiding this comment.
I introduced a pointer to this link in the README table.
| This directory contains examples of implementing RAG systems with Mellea. | ||
| Examples demonstrating Retrieval-Augmented Generation (RAG) patterns in Mellea. | ||
| For a step-by-step guide to building a full pipeline, see the | ||
| [Build a RAG Pipeline](../../docs/docs/how-to/build-a-rag-pipeline.md) how-to. |
There was a problem hiding this comment.
Same link-depth issue. This is the pointer a newcomer is most likely to follow, since the table rows assume the step-by-step guide:
| [Build a RAG Pipeline](../../docs/docs/how-to/build-a-rag-pipeline.md) how-to. | |
| [Build a RAG Pipeline](../../docs/how-to/build-a-rag-pipeline.md) how-to. |
| | File | Description | | ||
| | :--- | :--- | | ||
| | [`simple_rag_with_filter.py`](./simple_rag_with_filter.py) | Two-stage pipeline: FAISS semantic search followed by a `@generative` relevance filter, then grounded answer generation with `grounding_context`. Requires `faiss-cpu` and `sentence-transformers`. | | ||
| | [`mellea_pdf.py`](./mellea_pdf.py) | Loading a remote PDF into a `RichDocument` component and passing it as `grounding_context` for document-grounded question answering. | |
There was a problem hiding this comment.
Nit: the mellea_pdf.py row could say Requires docling like the mify rows, since the script's Prerequisites install it.
| Prerequisites: | ||
| ollama pull granite4.2:3b | ||
| ollama serve |
There was a problem hiding this comment.
The Prerequisites miss a hard dependency: line 18 imports TableQuery from mellea.stdlib.components.docs.richdocument, and that module raises ImportError on a base install (its message suggests pip install "mellea[docling]"). I checked by importing it with docling absent, and it fails before any mify code runs. uv sync --extra docling covers it, and the README row could say Requires docling like its siblings.
The ollama pull before ollama serve ordering is worth a tweak as well: pull needs the server up. Something like this covers the common setups, and would be worth applying across the other new blocks too:
| Prerequisites: | |
| ollama pull granite4.2:3b | |
| ollama serve | |
| Prerequisites: | |
| uv sync --extra docling | |
| Ollama running (service, desktop app, or `ollama serve`) | |
| ollama pull granite4.2:3b |
There was a problem hiding this comment.
Fixed, but I kept the ollama serve command instead of the different options in the suggestion.
| uv sync --extra backends | ||
| pip install docling |
There was a problem hiding this comment.
Same as the rich_table example: pip install docling lands outside the venv uv run uses, and the default Ollama backend means --extra backends isn't needed either:
| uv sync --extra backends | |
| pip install docling | |
| uv sync --extra docling |
| uv sync --extra backends | ||
| pip install docling docling-core |
There was a problem hiding this comment.
This one does need --extra backends since it runs backend_name="hf", but the pip install line has the same venv problem as the other scripts. docling-core is also redundant in the list, since docling depends on it:
| uv sync --extra backends | |
| pip install docling docling-core | |
| uv sync --extra backends --extra docling |
Since this is the only HF-backend script in these directories, one line saying the model downloads on first run would also explain why there's no Ollama step.
There was a problem hiding this comment.
Follow-up from validating the install commands by running this end to end: the script can't complete on Apple Silicon as written, regardless of install method. The layout model's position embedding is built in float64, which MPS doesn't support, and this example builds its own DocumentConverter, so it misses the CPU guard RichDocument gained in #1417 (that closed #1344 for the library paths; mellea_pdf.py runs fine through RichDocument). Root cause is upstream (huggingface/transformers#46159, tracked as docling-project/docling#3483); mellea's transformers>5.5.0,<6.0.0 override keeps 5.10.2, which still has it.
Adding the same guard here fixes it. I ran the patched script end to end on an M-series Mac and the full walkthrough completes:
from docling.datamodel.pipeline_options import (
AcceleratorDevice,
AcceleratorOptions,
PdfPipelineOptions,
)
pipeline_options = PdfPipelineOptions(images_scale=2.0, generate_picture_images=True)
pipeline_options.accelerator_options = AcceleratorOptions(device=AcceleratorDevice.CPU)Happy for this to land here or as a tiny follow-up PR, whichever you prefer. If it goes in here, a one-line note in the description would cover it.
There was a problem hiding this comment.
Included this patch in the script here.
| updating it with `m.transform()`. | ||
|
|
||
| Prerequisites: | ||
| pip install pandas |
There was a problem hiding this comment.
The pandas prerequisite is right (pandas isn't a mellea dependency), but pip beside a uv run Usage line installs into a different environment than the one the script runs in. uv pip install pandas is the drop-in fix:
| pip install pandas | |
| uv pip install pandas |
| Prerequisites: | ||
| ollama pull mistral:7b | ||
| ollama serve |
There was a problem hiding this comment.
The Prerequisites are right, but a reader who copies the uv run python ... pattern from the sibling examples gets ModuleNotFoundError: faiss, because this script's dependencies come from its PEP 723 header and only uv run (without python) resolves them. One sentence saves that trip:
| Prerequisites: | |
| ollama pull mistral:7b | |
| ollama serve | |
| Prerequisites: | |
| ollama pull mistral:7b | |
| ollama serve | |
| faiss-cpu and sentence-transformers come from the PEP 723 header, so | |
| `uv run` (without `python`) installs them automatically. |
| # Information Extraction Examples | ||
|
|
||
| This directory contains examples for extracting structured information from unstructured text using Mellea. | ||
| Examples demonstrating structured information extraction from text using Mellea. |
There was a problem hiding this comment.
This is the only one of the four directories without a link to the site docs. The removed Basic Usage content lives in the Data Extraction Pipeline example, which also links back to 101_with_gen_stubs.py, so one link closes the loop:
| Examples demonstrating structured information extraction from text using Mellea. | |
| Examples demonstrating structured information extraction from text using Mellea. | |
| For a walkthrough, see [Data Extraction Pipeline](../../docs/examples/data-extraction-pipeline.md). |
Signed-off-by: Rafael Vasquez <rafvasq21@gmail.com>
Pull Request
Issue
Towards #1746
Description
Docstrings
Prerequisites:andUsage:blocks.READMEs
## Examplestable. Removed content was checked against the site docs first.Other fixes
model_idsimports in bothinformation_extraction/scripts.ollama pulltags match each script's actual model.uv sync --extra docling.rich_document_advanced.py: added an MPS→CPU accelerator guard thatRichDocumentuses (fix: force cpu accelerator for docling on apple silicon mps #1417), so docling conversion completes on Apple Silicon.Testing
Attribution
Adding a new component, requirement, sampling strategy, or tool?
If your PR adds or modifies one of the types below, check the matching box. A checklist of type-specific review items will be posted as a comment.
NOTE: Please ensure you have an issue that has been acknowledged by a core contributor and routed you to open a pull request against this repository. Otherwise, please open an issue before continuing with this pull request.