Skip to content

Commit

Permalink
Merge pull request #856 from llmware-ai/update-resources-logging
Browse files Browse the repository at this point in the history
update resources logger
  • Loading branch information
doberst authored Jun 9, 2024
2 parents 9b99f05 + ab348f3 commit 2975805
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion llmware/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down
11 changes: 6 additions & 5 deletions llmware/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
pass

logger = logging.getLogger(__name__)
logger.setLevel(level=LLMWareConfig().get_logging_level_by_module(__name__))


class CollectionRetrieval:
Expand Down Expand Up @@ -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}))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2975805

Please sign in to comment.