Unverified Commit 8a63d220 authored by Timothy Jaeryang Baek's avatar Timothy Jaeryang Baek Committed by GitHub
Browse files

Merge pull request #927 from sakkus-ai/fix-openai-integration

Fix OpenAI integration: allow OpenAI to make chat completion calls with a valid API key
parents f347d664 781be277
...@@ -146,6 +146,13 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)): ...@@ -146,6 +146,13 @@ async def proxy(path: str, request: Request, user=Depends(get_verified_user)):
body["max_tokens"] = 4000 body["max_tokens"] = 4000
print("Modified body_dict:", body) print("Modified body_dict:", body)
# Fix for ChatGPT calls failing because the num_ctx key is in body
if "num_ctx" in body:
# If 'num_ctx' is in the dictionary, delete it
# Leaving it there generates an error with the
# OpenAI API (Feb 2024)
del body["num_ctx"]
# Convert the modified body back to JSON # Convert the modified body back to JSON
body = json.dumps(body) body = json.dumps(body)
except json.JSONDecodeError as e: except json.JSONDecodeError as e:
......
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