Spaces:
Running
Running
Upload 2 files
Browse files
main.py
CHANGED
@@ -847,16 +847,16 @@ def v1beta3_google_ai(
|
|
847 |
@app.post("/ryuzaki/beta-rag", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
848 |
def beta_rag(item: BetaRags):
|
849 |
try:
|
850 |
-
|
851 |
-
token=HUGGING_TOKEN,
|
852 |
user_id=item.user_id,
|
853 |
-
mongo_url=
|
854 |
)
|
855 |
cybersecuritydb(item.user_id, item.mongo_url)
|
856 |
-
|
857 |
return SuccessResponse(
|
858 |
status="True",
|
859 |
-
randydev={"message":
|
860 |
)
|
861 |
except Exception as e:
|
862 |
return SuccessResponse(status="False", randydev={"message": str(e)})
|
|
|
847 |
@app.post("/ryuzaki/beta-rag", response_model=SuccessResponse, responses={422: {"model": ErrorStatus}})
|
848 |
def beta_rag(item: BetaRags):
|
849 |
try:
|
850 |
+
x = BetaRag(
|
851 |
+
token=str(HUGGING_TOKEN),
|
852 |
user_id=item.user_id,
|
853 |
+
mongo_url=MONGO_URL
|
854 |
)
|
855 |
cybersecuritydb(item.user_id, item.mongo_url)
|
856 |
+
response = x.rag_chat(item.query)
|
857 |
return SuccessResponse(
|
858 |
status="True",
|
859 |
+
randydev={"message": response}
|
860 |
)
|
861 |
except Exception as e:
|
862 |
return SuccessResponse(status="False", randydev={"message": str(e)})
|
models.py
CHANGED
@@ -71,7 +71,6 @@ class ChatgptCustom(BaseModel):
|
|
71 |
|
72 |
class BetaRags(BaseModel):
|
73 |
query: str
|
74 |
-
mongo_url: Optional[str] = None
|
75 |
user_id: Optional[int] = None
|
76 |
|
77 |
class GeminiPro(BaseModel):
|
|
|
71 |
|
72 |
class BetaRags(BaseModel):
|
73 |
query: str
|
|
|
74 |
user_id: Optional[int] = None
|
75 |
|
76 |
class GeminiPro(BaseModel):
|