Skip to content

Commit 041a6b4

Browse files
committed
Convert url to objref in openai image generations
1 parent 1c67549 commit 041a6b4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

llmstack/processors/providers/openai/images_generations.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class ImagesGenerationsConfiguration(ApiProcessorSchema):
9898
class ImagesGenerations(
9999
ApiProcessorInterface[ImagesGenerationsInput, ImagesGenerationsOutput, ImagesGenerationsConfiguration],
100100
):
101-
102101
"""
103102
OpenAI Images Generations API
104103
"""
@@ -136,6 +135,11 @@ def process(self) -> dict:
136135
response_format=self._config.response_format,
137136
)
138137

138+
# Convert images to objrefs
139+
for image in result.data:
140+
if image.url:
141+
image.url = self._upload_asset_from_url(asset=image.url)
142+
139143
async_to_sync(self._output_stream.write)(
140144
ImagesGenerationsOutput(
141145
data=[image.b64_json or image.url for image in result.data],

0 commit comments

Comments
 (0)