Commit 415a614
authored
feat(providers): add OpenAI API package and migrate capabilities to mixins (withceleste#82)
* feat(providers): add OpenAI API package
Add standalone provider package for OpenAI APIs with mixin pattern
for capability-agnostic reuse across multiple endpoints.
## Images API (OpenAIImagesClient)
- HTTP POST/streaming to /v1/images/generations endpoint
- Supports DALL-E 2/3 (b64_json format) and gpt-image-1 (streaming)
- Usage parsing: input_tokens, output_tokens, total_tokens
- Content extraction from data array
- Revised prompt handling in metadata
## Responses API (OpenAIResponsesClient)
- HTTP POST/streaming to /v1/responses endpoint
- Unified API for text generation capabilities
- Usage parsing with cached and reasoning tokens support
- Content extraction from output array
- Finish reason mapping (completed status)
## Videos API (OpenAIVideosClient)
- Async polling workflow for video generation
- Phase 1: POST to /v1/videos to create job
- Phase 2: Poll GET /v1/videos/{id} until completed/failed
- Phase 3: GET /v1/videos/{id}/content to retrieve video
- Usage parsing: billing units (seconds)
- Multipart request support for input_reference images
## Audio API (OpenAIAudioClient)
- HTTP POST to /v1/audio/speech endpoint
- Binary audio response handling
- Response format mapping (mp3, opus, aac, flac, wav, pcm)
- MIME type conversion to AudioMimeType
All clients follow the mixin pattern for reuse across capabilities.
* fix(providers): add _parse_usage to GoogleVeoClient
Add _parse_usage method to GoogleVeoClient to resolve mypy type checking error.
GoogleVeoClient was missing this implementation, causing unsafe super() call
in GoogleVideoGenerationClient.
Google Veo API doesn't return usage data in the response, so this method
returns an empty dict that capability clients can wrap in their Usage type.
* refactor(speech-generation): rename RESPONSE_FORMAT to OUTPUT_FORMAT
Standardize parameter naming across speech generation capability.
Changes unified parameter name from RESPONSE_FORMAT to OUTPUT_FORMAT
to match enum definition and be more consistent with other capabilities.
Breaking change: Updates parameter name in:
- SpeechGenerationParameter enum
- SpeechGenerationParameters class
- All ElevenLabs models (9 occurrences)
- All OpenAI models (3 occurrences)
- Provider parameter mappers
* refactor(image-generation): migrate OpenAI and Google to provider mixins
Migrate image generation capability clients to use provider package mixins,
eliminating code duplication and centralizing API-specific logic.
## Changes
- OpenAI client now inherits from OpenAIImagesClient mixin
- Parameter mappers inherit from provider package mappers
- Google client uses super()._parse_usage() pattern
- Remove unused config.py file (config now in provider package)
- Remove revised_prompt handling from provider mixin (handled in capability)
## Code Reduction
- ~188 lines removed across client and parameter files
- Significant deduplication of HTTP request logic
* refactor(speech-generation): migrate OpenAI and ElevenLabs to provider mixins
Migrate speech generation capability clients to use provider package mixins,
eliminating code duplication and centralizing API-specific logic.
## Changes
- OpenAI client now inherits from OpenAIAudioClient mixin
- Parameter mappers inherit from provider package mappers
- Add SpeechGenerationFinishReason type for consistency
- Remove unused config.py file (config now in provider package)
- Update _create_inputs to use parameters.get() pattern
- Simplify VoiceConstraint docstring
- Update tests to reflect new structure
## Code Reduction
- ~187 lines removed across client and parameter files
- Significant deduplication of HTTP request and parameter mapping logic
* refactor(video-generation): migrate OpenAI and Google to provider mixins
Migrate video generation capability clients to use provider package mixins,
eliminating code duplication and centralizing API-specific logic.
## Changes
- OpenAI client now inherits from OpenAIVideosClient mixin
- Parameter mappers inherit from provider package mappers
- Google client uses super()._parse_usage() pattern (after Commit 1 fix)
- Remove unused config.py file (config now in provider package)
- Remove async polling logic (now in provider mixin)
- Simplify _parse_usage to use mixin's implementation
## Code Reduction
- ~178 lines removed across client and parameter files
- Significant deduplication of HTTP request and polling logic
* refactor(text-generation): migrate OpenAI to provider mixins and remove config files
Migrate text generation capability client to use provider package mixins,
eliminating code duplication and centralizing API-specific logic.
## Changes
- OpenAI client now inherits from OpenAIResponsesClient mixin
- Parameter mappers inherit from provider package mappers
- Streaming class inherits from OpenAIResponsesStream mixin
- Remove unused config.py file (config now in provider package)
- Simplify _parse_content to use mixin's output array parsing
- Simplify _parse_finish_reason to use mixin's implementation
## Code Reduction
- ~429 lines removed across client, parameters, and streaming files
- Significant deduplication of HTTP request, streaming, and schema logic
* fix(capabilities): add celeste-openai dependency to all capabilities
Add celeste-openai to [tool.uv.sources] in all capability packages that
now import from the OpenAI provider package after the mixin migration.
## Changes
- image-generation: Add celeste-openai (imports celeste_openai.images)
- speech-generation: Add celeste-openai (imports celeste_openai.audio)
- text-generation: Add celeste-openai (imports celeste_openai.responses)
- video-generation: Add celeste-openai (imports celeste_openai.videos)
This ensures workspace dependencies are properly declared for the
refactored capability clients that use OpenAI provider mixins.1 parent b6a514d commit 415a614
File tree
51 files changed
+1383
-924
lines changed- packages
- capabilities
- image-generation
- src/celeste_image_generation/providers
- google
- openai
- tests/integration_tests/test_image_generation
- speech-generation
- src/celeste_speech_generation
- providers
- elevenlabs
- openai
- tests/integration_tests/test_speech_generation
- text-generation
- src/celeste_text_generation/providers
- google
- openai
- video-generation
- src/celeste_video_generation/providers
- google
- openai
- providers
- google/src/celeste_google/veo
- openai
- src/celeste_openai
- audio
- images
- responses
- videos
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
51 files changed
+1383
-924
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | | - | |
| 42 | + | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| |||
Lines changed: 9 additions & 63 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
6 | 5 | | |
7 | | - | |
| 6 | + | |
8 | 7 | | |
9 | 8 | | |
10 | | - | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | | - | |
21 | 18 | | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
25 | | - | |
| 22 | + | |
26 | 23 | | |
27 | 24 | | |
28 | 25 | | |
| |||
44 | 41 | | |
45 | 42 | | |
46 | 43 | | |
47 | | - | |
| 44 | + | |
| 45 | + | |
48 | 46 | | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
52 | 50 | | |
53 | 51 | | |
54 | 52 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 53 | + | |
| 54 | + | |
60 | 55 | | |
61 | 56 | | |
62 | 57 | | |
| |||
73 | 68 | | |
74 | 69 | | |
75 | 70 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
106 | 74 | | |
107 | 75 | | |
108 | 76 | | |
109 | 77 | | |
110 | 78 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | 79 | | |
134 | 80 | | |
Lines changed: 0 additions & 10 deletions
This file was deleted.
packages/capabilities/image-generation/src/celeste_image_generation/providers/openai/parameters.py
Lines changed: 14 additions & 97 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
2 | 12 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | 13 | | |
7 | 14 | | |
8 | 15 | | |
9 | 16 | | |
10 | | - | |
11 | | - | |
12 | | - | |
| 17 | + | |
13 | 18 | | |
14 | 19 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | 20 | | |
| 21 | + | |
47 | 22 | | |
48 | 23 | | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 24 | | |
| 25 | + | |
79 | 26 | | |
80 | 27 | | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | 28 | | |
112 | 29 | | |
113 | 30 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 41 | + | |
45 | 42 | | |
46 | 43 | | |
47 | 44 | | |
48 | 45 | | |
| 46 | + | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
Lines changed: 1 addition & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
| 11 | + | |
15 | 12 | | |
16 | 13 | | |
17 | 14 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| 39 | + | |
37 | 40 | | |
38 | 41 | | |
39 | 42 | | |
| |||
0 commit comments