forked from open-webui/open-webui
		
	fix: add max_token only when field not present
This commit is contained in:
		
							parent
							
								
									b26e0fb7e7
								
							
						
					
					
						commit
						83181b7968
					
				
					 1 changed files with 2 additions and 1 deletions
				
			
		|  | @ -87,7 +87,8 @@ async def proxy(path: str, request: Request, user=Depends(get_current_user)): | ||||||
|         # Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000 |         # Check if the model is "gpt-4-vision-preview" and set "max_tokens" to 4000 | ||||||
|         # This is a workaround until OpenAI fixes the issue with this model |         # This is a workaround until OpenAI fixes the issue with this model | ||||||
|         if body.get("model") == "gpt-4-vision-preview": |         if body.get("model") == "gpt-4-vision-preview": | ||||||
|             body["max_tokens"] = 4000 |             if "max_tokens" not in body: | ||||||
|  |                 body["max_tokens"] = 4000 | ||||||
|             print("Modified body_dict:", body) |             print("Modified body_dict:", body) | ||||||
| 
 | 
 | ||||||
|         # Convert the modified body back to JSON |         # Convert the modified body back to JSON | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek