Hansimov commited on
Commit
a54e7a6
1 Parent(s): 1b9f698

:boom: [Fix] Error 422 when max_tokens is null

Browse files
Files changed (1) hide show
  1. apis/chat_api.py +3 -2
apis/chat_api.py CHANGED
@@ -6,6 +6,7 @@ import uvicorn
6
  from fastapi import FastAPI, Depends
7
  from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
8
  from pydantic import BaseModel, Field
 
9
  from sse_starlette.sse import EventSourceResponse, ServerSentEvent
10
  from utils.logger import logger
11
  from networks.message_streamer import MessageStreamer
@@ -70,11 +71,11 @@ class ChatAPIApp:
70
  default=[{"role": "user", "content": "Hello, who are you?"}],
71
  description="(list) Messages",
72
  )
73
- temperature: float = Field(
74
  default=0,
75
  description="(float) Temperature",
76
  )
77
- max_tokens: int = Field(
78
  default=-1,
79
  description="(int) Max tokens",
80
  )
 
6
  from fastapi import FastAPI, Depends
7
  from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
8
  from pydantic import BaseModel, Field
9
+ from typing import Union
10
  from sse_starlette.sse import EventSourceResponse, ServerSentEvent
11
  from utils.logger import logger
12
  from networks.message_streamer import MessageStreamer
 
71
  default=[{"role": "user", "content": "Hello, who are you?"}],
72
  description="(list) Messages",
73
  )
74
+ temperature: Union[float, None] = Field(
75
  default=0,
76
  description="(float) Temperature",
77
  )
78
+ max_tokens: Union[int, None] = Field(
79
  default=-1,
80
  description="(int) Max tokens",
81
  )