Spaces:
Runtime error
Runtime error
Update apis/chat_api.py
Browse files- apis/chat_api.py +0 -31
apis/chat_api.py
CHANGED
|
@@ -147,37 +147,6 @@ class ChatAPIApp:
|
|
| 147 |
except Exception as e:
|
| 148 |
raise HTTPException(status_code=500, detail=str(e))
|
| 149 |
|
| 150 |
-
|
| 151 |
-
class ChatCompletionsPostItem(BaseModel):
|
| 152 |
-
model: str = Field(
|
| 153 |
-
default="nous-mixtral-8x7b",
|
| 154 |
-
description="(str) `nous-mixtral-8x7b`",
|
| 155 |
-
)
|
| 156 |
-
messages: list = Field(
|
| 157 |
-
default=[{"role": "user", "content": "Hello, who are you?"}],
|
| 158 |
-
description="(list) Messages",
|
| 159 |
-
)
|
| 160 |
-
temperature: Union[float, None] = Field(
|
| 161 |
-
default=0.5,
|
| 162 |
-
description="(float) Temperature",
|
| 163 |
-
)
|
| 164 |
-
top_p: Union[float, None] = Field(
|
| 165 |
-
default=0.95,
|
| 166 |
-
description="(float) top p",
|
| 167 |
-
)
|
| 168 |
-
max_tokens: Union[int, None] = Field(
|
| 169 |
-
default=-1,
|
| 170 |
-
description="(int) Max tokens",
|
| 171 |
-
)
|
| 172 |
-
use_cache: bool = Field(
|
| 173 |
-
default=False,
|
| 174 |
-
description="(bool) Use cache",
|
| 175 |
-
)
|
| 176 |
-
stream: bool = Field(
|
| 177 |
-
default=True,
|
| 178 |
-
description="(bool) Stream",
|
| 179 |
-
)
|
| 180 |
-
|
| 181 |
def chat_completions_ollama(
|
| 182 |
self, item: ChatCompletionsPostItem, api_key: str = Depends(extract_api_key)
|
| 183 |
):
|
|
|
|
| 147 |
except Exception as e:
|
| 148 |
raise HTTPException(status_code=500, detail=str(e))
|
| 149 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
def chat_completions_ollama(
|
| 151 |
self, item: ChatCompletionsPostItem, api_key: str = Depends(extract_api_key)
|
| 152 |
):
|