From 95cd38983aebce5182b56c24607bc9ecac3209a5 Mon Sep 17 00:00:00 2001 From: lopagela Date: Mon, 6 Nov 2023 15:32:33 +0100 Subject: [PATCH] PR feedback * Adapted log to log file_name instead of the data itself * Undo changes in __main__.py * Change API documentation to make it more generic --- private_gpt/__main__.py | 9 ++++----- private_gpt/server/ingest/ingest_router.py | 5 ++--- private_gpt/server/ingest/ingest_service.py | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/private_gpt/__main__.py b/private_gpt/__main__.py index 9e897f4be..6bf2f156e 100644 --- a/private_gpt/__main__.py +++ b/private_gpt/__main__.py @@ -5,8 +5,7 @@ from private_gpt.main import app from private_gpt.settings.settings import settings -if __name__ == "__main__": - # Set log_config=None to do not use the uvicorn logging configuration, and - # use ours instead. For reference, see below: - # https://github.com/tiangolo/fastapi/discussions/7457#discussioncomment-5141108 - uvicorn.run(app, host="0.0.0.0", port=settings.server.port, log_config=None) +# Set log_config=None to do not use the uvicorn logging configuration, and +# use ours instead. For reference, see below: +# https://github.com/tiangolo/fastapi/discussions/7457#discussioncomment-5141108 +uvicorn.run(app, host="0.0.0.0", port=settings.server.port, log_config=None) diff --git a/private_gpt/server/ingest/ingest_router.py b/private_gpt/server/ingest/ingest_router.py index 7a5231ab0..5c156f464 100644 --- a/private_gpt/server/ingest/ingest_router.py +++ b/private_gpt/server/ingest/ingest_router.py @@ -53,9 +53,8 @@ def list_ingested() -> IngestResponse: 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 the document store (i.e. - from the directory specified in your configuration) + 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) diff --git a/private_gpt/server/ingest/ingest_service.py b/private_gpt/server/ingest/ingest_service.py index bc938eac7..0026660cd 100644 --- a/private_gpt/server/ingest/ingest_service.py +++ b/private_gpt/server/ingest/ingest_service.py @@ -106,7 +106,7 @@ def ingest(self, file_name: str, file_data: AnyStr | Path) -> list[IngestedDoc]: path_to_tmp.write_text(str(file_data)) documents = reader.load_data(path_to_tmp) logger.info( - "Transformed file=%s into count=%s documents", file_data, len(documents) + "Transformed file=%s into count=%s documents", file_name, len(documents) ) for document in documents: document.metadata["file_name"] = file_name