Skip to content

Unstructured cookbook#207

Open
SIDDHAARTHAA wants to merge 3 commits into
usemoss:mainfrom
SIDDHAARTHAA:unstructured-cookbook
Open

Unstructured cookbook#207
SIDDHAARTHAA wants to merge 3 commits into
usemoss:mainfrom
SIDDHAARTHAA:unstructured-cookbook

Conversation

@SIDDHAARTHAA

@SIDDHAARTHAA SIDDHAARTHAA commented May 4, 2026

Copy link
Copy Markdown

Pull Request Checklist

Please ensure that your PR meets the following requirements:

  • I have read the CONTRIBUTING guide.
  • I have updated the documentation (if applicable).
  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Description

Adds a focused Unstructured + Moss cookbook for parsing raw files, chunking extracted content, preserving metadata, and incrementally upserting chunks into a Moss index for semantic search.

The cookbook includes a runnable ingestion script, sample documents, environment template, setup/usage documentation, and a lightweight smoke test for the ingestion pipeline.

Validation performed:

  • python -m py_compile examples/cookbook/unstructured/ingest.py
  • cd examples/cookbook/unstructured && python -m unittest test_integration.py

Fixes #203

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Open in Devin Review

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

devin-ai-integration[bot]

This comment was marked as resolved.

@yatharthk2

Copy link
Copy Markdown
Contributor

Hi @SIDDHAARTHAA , thank you very much for working on this pr. Were you able to resolve all the comments from ai ? also can you please record a short 1 min video demonstrating the demo of implementation.

@SIDDHAARTHAA

Copy link
Copy Markdown
Author

Hey @yatharthk2, thanks for checking out. I’m working on it.

@CoderOMaster

Copy link
Copy Markdown
Collaborator

@SIDDHAARTHAA can you share a short 1 min video demo as well?

@SIDDHAARTHAA

Copy link
Copy Markdown
Author

Attached a short demo video covering the Unstructured cookbook flow, the new smoke tests, and the local validation run passing.
@yatharthk2

Screencast.From.2026-05-14.12-25-56.mp4

@CoderOMaster

Copy link
Copy Markdown
Collaborator

@SIDDHAARTHAA I dont see the ingestion pipeline in the demo and only pytests passing

@CoderOMaster CoderOMaster requested review from Copilot and removed request for yatharthk2 June 15, 2026 10:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Unstructured + Moss” cookbook that demonstrates parsing raw files with Unstructured, chunking extracted content, preserving metadata, and incrementally upserting stable chunk IDs into a Moss index (with an optional post-ingestion query).

Changes:

  • Added a runnable ingestion script (ingest.py) that partitions files, chunks content, attaches normalized metadata, and upserts batches into Moss.
  • Added cookbook documentation + environment template + sample documents for a quick start.
  • Added a lightweight unittest-based smoke/integration test that stubs external dependencies to validate chunk IDs/metadata and batch upsert behavior.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
examples/cookbook/unstructured/ingest.py Implements the end-to-end ingestion + upsert + query flow for Unstructured → Moss.
examples/cookbook/unstructured/README.md Documents setup, usage, and stored document shape/ID strategy.
examples/cookbook/unstructured/pyproject.toml Declares cookbook dependencies and build packaging metadata.
examples/cookbook/unstructured/.env.example Provides required Moss environment variable template.
examples/cookbook/unstructured/test_integration.py Adds smoke tests for metadata normalization/stable IDs and upsert batching behavior.
examples/cookbook/unstructured/sample_docs/onboarding.html Sample HTML input document for ingestion.
examples/cookbook/unstructured/sample_docs/release-notes.txt Sample text input document for ingestion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to +85
_PREVIOUS_MODULES = _install_dependency_stubs()

ingest = importlib.import_module("ingest")

_restore_modules(_PREVIOUS_MODULES)

Comment on lines +159 to +168
try:
await client.create_index(index_name, batches[0])
print(f"Created index '{index_name}' with {len(batches[0])} chunks")
start = 1
except RuntimeError as exc:
if "already exists" not in str(exc).lower():
raise
print(f"Index '{index_name}' already exists; upserting chunks")
start = 0

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.

[Feature] : Add a cookbook using Unstructured with Moss

5 participants