Skip to content

Commit

Permalink
fixing request
Browse files Browse the repository at this point in the history
  • Loading branch information
vemonet committed Jan 21, 2025
1 parent d13eacd commit 35af41d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/expasy-agent/src/expasy_agent/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,15 @@ def stream_dict(d: dict) -> str:

# @app.post("/chat/completions")
@app.post("/chat")
async def chat(request: ChatCompletionRequest):
async def chat(request: Request):
"""Chat with the assistant main endpoint."""
auth_header = request.headers.get("Authorization")
if settings.expasy_api_key and (not auth_header or not auth_header.startswith("Bearer ")):
raise ValueError("Missing or invalid Authorization header")
if settings.expasy_api_key and auth_header.split(" ")[1] != settings.expasy_api_key:
raise ValueError("Invalid API key")

# request = ChatCompletionRequest(**await request.json())
request = ChatCompletionRequest(**await request.json())
# request.messages = [msg for msg in request.messages if msg.role != "system"]
# request.messages = [Message(role="system", content=settings.system_prompt), *request.messages]

Expand Down

0 comments on commit 35af41d

Please sign in to comment.