-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for removing embeddings (#13)
* WIP * Add possibility to remove embeddings
- Loading branch information
Showing
4 changed files
with
58 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from fastapi import APIRouter | ||
from models.delete import RequestPayload, ResponsePayload | ||
from service.vector_database import get_vector_service, VectorService | ||
|
||
router = APIRouter() | ||
|
||
|
||
@router.post("/delete", response_model=ResponsePayload) | ||
async def delete(payload: RequestPayload): | ||
vector_service: VectorService = get_vector_service( | ||
index_name=payload.index_name, credentials=payload.vector_database | ||
) | ||
await vector_service.delete(file_url=payload.file_url) | ||
return {"success": True} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from pydantic import BaseModel | ||
from models.vector_database import VectorDatabase | ||
|
||
|
||
class RequestPayload(BaseModel): | ||
index_name: str | ||
file_url: str | ||
vector_database: VectorDatabase | ||
|
||
|
||
class ResponsePayload(BaseModel): | ||
success: bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
from fastapi import APIRouter | ||
|
||
from api import ingest, query | ||
from api import ingest, query, delete | ||
|
||
router = APIRouter() | ||
api_prefix = "/api/v1" | ||
|
||
router.include_router(ingest.router, tags=["Ingest"], prefix=api_prefix) | ||
router.include_router(query.router, tags=["Query"], prefix=api_prefix) | ||
router.include_router(delete.router, tags=["Delete"], prefix=api_prefix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters