Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

AI Automation for Developers

GitHub Twitter @data4sci GitHub top language GitHub repo size GitHub last commit

Substack Data Science Briefing

Code and slides to accompany the online webinar by Data For Science.

LLMs are good at a surprising amount of the tedious work that fills a normal week — pulling structured fields out of free text, summarizing long documents, running multi-step reviews, and answering questions over a knowledge base. This webinar walks through four end-to-end Jupyter notebooks that show how to build each of those workflows with LangChain, CrewAI, and Anthropic's Claude, with practical guardrails, schemas, and evaluation patterns you can lift straight into your own projects.

Contents

This tutorial is divided into four parts:

1. Structured Extraction

  • LLM Review
  • LangChain Deep dive
  • Pydantic schema planning
  • JSON validation loop
  • Prompt guardrail patterns

Notebook: 1. Structured Extraction.ipynb

Turns free-form job descriptions (from the Hugging Face jacob-hugging-face/job-descriptions dataset) into validated, typed records. A Pydantic JobPosting schema is the single source of truth: it uses explicit nullability, Literal enums, and validators whose error messages flow back to the model. A LangChain chain pairs a guardrailed system prompt (extract only what's in the source, flag non-job content) with PydanticOutputParser. When output fails to parse or validate, a self-healing loop re-prompts with the exact error. The notebook runs a sample with progress tracking and failure logging, sanity-checks the results by plotting the top skills and the seniority distribution, and ends with adversarial inputs (a news article, a prompt injection, and a recipe) to test the guardrails.

2. Summarization

  • Action-item templates
  • Router prompts
  • Misclassification auditing

Notebook: 2. Summarization.ipynb

Triages long arXiv papers streamed from the ccdv/arxiv-summarization dataset. First, an action-item template turns a paper summary into a structured PaperBrief: a summary, up to five typed action items (e.g. try-method, replicate-experiment) with priorities, and open questions, ready for downstream automation. Next, a router prompt with a shared rubric and few-shot examples classifies each paper as theory, experimental, or survey and sends it to a specialist summarizer, because a theory paper summarized with an applied template tends to come back with invented datasets and metrics. An auditor re-asks the classification question using the same rubric to catch misroutes.

3. Agents

  • Agent review
  • CrewAI DeepDive
  • Researcher/Writer pipeline
  • Synchronous and Asynchronous crews
  • Compliance checklist creation

Notebook: 3. Agents.ipynb

A CrewAI multi-agent pipeline that audits real privacy policies (GitHub, DuckDuckGo, and Wikipedia, with an offline fallback) against an 8-item GDPR/CCPA compliance checklist. Three single-responsibility agents run as a sequential crew: a Privacy Researcher extracts quoted factual statements, a Compliance Officer maps them to checklist items as covered, partial, or missing, and an Audit Writer produces a one-page executive report with a verdict, the top gaps, and remediation steps. The notebook runs the crew synchronously, one policy at a time, then asynchronously with all policies in parallel, plots the speed difference, and writes the per-policy results to data/compliance_audits.json for downstream tools.

4. ChatBot

  • Embeddings
  • Vector Databases
  • Retrieval Augmented Generation
  • Tool integration
  • Interactive agent

Notebook: 4. ChatBot.ipynb

A laptop-friendly RAG chatbot over the rag-datasets/rag-mini-wikipedia corpus (~3,200 passages). Passages are embedded locally with all-MiniLM-L6-v2 (no extra API key) and stored in an in-memory Chroma collection. A plain RAG chain answers only from the retrieved passages, cites them by number, and says when it doesn't know; it is evaluated on the bundled Q&A split with exact-match and substring-match scores. The notebook then adds tools (wiki_search, calculator, and now) and builds an interactive tool-calling agent that decides on each turn whether to search, compute, or check the time.

Slides for the webinar live in slides/AIAutomation.pdf.

References

Setup

Install uv if you don't have it yet:

curl -LsSf https://astral.sh/uv/install.sh | sh

Install dependencies and launch Jupyter:

uv sync
uv run jupyter notebook

Set your Anthropic API key before running the notebooks:

export ANTHROPIC_API_KEY=sk-ant-...

Author

Bruno Gonçalves

Bruno Gonçalves

Data For Science, Inc.

Web: www.data4sci.com
Twitter/X: @bgoncalves
LinkedIn: @bmtgoncalves
Email: info@data4sci.com
Schedule a Call: https://data4sci.com/call

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages