Commit 83181b79 authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

fix: add max_token only when field not present

parent b26e0fb7
...@@ -87,6 +87,7 @@ async def proxy(path: str, request: Request, user=Depends(get_current_user)): ...@@ -87,6 +87,7 @@ 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":
if "max_tokens" not in body:
body["max_tokens"] = 4000 body["max_tokens"] = 4000
print("Modified body_dict:", body) print("Modified body_dict:", body)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment