File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -66,6 +66,9 @@ def run(self, messages):
66
66
And then processing its output, whether it's a function or non function calling model, into LMC format.
67
67
"""
68
68
69
+ if not self ._is_loaded :
70
+ self .load ()
71
+
69
72
if (
70
73
self .max_tokens is not None
71
74
and self .context_window is not None
@@ -357,6 +360,17 @@ def load(self):
357
360
358
361
# Validate LLM should be moved here!!
359
362
363
+ if self .context_window == None :
364
+ try :
365
+ model_info = litellm .get_model_info (model = self .model )
366
+ self .context_window = model_info ["max_input_tokens" ]
367
+ if self .max_tokens == None :
368
+ self .max_tokens = min (
369
+ int (self .context_window * 0.2 ), model_info ["max_output_tokens" ]
370
+ )
371
+ except :
372
+ pass
373
+
360
374
self ._is_loaded = True
361
375
362
376
You can’t perform that action at this time.
0 commit comments