tranny / App /Embedding /EmbeddingRoutes.py
Mbonea's picture
embedding?
f5b43ca
raw
history blame
909 Bytes
from fastapi import APIRouter
from App.Transcription.Model import Transcriptions
from .utils.Initialize import generateChunks, encode, search
from .Schemas import SearchRequest
embeddigs_router = APIRouter(tags=["embeddings"])
# create
@embeddigs_router.get("/create_embeddings")
async def create_embeddings(task_id):
item = await Transcriptions.objects.filter(task_id=task_id).first()
temp = item.content
chunks = generateChunks(temp, task_id)
encode(chunks)
return
@embeddigs_router.get("/create_summary")
async def create_summary(task_id):
item = await Transcriptions.objects.filter(task_id=task_id).first()
temp = item.content
chunks = generateChunks(temp, task_id)
encode(chunks)
return
# search
# update?
@embeddigs_router.post("/search_embeddings")
async def search_embeddings(req: SearchRequest):
return search(query=req.query, task_id=req.taskId)