Update app/llm.py
Browse files- app/llm.py +3 -2
app/llm.py
CHANGED
|
@@ -8,6 +8,7 @@ import llama_cpp
|
|
| 8 |
import llama_cpp.llama_tokenizer
|
| 9 |
from pydantic import BaseModel
|
| 10 |
from fastapi import APIRouter
|
|
|
|
| 11 |
|
| 12 |
class GenModel(BaseModel):
|
| 13 |
question: str
|
|
@@ -71,7 +72,7 @@ def health():
|
|
| 71 |
|
| 72 |
# Chat Completion API
|
| 73 |
@llm_router.post("/chat/", tags=["llm"])
|
| 74 |
-
async def chat(chatm:ChatModel):
|
| 75 |
try:
|
| 76 |
st = time()
|
| 77 |
output = llm_chat.create_chat_completion(
|
|
@@ -94,7 +95,7 @@ async def chat(chatm:ChatModel):
|
|
| 94 |
|
| 95 |
# Chat Completion API
|
| 96 |
@llm_router.post("/generate", tags=["llm"])
|
| 97 |
-
async def generate(gen:GenModel):
|
| 98 |
gen.system = "You are an helpful medical AI assistant."
|
| 99 |
gen.temperature = 0.5
|
| 100 |
gen.seed = 42
|
|
|
|
| 8 |
import llama_cpp.llama_tokenizer
|
| 9 |
from pydantic import BaseModel
|
| 10 |
from fastapi import APIRouter
|
| 11 |
+
from users import current_active_user
|
| 12 |
|
| 13 |
class GenModel(BaseModel):
|
| 14 |
question: str
|
|
|
|
| 72 |
|
| 73 |
# Chat Completion API
|
| 74 |
@llm_router.post("/chat/", tags=["llm"])
|
| 75 |
+
async def chat(chatm:ChatModel, user: User = Depends(current_active_user)):
|
| 76 |
try:
|
| 77 |
st = time()
|
| 78 |
output = llm_chat.create_chat_completion(
|
|
|
|
| 95 |
|
| 96 |
# Chat Completion API
|
| 97 |
@llm_router.post("/generate", tags=["llm"])
|
| 98 |
+
async def generate(gen:GenModel, user: User = Depends(current_active_user)):
|
| 99 |
gen.system = "You are an helpful medical AI assistant."
|
| 100 |
gen.temperature = 0.5
|
| 101 |
gen.seed = 42
|