Skip to content

Commit d922dd4

Browse files
Merge pull request #13 from workflowai/spatika/file-input
Syncing file input based updates
2 parents 5c89d1a + 567c168 commit d922dd4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

workflowai/core/domain/errors.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
"provider_unavailable",
3232
# The request timed out
3333
"read_timeout",
34+
# The requested model does not support the requested generation mode
35+
# (e-g a model that does not support images generation was sent an image)
36+
"model_does_not_support_mode",
3437
]
3538

3639
ErrorCode = Union[
@@ -43,9 +46,6 @@
4346
"no_provider_supporting_model",
4447
# The requested provider does not support the model
4548
"provider_does_not_support_model",
46-
# The requested model does not support the requested generation mode
47-
# (e-g a model that does not support images generation was sent an image)
48-
"model_does_not_support_mode",
4949
# Run properties are invalid, for example the model does not exist
5050
"invalid_run_properties",
5151
# An internal error occurred

workflowai/core/fields/file.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from pydantic import BaseModel, Field
2+
3+
4+
class File(BaseModel):
5+
name: str = Field(..., description="An optional name for the image")
6+
content_type: str = Field(..., description="The content type of the image", examples=["image/png", "image/jpeg"])
7+
data: str = Field(..., description="The base64 encoded data of the image")
8+
9+
def to_url(self) -> str:
10+
return f"data:{self.content_type};base64,{self.data}"

0 commit comments

Comments
 (0)