From 33521d6d00f18af1c3acb33a52fb246601881eca Mon Sep 17 00:00:00 2001 From: yichuan520030910320 Date: Mon, 4 Aug 2025 14:15:52 -0700 Subject: [PATCH] add logs --- apps/document_rag.py | 4 +++- packages/leann-backend-diskann/third_party/DiskANN | 2 +- packages/leann-core/src/leann/api.py | 3 +++ packages/leann-core/src/leann/chat.py | 6 +++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/apps/document_rag.py b/apps/document_rag.py index 02c954a..1ac15c7 100644 --- a/apps/document_rag.py +++ b/apps/document_rag.py @@ -99,7 +99,9 @@ if __name__ == "__main__": print("- 'What are the main techniques LEANN uses?'") print("- 'What is the technique DLPM?'") print("- 'Who does Elizabeth Bennet marry?'") - print("- 'What is the problem of developing pan gu model? (盘古大模型开发中遇到什么问题?)'") + print( + "- 'What is the problem of developing pan gu model Huawei meets? (盘古大模型开发中遇到什么问题?)'" + ) print("\nOr run without --query for interactive mode\n") rag = DocumentRAG() diff --git a/packages/leann-backend-diskann/third_party/DiskANN b/packages/leann-backend-diskann/third_party/DiskANN index 67a2611..af2a264 160000 --- a/packages/leann-backend-diskann/third_party/DiskANN +++ b/packages/leann-backend-diskann/third_party/DiskANN @@ -1 +1 @@ -Subproject commit 67a2611ad14bc11d84dfdb554c5567cfb78a2656 +Subproject commit af2a26481e65232b57b82d96e68833cdee9f7635 diff --git a/packages/leann-core/src/leann/api.py b/packages/leann-core/src/leann/api.py index 39710df..0ae40af 100644 --- a/packages/leann-core/src/leann/api.py +++ b/packages/leann-core/src/leann/api.py @@ -636,7 +636,10 @@ class LeannChat: "Please provide the best answer you can based on this context and your knowledge." ) + ask_time = time.time() ans = self.llm.ask(prompt, **llm_kwargs) + ask_time = time.time() - ask_time + logger.info(f" Ask time: {ask_time} seconds") return ans def start_interactive(self): diff --git a/packages/leann-core/src/leann/chat.py b/packages/leann-core/src/leann/chat.py index 621dab2..f386172 100644 --- a/packages/leann-core/src/leann/chat.py +++ b/packages/leann-core/src/leann/chat.py @@ -358,7 +358,11 @@ def validate_model_and_suggest(model_name: str, llm_type: str) -> str | None: error_msg += f"\n\nModel '{model_name}' was not found in Ollama's library." if suggestions: - error_msg += "\n\nDid you mean one of these installed models?\n" + error_msg += ( + "\n\nDid you mean one of these installed models?\n" + + "\nTry to use ollama pull to install the model you need\n" + ) + for i, suggestion in enumerate(suggestions, 1): error_msg += f" {i}. {suggestion}\n" else: