Skip to content

refactor: rename BYTEDANCE to BYTEPLUS and migrate to provider mixins#84

Merged
Kamilbenkirane merged 4 commits into
mainfrom
api/byteplus_api
Dec 15, 2025
Merged

refactor: rename BYTEDANCE to BYTEPLUS and migrate to provider mixins#84
Kamilbenkirane merged 4 commits into
mainfrom
api/byteplus_api

Conversation

@Kamilbenkirane

Copy link
Copy Markdown
Member

Rename provider from 'bytedance' to 'byteplus' across the entire codebase and migrate capability clients to use provider package mixins.

Changes

Core Renames

  • Provider enum: BYTEDANCEBYTEPLUS in core.py
  • Credentials: bytedance_api_keybyteplus_api_key, BYTEDANCE_API_KEYBYTEPLUS_API_KEY
  • Package name: celeste_bytedanceceleste_byteplus

Capability Changes

  • Directory renames: bytedance/byteplus/ in both image and video generation capabilities
  • Class names: ByteDance*BytePlus* (clients, streams)
  • Variable names: BYTEDANCE_*BYTEPLUS_* (MODELS, PARAMETER_MAPPERS, etc.)
  • Provider references: Provider.BYTEDANCEProvider.BYTEPLUS throughout
  • Docstrings/comments: Updated all references from ByteDance to BytePlus
  • README files: Updated environment variable names (BYTEDANCE_API_KEYBYTEPLUS_API_KEY)
  • Tests: Updated integration tests to use Provider.BYTEPLUS
  • Keywords: Updated bytedancebyteplus in pyproject.toml

Provider Package Migration

  • Migrated clients to use provider package mixins:
    • BytePlusImageGenerationClient now extends BytePlusImagesClient
    • BytePlusVideoGenerationClient now extends BytePlusVideosClient
  • Removed redundant config.py files from capability packages
  • Configuration now centralized in provider package (celeste_byteplus.images.config, celeste_byteplus.videos.config)
  • Added celeste-byteplus workspace dependency to both capability packages

Additional Fixes

  • Fixed BFL provider value from "Black Forest Labs" to "bfl" to match lowercase convention

Rationale

Aligns provider naming with the actual API service (BytePlus) rather than the parent company name (ByteDance). The provider package was already named byteplus, so this change brings consistency across the codebase.

Breaking Changes

Yes - This is a breaking change:

  • Provider.BYTEDANCEProvider.BYTEPLUS
  • Environment variable: BYTEDANCE_API_KEYBYTEPLUS_API_KEY
  • All class names changed from ByteDance* to BytePlus*

Users will need to update their code to use the new enum value and environment variable name.

Testing

  • All CI checks pass ✅
  • All unit tests pass (295 tests)
  • Type checking passes
  • Linting and formatting pass

…plus

Rename provider directories from 'bytedance' to 'byteplus' in both
image-generation and video-generation capabilities to align with updated
naming convention.

## Changes
- Image generation: Rename bytedance/ → byteplus/ (7 files)
- Video generation: Rename bytedance/ → byteplus/ (7 files)
- Includes: README, __init__, client, config, models, parameters, streaming

This is a directory rename only. Import statements and enum references
will be updated in subsequent commits.
Update Provider enum, credentials, class names, variables, docstrings,
and all references from ByteDance/BYTEDANCE/bytedance to BytePlus/BYTEPLUS/byteplus.

## Core Changes
- Provider enum: BYTEDANCE → BYTEPLUS in core.py
- Credentials: bytedance_api_key → byteplus_api_key, BYTEDANCE_API_KEY → BYTEPLUS_API_KEY
- Package name: celeste_bytedance → celeste_byteplus

## Capability Changes
- Class names: ByteDance* → BytePlus* (clients, streams)
- Variable names: BYTEDANCE_* → BYTEPLUS_* (MODELS, PARAMETER_MAPPERS, etc.)
- Docstrings/comments: ByteDance → BytePlus
- Provider references: Provider.BYTEDANCE → Provider.BYTEPLUS
- README files: Update environment variable names and provider names
- Tests: Update Provider.BYTEDANCE → Provider.BYTEPLUS
- Keywords: bytedance → byteplus in pyproject.toml

## Files Updated
- Core: core.py, credentials.py
- Image generation: client, models, parameters, streaming, config, __init__, README
- Video generation: client, models, parameters, config, __init__, README
- Tests: integration tests for both capabilities
- Provider package: byteplus provider package files
…te to mixins

Remove unused config.py files from BytePlus capability providers and migrate
clients to use provider package mixins following the established pattern.

