preparing search
Browse files
App/Embedding/EmbeddingRoutes.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from fastapi import APIRouter
|
2 |
from App.Transcription.Model import Transcriptions
|
3 |
from .utils.Initialize import generateChunks, encode, search
|
4 |
-
|
5 |
embeddigs_router = APIRouter(tags=["embeddings"])
|
6 |
|
7 |
|
@@ -16,7 +16,7 @@ async def create_embeddings(task_id):
|
|
16 |
return
|
17 |
|
18 |
@embeddigs_router.get("/create_summary")
|
19 |
-
async def
|
20 |
item = await Transcriptions.objects.filter(task_id=task_id).first()
|
21 |
temp = item.content
|
22 |
chunks = generateChunks(temp, task_id)
|
@@ -28,5 +28,5 @@ async def create_embeddings(task_id):
|
|
28 |
# search
|
29 |
# update?
|
30 |
@embeddigs_router.post("/search_embeddings")
|
31 |
-
async def search_embeddings(
|
32 |
-
return search(query=query, task_id=
|
|
|
1 |
from fastapi import APIRouter
|
2 |
from App.Transcription.Model import Transcriptions
|
3 |
from .utils.Initialize import generateChunks, encode, search
|
4 |
+
from .Schemas import SearchRequest
|
5 |
embeddigs_router = APIRouter(tags=["embeddings"])
|
6 |
|
7 |
|
|
|
16 |
return
|
17 |
|
18 |
@embeddigs_router.get("/create_summary")
|
19 |
+
async def create_summary(task_id):
|
20 |
item = await Transcriptions.objects.filter(task_id=task_id).first()
|
21 |
temp = item.content
|
22 |
chunks = generateChunks(temp, task_id)
|
|
|
28 |
# search
|
29 |
# update?
|
30 |
@embeddigs_router.post("/search_embeddings")
|
31 |
+
async def search_embeddings(req:SearchRequest):
|
32 |
+
return search(query=req.query, task_id=req.taskId)
|
App/Embedding/Schemas.py
CHANGED
@@ -9,6 +9,14 @@ class BaseRequest(BaseModel):
|
|
9 |
youtubeLink: Optional[str]
|
10 |
telegramId: Optional[str]
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
class GetTranscriptions(BaseModel):
|
14 |
userId: int
|
|
|
9 |
youtubeLink: Optional[str]
|
10 |
telegramId: Optional[str]
|
11 |
|
12 |
+
class SearchRequest(BaseModel):
|
13 |
+
# userId: int
|
14 |
+
taskId: str
|
15 |
+
query: str
|
16 |
+
# youtubeLink: Optional[str]
|
17 |
+
# telegramId: Optional[str]
|
18 |
+
|
19 |
+
|
20 |
|
21 |
class GetTranscriptions(BaseModel):
|
22 |
userId: int
|