Update app/llm.py
Browse files- app/llm.py +3 -2
app/llm.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import fastapi
|
2 |
from fastapi.responses import JSONResponse
|
|
|
3 |
from time import time
|
4 |
#from fastapi.middleware.cors import CORSMiddleware
|
5 |
#MODEL_PATH = "./qwen1_5-0_5b-chat-q4_0.gguf" #"./qwen1_5-0_5b-chat-q4_0.gguf"
|
@@ -72,7 +73,7 @@ def health():
|
|
72 |
|
73 |
# Chat Completion API
|
74 |
@llm_router.post("/chat/", tags=["llm"])
|
75 |
-
async def chat(chatm:ChatModel, user:
|
76 |
try:
|
77 |
st = time()
|
78 |
output = llm_chat.create_chat_completion(
|
@@ -95,7 +96,7 @@ async def chat(chatm:ChatModel, user: User = fastapi.Depends(current_active_user
|
|
95 |
|
96 |
# Chat Completion API
|
97 |
@llm_router.post("/generate", tags=["llm"])
|
98 |
-
async def generate(gen:GenModel, user:
|
99 |
gen.system = "You are an helpful medical AI assistant."
|
100 |
gen.temperature = 0.5
|
101 |
gen.seed = 42
|
|
|
1 |
import fastapi
|
2 |
from fastapi.responses import JSONResponse
|
3 |
+
from fastapi_users import models
|
4 |
from time import time
|
5 |
#from fastapi.middleware.cors import CORSMiddleware
|
6 |
#MODEL_PATH = "./qwen1_5-0_5b-chat-q4_0.gguf" #"./qwen1_5-0_5b-chat-q4_0.gguf"
|
|
|
73 |
|
74 |
# Chat Completion API
|
75 |
@llm_router.post("/chat/", tags=["llm"])
|
76 |
+
async def chat(chatm:ChatModel, user: models.BaseUser = fastapi.Depends(current_active_user)):
|
77 |
try:
|
78 |
st = time()
|
79 |
output = llm_chat.create_chat_completion(
|
|
|
96 |
|
97 |
# Chat Completion API
|
98 |
@llm_router.post("/generate", tags=["llm"])
|
99 |
+
async def generate(gen:GenModel, user: models.BaseUser = fastapi.Depends(current_active_user)):
|
100 |
gen.system = "You are an helpful medical AI assistant."
|
101 |
gen.temperature = 0.5
|
102 |
gen.seed = 42
|