1- from typing import Any , Dict , List
1+ from typing import Any , Dict , List , Optional
22from pydantic import BaseModel , ConfigDict
33import inspect
44import ast
55import textwrap
66from collections import OrderedDict
7+ from inferencesh .models .file import File
8+ from pydantic import Field
79
810
911class OrderedSchemaModel (BaseModel ):
@@ -91,4 +93,69 @@ async def run(self, app_input: BaseAppInput) -> BaseAppOutput:
9193 raise NotImplementedError ("run method must be implemented" )
9294
9395 async def unload (self ):
94- pass
96+ pass
97+
98+
99+ # Mixins
100+
101+ class OptionalImageFieldMixin (BaseModel ):
102+ image : Optional [File ] = Field (
103+ description = "the image to use for the model" ,
104+ default = None ,
105+ contentMediaType = "image/*" ,
106+ )
107+
108+ class RequiredImageFieldMixin (BaseModel ):
109+ image : File = Field (
110+ description = "the image to use for the model" ,
111+ contentMediaType = "image/*" ,
112+ )
113+
114+ class OptionalVideoFieldMixin (BaseModel ):
115+ video : Optional [File ] = Field (
116+ description = "the video to use for the model" ,
117+ default = None ,
118+ contentMediaType = "video/*" ,
119+ )
120+
121+ class RequiredVideoFieldMixin (BaseModel ):
122+ video : File = Field (
123+ description = "the video to use for the model" ,
124+ contentMediaType = "video/*" ,
125+ )
126+
127+ class OptionalAudioFieldMixin (BaseModel ):
128+ audio : Optional [File ] = Field (
129+ description = "the audio to use for the model" ,
130+ default = None ,
131+ contentMediaType = "audio/*" ,
132+ )
133+
134+ class RequiredAudioFieldMixin (BaseModel ):
135+ audio : File = Field (
136+ description = "the audio to use for the model" ,
137+ contentMediaType = "audio/*" ,
138+ )
139+
140+ class OptionalTextFieldMixin (BaseModel ):
141+ text : Optional [str ] = Field (
142+ description = "the text to use for the model" ,
143+ default = None ,
144+ )
145+
146+ class RequiredTextFieldMixin (BaseModel ):
147+ text : str = Field (
148+ description = "the text to use for the model" ,
149+ )
150+
151+ class OptionalFileFieldMixin (BaseModel ):
152+ file : Optional [File ] = Field (
153+ description = "the file to use for the model" ,
154+ default = None ,
155+ )
156+
157+ class RequiredFileFieldMixin (BaseModel ):
158+ file : Optional [File ] = Field (
159+ description = "the file to use for the model" ,
160+ default = None ,
161+ )
0 commit comments