mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 13:55:41 +01:00
Endpoint to delete documents ingested (#1163)
A file that is ingested will be transformed into several documents (that are organized into nodes). This endpoint is deleting documents (bits of a file). These bits can be retrieved thanks to the endpoint to list all the documents.
This commit is contained in:
parent
6583dc84c0
commit
0c40cfb115
3 changed files with 45 additions and 2 deletions
|
|
@ -47,3 +47,14 @@ def list_ingested() -> IngestResponse:
|
|||
service = root_injector.get(IngestService)
|
||||
ingested_documents = service.list_ingested()
|
||||
return IngestResponse(object="list", model="private-gpt", data=ingested_documents)
|
||||
|
||||
|
||||
@ingest_router.delete("/ingest/{doc_id}", tags=["Ingestion"])
|
||||
def delete_ingested(doc_id: str) -> None:
|
||||
"""Delete the specified ingested Document.
|
||||
|
||||
The `doc_id` can be obtained from the `GET /ingest/list` endpoint.
|
||||
The document will be effectively deleted from your storage context.
|
||||
"""
|
||||
service = root_injector.get(IngestService)
|
||||
service.delete(doc_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue