Skip to content

feat: add save_to to classify and section#91

Open
mikesoennichsen wants to merge 2 commits into
mainfrom
feat/classify-section-save-to
Open

feat: add save_to to classify and section#91
mikesoennichsen wants to merge 2 commits into
mainfrom
feat/classify-section-save-to

Conversation

@mikesoennichsen

Copy link
Copy Markdown
Contributor

Summary

Wires save_to into the classify and section methods, both sync and async variants, mirroring the smart save_to behavior shipped for parse, extract, and split in PR #85.

  • classify(..., save_to=DIR){input_stem}_classify_output.json
  • classify(..., save_to=path/to/file.json) → exact path, parent dirs created
  • section(..., save_to=DIR) with parsed-markdown string → section_output.json (no redundant prefix)
  • section(..., save_to=DIR) with named markdown file/Path → {stem}_section_output.json
  • Reuses existing _get_input_filename and _save_response helpers — no new utility code

Reuses the same save_to: str | Path | None = None parameter signature and docstring stanza already on parse, extract, split.

Test plan

  • Existing parse/extract/split save_to unit tests still pass
  • New parameterized assertions cover classify and section method names in tests/test_save_to.py filename-format and redundant-prefix loops
  • 6 new wire-up tests (4 async + 2 sync) mock client.post and assert the file lands at the expected path
  • All 35 tests in tests/test_save_to.py pass locally
  • Live integration (staging via sdk-testing): 7/7 — sync + async classify + section, both directory mode and full .json path mode

Mirrors the smart save_to wire-up (PR #85) for the new classify and
section endpoints. Both sync and async variants accept save_to: str |
Path | None, with the same directory + full-.json-path behavior already
shipped for parse, extract, and split. Reuses the existing
_get_input_filename and _save_response helpers — no new utility code.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 29, 2026 20:13

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 save_to support to the classify and section client methods (sync + async), aligning them with the existing “smart save_to” behavior used by parse, extract, and split.

Changes:

  • Add save_to: str | Path | None = None wiring to classify() and section() in both LandingAIADE and AsyncLandingAIADE.
  • Persist responses via _get_input_filename() + _save_response() to produce consistent auto-generated filenames or honor explicit .json paths.
  • Expand tests/test_save_to.py to cover filename formatting for the new method names and add new sync/async save_to wire-up tests.

Reviewed changes

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

File Description
src/landingai_ade/_client.py Adds save_to parameters and response-saving behavior to classify/section (sync + async).
tests/test_save_to.py Extends save_to helper tests for new method names and adds new sync/async classify/section save_to tests.

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

Comment thread src/landingai_ade/_client.py
Comment thread src/landingai_ade/_client.py
Comment thread tests/test_save_to.py
Comment thread tests/test_save_to.py
Comment thread src/landingai_ade/_client.py
Comment thread src/landingai_ade/_client.py
Ruff was complaining about an unsorted import block in tests/test_save_to.py.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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