refactor(py): remove files_before_body config and unify single-file guard#65
Merged
Merged
Conversation
chyroc
added a commit
to coze-dev/coze-py
that referenced
this pull request
Feb 26, 2026
## Summary
- sync generated Python SDK output after upstream optimization in
`coze-sdk-gen` for single-file upload rendering
- unify all single-file upload assignments to:
- `files = {"file": _try_fix_file(file)} if file else {}`
- this removes the previous inconsistency where required file fields
used unconditional assignment while optional file fields used
conditional assignment
## Generator change
- upstream generator PR:
coze-dev/coze-sdk-gen#65
## Changed SDK files
- cozepy/audio/transcriptions/__init__.py
- cozepy/audio/voices/__init__.py
- cozepy/audio/voiceprint_groups/__init__.py
- cozepy/audio/voiceprint_groups/features/__init__.py
## Validation
- from coze-sdk-gen repo:
- ./scripts/genpy.sh --output-sdk exist-repo/coze-py --ci-check
- coze-py checks passed in ci-check:
- poetry build
- poetry run ruff check cozepy
- poetry run ruff format --check
- poetry run mypy .
- poetry run pytest --cov --cov-report=xml
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Adjusted multipart handling across voiceprint groups, audio features,
transcriptions, and voice clone operations to include file data only
when a file is provided, reducing unnecessary payloads.
* **Chore**
* Minor internal cleanup improving request construction consistency.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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
if file else {}) for consistent behavior across required/optional file fieldsValidation
Downstream PR