File tree Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Expand file tree Collapse file tree 1 file changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -51,13 +51,21 @@ async def generate_with_context(
5151 formatted_messages .extend (messages )
5252
5353 # Set up generation parameters
54- params = {
55- "model" : self .model ,
56- "messages" : formatted_messages ,
57- "temperature" : kwargs .get ("temperature" , self .config .temperature ),
58- "top_p" : kwargs .get ("top_p" , self .config .top_p ),
59- "max_tokens" : kwargs .get ("max_tokens" , self .config .max_tokens ),
60- }
54+ if self .config .api_base == "https://api.openai.com/v1" and str (self .model ).lower ().startswith ("o" ):
55+ # For o-series models
56+ params = {
57+ "model" : self .model ,
58+ "messages" : formatted_messages ,
59+ "max_completion_tokens" : kwargs .get ("max_tokens" , self .config .max_tokens )
60+ }
61+ else :
62+ params = {
63+ "model" : self .model ,
64+ "messages" : formatted_messages ,
65+ "temperature" : kwargs .get ("temperature" , self .config .temperature ),
66+ "top_p" : kwargs .get ("top_p" , self .config .top_p ),
67+ "max_tokens" : kwargs .get ("max_tokens" , self .config .max_tokens ),
68+ }
6169
6270 # Attempt the API call with retries
6371 retries = kwargs .get ("retries" , self .config .retries )
You can’t perform that action at this time.
0 commit comments