From ab348f34a53b27ac2fb7cd5a9d018c11240fa5cf Mon Sep 17 00:00:00 2001 From: DARREN OBERST Date: Sun, 9 Jun 2024 11:11:12 -0400 Subject: [PATCH] update resources logger --- llmware/configs.py | 2 +- llmware/resources.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/llmware/configs.py b/llmware/configs.py index 82be6725..94f3da15 100644 --- a/llmware/configs.py +++ b/llmware/configs.py @@ -98,7 +98,7 @@ class LLMWareConfig: "logging_level": logging.WARNING, "logging_format": COLOR_WHITE + '%(levelname)-4s: %(message)s' + COLOR_RESET, "logging_level_by_module": {"llmware.embeddings": 20, "llmware.models": 30, "llmware.agents":20, - "llmware.prompts": 20}, + "llmware.prompts": 20, "llmware.resources": 20}, "agent_writer_mode": "screen", "agent_log_file": "agent_log.txt", "model_register": {"module": "llmware.models", "class": "register"}, diff --git a/llmware/resources.py b/llmware/resources.py index 71529825..759c4839 100644 --- a/llmware/resources.py +++ b/llmware/resources.py @@ -67,6 +67,7 @@ pass logger = logging.getLogger(__name__) +logger.setLevel(level=LLMWareConfig().get_logging_level_by_module(__name__)) class CollectionRetrieval: @@ -635,7 +636,7 @@ def lookup(self, key, value): try: value = ObjectId(value) except: - logger.info(f"update: mongo lookup - could not find _id into ObjectID - {value}") + logger.debug(f"update: mongo lookup - could not find _id into ObjectID - {value}") value = value target = list(self.collection.find({key:value})) @@ -4362,7 +4363,7 @@ def lookup_by_parse_job_id (self, prompt_id): output.append(new_row) except: - logger.info(f"warning: ParserState - could not find previous parse job record - {prompt_id}") + logger.warning(f"update: ParserState - could not find previous parse job record - {prompt_id}") output = [] return output @@ -4479,7 +4480,7 @@ def load_state(self, prompt_id, prompt_path=None,clear_current_state=True): output = self.prompt.interaction_history except: - logger.info(f"update: PromptState - could not find previous prompt interaction state- {prompt_id}") + logger.warning(f"update: PromptState - could not find previous prompt interaction state- {prompt_id}") output = None return output @@ -4499,7 +4500,7 @@ def lookup_by_prompt_id_from_file(self, prompt_id): new_row = json.loads(lines) output.append(new_row) except: - logger.info(f"warning: PromptState - could not find previous prompt interaction state- {prompt_id}") + logger.warning(f"warning: PromptState - could not find previous prompt interaction state- {prompt_id}") output = [] return output @@ -4881,7 +4882,7 @@ def load_state (self, query_id): query_history.append(new_row["query"]) except: - logger.info(f"warning: QueryState - could not find previous query state- {query_id}") + logger.warning(f"update: QueryState - could not find previous query state- {query_id}") output = [] self.query.results = output