Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
* Adapted log to log file_name instead of the data itself
* Undo changes in __main__.py
* Change API documentation to make it more generic
  • Loading branch information
lopagela committed Nov 6, 2023
1 parent 3d88c8c commit 95cd389
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
9 changes: 4 additions & 5 deletions private_gpt/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 2 additions & 3 deletions private_gpt/server/ingest/ingest_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion private_gpt/server/ingest/ingest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95cd389

Please sign in to comment.