Add draft, attachment, and RAG example scripts - #1
Merged
Merged
Conversation
Three new runnable examples cover the surfaces the existing send_one_email script didn't: draft create/update/send, base64 attachment round-trip, and loader/retriever search over an inbox (with an optional semantic path). send_one_email is refactored to share the same run()/main() shape so all four examples are unit-testable. Adds tests/unit_tests/test_examples.py driving each example's run helper with a mocked SDK — no network or LLM calls required.
The setup-uv@v3 action defaults to caching off **/uv.lock, which this repo doesn't ship. Every CI run since the 0.2.0 workflow landed has failed at the setup-uv step before any code ran. Pointing the cache dependency glob at pyproject.toml lets the action build a cache key from our deps source of truth and unblocks the matrix.
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.
Summary
examples/:draft_workflow.py— create → update → send a draft (covers the three draft-tool verbs).attachment_demo.py— outbound base64SendAttachmentSpecand inbound presigned-URL download.rag_inbox.py— keyword search viaAgentMailRetriever, plus an opt-in semantic path that pipesAgentMailLoader().load()intoInMemoryVectorStore+ OpenAI (only runs whenOPENAI_API_KEYis set).examples/send_one_email.pyto split env wiring (main()) from the actual send call (run(client, ...)), matching the structure used by the new examples and making it unit-testable.tests/unit_tests/test_examples.py(7 tests) drives each example'srun()/helper against a mocked SDK — no network, no real keys, no LLM calls.Test plan
ruff check .— clean.pytest— 35 passed (28 existing + 7 new) in ~0.6s.python -c "import <example>".Summary by cubic
Add three runnable examples for drafts, attachments, and inbox RAG search, and refactor
send_one_emailfor consistency and testability. Includes unit tests that mock the SDK to run everything without network calls or real keys.New Features
examples/draft_workflow.py: create → update → send a draft.examples/attachment_demo.py: send base64 attachment viaSendAttachmentSpecand resolve a presigned download URL.examples/rag_inbox.py: keyword search withAgentMailRetriever; optional semantic path usingAgentMailLoader+ in-memory vectors with OpenAI whenOPENAI_API_KEYis set.Bug Fixes
setup-uv@v3to cache frompyproject.tomlto restore caching and unblock the matrix.Written for commit 4ca19ee. Summary will update on new commits. Review in cubic