Skip to content

Add the LangChain Advanced RAG, MCP, and Mastra partner cookbooks - #232

Merged
ninalopatina merged 3 commits into
mainfrom
add-langchain-mastra-partner-cookbooks
Oct 13, 2026
Merged

ninalopatina merged 3 commits into
mainfrom
add-langchain-mastra-partner-cookbooks

Conversation

@mohammaddaoudfarooqi

@mohammaddaoudfarooqi mohammaddaoudfarooqi commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

What this does

Moves the LangChain and Mastra cookbooks from mongodb-partners/partner-cookbooks into partners/:

  • partners/langchain/advanced-rag/ — 3 notebooks: vector, full-text, hybrid $rankFusion, reranking, $graphLookup, auto-embedding
  • partners/langchain/claude-code-mcp/ — 1 notebook: a LangGraph agent over the MongoDB MCP Server
  • partners/mastra/ — 4 TypeScript notebooks (tslab kernel): retrieval, bring-your-own collections, hybrid search, agents with persistent memory

Nothing that already exists in this repository is modified except partners/README.md, which gains three table rows and a short Mastra entry. partners/langchain/ existing content is untouched; the new sets sit beside it.

Commits

  1. Copy of partners/ at partner-cookbooks 56e1827, so the history shows what was imported. It is verbatim except partners/mastra/src/scrub.test.ts, whose fake credential fixtures are now assembled at runtime so GitGuardian does not flag them as live secrets.
  2. Adaptation to this repository:
    • Each set has its own .env.example (partners/langchain/, partners/mastra/) instead of a repository-root one. Both config loaders already walk up from the notebook's folder, so no loader logic changed.
    • Colab badges and the utils.py download URL point at mongodb-developer/GenAI-Showcase.
    • The Mastra credential scan (npm test) covers only these eight notebooks rather than every notebook in the repository, and it no longer treats documented tunables such as ANTHROPIC_MODEL as secrets.
    • Small .gitignores for node_modules/ and __pycache__/.
    • This repository's pre-commit formatting: ruff on the Python files and Python notebook cells, and widget state on all notebooks. Ruff does not touch the TypeScript notebooks.
  3. Refreshed outputs. All eight notebooks were re-executed from this repository against the pinned dependencies; the old Mastra outputs dated from @mastra/mongodb 1.15. The Mastra cells are now numbered, and a few prose passages that had drifted from their outputs are corrected.

Testing

All of the following ran from the new location on a branch checkout, against a live Atlas M0 cluster:

  • pre-commit run --all-files: every hook passes, no files modified
  • LangChain pytest test_utils.py: 29 passed
  • Mastra from a fresh npm ci, including the tokenizer prefetch: npm test 86 passed and the credential scan is clean; npm run typecheck is clean; npm run smoke gives 8 passed, 1 skipped by design (M0 index budget)
  • All 8 notebooks executed end to end with nbconvert --execute, with 0 errors. These are the committed outputs, each read against its notebook's prose.
  • The cluster was left as it was found: only movies_vector_index and movies_fulltext_index, no scratch collections

Notes

  • The Open in Colab badges and the utils.py fetch resolve once this is on main.
  • Dependabot will raise one moderate alert for sprintf-js (GHSA-hp3w-g68c-fv3c) in partners/mastra/package-lock.json. No patched version exists. partners/mastra/README.md explains why neither path to it is reachable.

@mohammaddaoudfarooqi
mohammaddaoudfarooqi requested a review from a team as a code owner October 13, 2026 21:53
@gitguardian

gitguardian Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@mohammaddaoudfarooqi
mohammaddaoudfarooqi force-pushed the add-langchain-mastra-partner-cookbooks branch from 685b590 to 23b7de1 Compare October 13, 2026 21:56
…-cookbooks

Copy of partners/ at 56e1827, verbatim except for scrub.test.ts, whose fake
credential fixtures are now assembled at runtime so secret scanners on this
repository do not flag them. Adapting the sets to this repository follows
in the next commit.
- Give each set its own .env.example (partners/langchain/, partners/mastra/)
  in place of the old repository-root file. Both config loaders already walk
  up from the notebook's folder, so they find it unchanged.
- Point the Colab badges and the utils.py download at this repository.
- Scope the Mastra output scan to these eight notebooks, and resolve the
  .env for it and the smoke test the same way the notebooks do.
- Stop the output scan from treating documented tunables (ANTHROPIC_MODEL
  and the like) as secrets; .env.example ships them filled in.
- List the new sets in partners/README.md.
- Apply this repository's pre-commit formatting (ruff, widget state).
@mohammaddaoudfarooqi
mohammaddaoudfarooqi force-pushed the add-langchain-mastra-partner-cookbooks branch from 23b7de1 to 3953ac1 Compare October 13, 2026 21:58
The committed Mastra outputs came from the @mastra/mongodb 1.15 run and the
MCP outputs from an older mongodb-mcp-server. All eight notebooks are now
re-executed from this repository with the pinned dependencies, on a cluster
holding only sample_mflix's own collections, so the LangChain listings no
longer show the Mastra set's store collections.

- Number the Mastra cells (scripts/number-cells.ts); tslab records none.
- Mastra 03: the rank-fusion table's prose now matches its numbers, using
  the Ewoks row as the worked example of a pool mismatch.
- Mastra 04: ask "Which of those three is the oldest?" rather than the
  ambiguous "older", and stop quoting the limit the model picks.
- LangChain 02: it creates only the full-text index; say so.
- LangChain 03: describe the auto-embedding scores as they are.
@ninalopatina
ninalopatina merged commit 95d4d67 into main Oct 13, 2026
3 checks passed
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