feat: add save_to to classify and section#91
Open
mikesoennichsen wants to merge 2 commits into
Open
Conversation
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>
Contributor
There was a problem hiding this comment.
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 = Nonewiring toclassify()andsection()in bothLandingAIADEandAsyncLandingAIADE. - Persist responses via
_get_input_filename()+_save_response()to produce consistent auto-generated filenames or honor explicit.jsonpaths. - Expand
tests/test_save_to.pyto 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.
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>
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
Wires
save_tointo theclassifyandsectionmethods, both sync and async variants, mirroring the smart save_to behavior shipped forparse,extract, andsplitin PR #85.classify(..., save_to=DIR)→{input_stem}_classify_output.jsonclassify(..., save_to=path/to/file.json)→ exact path, parent dirs createdsection(..., 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_get_input_filenameand_save_responsehelpers — no new utility codeReuses the same
save_to: str | Path | None = Noneparameter signature and docstring stanza already onparse,extract,split.Test plan
classifyandsectionmethod names intests/test_save_to.pyfilename-format and redundant-prefix loopsclient.postand assert the file lands at the expected pathtests/test_save_to.pypass locally.jsonpath mode