File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -157,6 +157,9 @@ def _estimate_cost_in_cents(
157
157
+ Decimal (sampled_tokens ) * sampled_scale
158
158
) * Decimal ("100" )
159
159
160
+ def _supports_streaming (self ) -> bool :
161
+ return not self .model .startswith ("o1" )
162
+
160
163
def complete (self , messages : Sequence [Message ]) -> LLMResponse :
161
164
kwargs = {
162
165
"model" : self .model ,
@@ -228,11 +231,16 @@ def validate_api_params(self, params):
228
231
229
232
@property
230
233
def stream (self ) -> bool :
231
- return self ._stream
234
+ return self ._supports_streaming () and self . _stream
232
235
233
236
@stream .setter
234
237
def stream (self , val : bool ):
235
- self ._stream = val
238
+ if not self ._supports_streaming ():
239
+ raise NotImplementedError (
240
+ "Streamed responses are not supported by this model"
241
+ )
242
+ else :
243
+ self ._stream = val
236
244
237
245
@property
238
246
def valid_models (self ) -> Iterable [str ]:
You can’t perform that action at this time.
0 commit comments