## Changes
- Remove image-generation/providers/byteplus/config.py
- Remove video-generation/providers/byteplus/config.py
- Migrate clients to use BytePlusImagesClient and BytePlusVideosClient mixins
- Add celeste-byteplus workspace dependency to both capability packages
- Simplify client implementations by delegating HTTP requests to mixins

Configuration is now centralized in the provider package (celeste_byteplus.images.config
and celeste_byteplus.videos.config) following the established pattern from
OpenAI, Mistral, and other providers.
Change BFL provider value from 'Black Forest Labs' to 'bfl' to match
the lowercase convention expected by all providers. This fixes the
test_all_providers_are_lowercase test failure.
@claude

claude Bot commented Dec 15, 2025

Copy link
Copy Markdown

Pull Request Review: Rename BYTEDANCE to BYTEPLUS and Migrate to Provider Mixins

Summary

This PR successfully accomplishes a major refactoring: renaming the provider from ByteDance to BytePlus and introducing a mixin-based architecture for code reuse. The changes are comprehensive, well-executed, and maintain consistency across the codebase.

Strengths

1. Excellent Architectural Improvement

The migration to provider package mixins (BytePlusImagesClient and BytePlusVideosClient) is a significant improvement:

  • DRY Principle: Eliminates code duplication by extracting shared HTTP client logic, usage parsing, and metadata building
  • Separation of Concerns: Provider-level mixins handle API communication while capability clients focus on domain-specific logic
  • Extensibility: Makes it easy to add new BytePlus-based capabilities in the future
  • Type Safety: The mixin pattern maintains proper typing through the inheritance chain

2. Thorough and Consistent Renaming

The rename from BYTEDANCE to BYTEPLUS is comprehensive across core enum, class names, environment variables, documentation, tests, and imports.

3. Clean Code Quality

  • Parameter mappers properly inherit from provider mixins with clear conflict resolution
  • Proper error handling with descriptive messages
  • Good use of type hints and docstrings
  • Follows existing code patterns

4. Breaking Change Documentation

Clear communication about breaking changes in the PR description with migration guide for users.

Areas for Consideration

1. BFL Provider Fix

The PR includes an additional fix changing BFL provider value from "Black Forest Labs" to "bfl". This could have been a separate commit or called out more prominently in the PR description as it is unrelated to the BytePlus rename.

2. Test Coverage - Integration Test Change

In test_generate.py (line 45), the test was modified to remove an explicit model parameter. This change is not mentioned in the PR description - clarify if this is intentional refactor or a fix.

3. Async Polling Implementation

The BytePlusVideosClient uses fixed 5-second polling intervals. Consider:

  • Making this configurable or using exponential backoff
  • Allowing users to customize timeout for long-running video generation tasks

4. Error Handling Enhancement

Consider creating custom exception classes (e.g., BytePlusAPIError) instead of generic ValueError for better debugging and alignment with existing exception hierarchy.

5. Documentation

Consider adding:

  • Migration examples showing before/after code snippets
  • Documentation of the new mixin architecture
  • Clarification that celeste-byteplus is now a separate package

Potential Issues

1. Missing Return Type Hint

In packages/providers/byteplus/src/celeste_byteplus/images/client.py line 84, _parse_content returns Any which loses type safety.

2. Code Duplication

Both BytePlusImagesClient and BytePlusVideosClient have _parse_usage methods with similar patterns. Consider extraction to common base.

Security Review

No security concerns identified:

  • Proper use of environment variables for API keys
  • No hardcoded credentials
  • Safe HTTP client usage with proper headers

Performance

  • Uses async/await properly
  • HTTP client reuse is good
  • Consider exponential backoff for polling

Testing

  • All 295 unit tests pass
  • Type checking passes
  • Integration test updated

Recommendations: Consider tests for mixin pattern and polling timeout behavior.

Final Recommendations

Must Address (Before Merge)

None - the PR is in good shape for merging

Should Address (Nice to Have)

  1. Clarify the model parameter removal in integration tests
  2. Document the BFL provider fix more prominently
  3. Consider custom exception types for better error handling

Future Enhancements

  1. Configurable polling intervals with exponential backoff
  2. More specific exception types for BytePlus-specific errors
  3. Migration guide in documentation

Conclusion

This is a well-executed refactoring that improves code quality and architecture. The mixin pattern is a significant improvement that will pay dividends in maintainability. The rename is thorough and consistent.

Recommendation: APPROVE with minor suggestions

The code is production-ready. The suggestions above are primarily for future enhancements rather than blockers. Great work on maintaining consistency across such a large refactoring!


Review generated with Claude Code

@Kamilbenkirane Kamilbenkirane merged commit e8f8b14 into main Dec 15, 2025
11 checks passed
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.

1 participant