feat: v1 architecture migration - modality-centric API#108
Conversation
This release migrates from capability-centric (v0.3.x) to modality-centric (v1) architecture. ## Architecture Shift - Clients now organized by output modality (text/images/audio/videos/embeddings) - Operations become methods on modality clients: generate, edit, analyze, embed, speak - Domain = resource you work with; Modality = output type - Cross-domain operations explicit: image/audio/video analysis → text modality ## Namespace API (recommended) - Domain-first entry points: celeste.text, celeste.images, celeste.audio, celeste.videos - One-line calls with IDE autocomplete: celeste.images.generate(model="...", prompt="...") - Execution modes: async default, .sync for blocking, .stream for streaming ## create_client (advanced) - Modality-first for explicit control: create_client(Modality.TEXT, Operation.GENERATE) - Full configuration and client reuse when needed ## Single Package Install - pip install celeste-ai (no extras required) - Removed multi-package structure (packages/ directory deleted) - Faster startup: no entry-point discovery - Simpler maintenance: one version, one release pipeline ## Provider Support - All providers bundled: OpenAI, Anthropic, Google, Mistral, Cohere, xAI, ElevenLabs, BFL, Gradium, BytePlus, DeepSeek, Groq, Moonshot - No heavyweight vendor SDKs - lightweight HTTP clients only ## New Operations - images.edit: Edit images with AI (OpenAI gpt-image-1) - images.analyze: Vision/image understanding → text output - audio.analyze: Audio transcription/understanding → text output - videos.analyze: Video understanding → text output ## API Changes - extra_body parameter for provider-specific options - Artifact API: get_bytes(), get_base64() replace to_data_url() - Structured outputs via JSON schema generators ## Files - Added: src/celeste/modalities/, src/celeste/namespaces/, src/celeste/providers/, src/celeste/utils/ - Removed: packages/, src/celeste/registry.py, src/celeste/utils.py - Updated: all core modules, tests, CI/CD workflows See CHANGELOG_V1.md for complete migration details.
Pull Request Review: v1 Architecture MigrationExecutive SummaryThis is a major architectural refactor that transitions from a capability-centric to a modality-centric design. The scope is substantial (18,751 additions, 8,960 deletions across 300+ files), representing a complete restructuring of the SDK. Overall, the architecture is well-designed, but there are several areas that need attention before merging. Recommendation: Approve with minor changes required. 🎯 Architecture ReviewStrengths
Concerns
🐛 Potential Bugs & Issues1. HTTP Client Event Loop Recreation (src/celeste/http.py)The CHANGELOG mentions:
Question: How is the event loop change detected? I didn't see the implementation in the diff. If you're caching clients by modality/provider globally, event loop changes in multi-loop scenarios could cause issues. Recommendation: Verify this is properly implemented or document the limitation. 2. Deep Merge Behavior (src/celeste/client.py:55-77)def _deep_merge(target: dict[str, Any], source: dict[str, Any]) -> dict[str, Any]:
for key, value in source.items():
if key in target and isinstance(target[key], dict) and isinstance(value, dict):
APIMixin._deep_merge(target[key], value)
else:
target[key] = value
return targetIssues:
Recommendation: Document the merge behavior clearly, or use a more defensive copy-based approach. 3. Model Resolution Logic (src/celeste/init.py:84-133)if model is None:
models = list_models(provider=provider, modality=modality, operation=operation)
if not models:
raise ModelNotFoundError(...)
return models[0] # Returns first model - deterministic?Question: Is the order of Recommendation: Document the selection criteria (alphabetical? priority-based?) or make it explicit. 4. Synchronous Namespace Pattern# namespaces/domains.py:139
return async_to_sync(self._client._predict)(inputs, **parameters)Using
Recommendation: Document that 🔒 Security ReviewStrengths✅ No dangerous patterns found:
✅ Proper secrets handling:
Recommendations
🧪 Test Coverage AssessmentCurrent State
Concerns
Test Quality (Spot Check)From the structure, tests appear well-organized: Recommendation: Consider adding:
⚡ Performance ConsiderationsPositive
Concerns
📦 Code Quality & Best PracticesStrengths✅ Excellent tooling setup:
✅ Code style:
✅ Architecture patterns:
Areas for Improvement
🔄 Migration & Backwards CompatibilityGood Practices✅ Deprecation warning for warnings.warn(
"capability parameter is deprecated, use modality/operation instead",
DeprecationWarning,
stacklevel=2,
)✅ Translation layer maintains compatibility: _CAPABILITY_TO_MODALITY_OPERATION = {
Capability.TEXT_GENERATION: (Modality.TEXT, Operation.GENERATE),
# ...
}Recommendations
📋 Specific File Commentssrc/celeste/init.py
src/celeste/client.py
src/celeste/namespaces/domains.py
src/celeste/credentials.py
pyproject.toml
🎯 Final RecommendationsMust Fix (Before Merge)
Should Fix (Before v1.0 Stable)
Nice to Have (Post v1.0)
✅ ConclusionThis is a well-architected refactor that significantly improves the SDK's design and developer experience. The modality-centric approach is intuitive, the type safety is excellent, and the namespace API is a major DX win. The main concerns are around:
None of these are blockers for a beta release (v0.9.0), but they should be addressed before v1.0 stable. Overall Assessment: 🟢 Approve with recommendations Great work on this major refactor! The architecture is solid and the migration path is well-thought-out. Address the testing and documentation gaps, and this will be a strong v1 release. Reviewed by: Claude Code (Sonnet 4.5) |
Summary
pip install celeste-ai(no extras required, removed multi-package structure)celeste.text,celeste.images,celeste.audio,celeste.videos) with.syncand.streamexecution modesimages.edit,images.analyze,audio.analyze,videos.analyzeKey Changes
Architecture
generate,edit,analyze,embed,speakAPI
create_client(Modality.TEXT, Operation.GENERATE)replaces capability-based client creationextra_bodyparameter for provider-specific optionsget_bytes(),get_base64()replaceto_data_url()Packaging
packages/directory (old multi-package workspace)Files
src/celeste/modalities/,src/celeste/namespaces/,src/celeste/providers/,src/celeste/utils/packages/,src/celeste/registry.py,src/celeste/utils.pyTest Plan
See
CHANGELOG_V1.mdfor complete migration details.