Almaatla commited on
Commit
2687a93
·
verified ·
1 Parent(s): 1bb95e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -8,6 +8,9 @@ from typing import List, Optional
8
  import uuid
9
  import time
10
  import asyncio
 
 
 
11
 
12
  class ChatMessage(BaseModel):
13
  role: str
@@ -361,7 +364,7 @@ async def get_proxy():
361
  @app.post("/v1/chat/completions", response_model=ChatCompletionResponse)
362
  async def chat_completions(
363
  request: ChatCompletionRequest,
364
- authorization: str | None = Header(None) # Add Authorization header
365
  ):
366
  # Extract and validate API key
367
  if not authorization or not authorization.startswith("Bearer "):
 
8
  import uuid
9
  import time
10
  import asyncio
11
+ from typing import Optional
12
+ # Modern Python (3.10+) with Annotated
13
+ from typing import Annotated
14
 
15
  class ChatMessage(BaseModel):
16
  role: str
 
364
  @app.post("/v1/chat/completions", response_model=ChatCompletionResponse)
365
  async def chat_completions(
366
  request: ChatCompletionRequest,
367
+ authorization: Annotated[Optional[str], Header()] = None # Correct format
368
  ):
369
  # Extract and validate API key
370
  if not authorization or not authorization.startswith("Bearer "):