Create main.py
Browse files
main.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from Rag_Retriver import Vector_search, GPT_completion_with_vector_search
|
2 |
+
from fastapi import FastAPI
|
3 |
+
from pydantic import BaseModel
|
4 |
+
|
5 |
+
#Pydantic object
|
6 |
+
class validation(BaseModel):
|
7 |
+
prompt: str
|
8 |
+
|
9 |
+
#Fast API
|
10 |
+
app = FastAPI()
|
11 |
+
|
12 |
+
|
13 |
+
@app.post("/Gathnex_Rag_System")
|
14 |
+
async def retrival_augmented_generation(item: validation):
|
15 |
+
rag = Vector_search(item.prompt)
|
16 |
+
completion = GPT_completion_with_vector_search(item.prompt, rag)
|
17 |
+
return completion
|