Skip to content

Commit

Permalink
Merge pull request #27 from tigergraph/GML-1494-fix-logging-formats
Browse files Browse the repository at this point in the history
fix(logs): fix warn deprecation
  • Loading branch information
parkererickson-tg authored Jan 29, 2024
2 parents 22cf36c + b516cfc commit 660d1a1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ def retrieve_answer(graphname, query: NaturalLanguageQuery, credentials: Annotat
resp.natural_language_response = steps["output"]
resp.query_sources = {"agent_history": str(steps)}
resp.answered_question = False
logger.warn(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to unknown exception")
logger.warning(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to unknown exception")
except MapQuestionToSchemaException as e:
resp.natural_language_response = ""
resp.query_sources = {}
resp.answered_question = False
logger.warn(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to MapQuestionToSchemaException")
logger.warning(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to MapQuestionToSchemaException")
except Exception as e:
resp.natural_language_response = ""
resp.query_sources = {}
resp.answered_question = False
logger.warn(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to unknown exception")
logger.warning(f"/{graphname}/query request_id={req_id_cv.get()} agent execution failed due to unknown exception")
return resp
6 changes: 3 additions & 3 deletions app/tools/generate_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _run(self, question: str,
target_vertex_attributes,
target_edge_attributes)
except MapQuestionToSchemaException as e:
logger.warn(f"request_id={req_id_cv.get()} WARN input schema not valid")
logger.warning(f"request_id={req_id_cv.get()} WARN input schema not valid")
return e

lookup_question = question + " "
Expand Down Expand Up @@ -122,7 +122,7 @@ def _run(self, question: str,
try:
generated = validate_function_call(self.conn, generated, docs)
except InvalidFunctionCallException as e:
logger.warn(f"request_id={req_id_cv.get()} EXIT GenerateFunction._run() with exception={e}")
logger.warning(f"request_id={req_id_cv.get()} EXIT GenerateFunction._run() with exception={e}")
return e

try:
Expand All @@ -131,7 +131,7 @@ def _run(self, question: str,
logger.info(f"request_id={req_id_cv.get()} EXIT GenerateFunction._run()")
return "Function {} produced the result {}".format(generated, json.dumps(loc["res"]))
except Exception as e:
logger.warn(f"request_id={req_id_cv.get()} EXIT GenerateFunction._run() with exception={e}")
logger.warning(f"request_id={req_id_cv.get()} EXIT GenerateFunction._run() with exception={e}")
raise ToolException("The function {} did not execute correctly. Please rephrase your question and try again".format(generated))


Expand Down
2 changes: 1 addition & 1 deletion app/tools/map_schema_to_question.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def _run(self, query: str) -> str:
parsed_q.target_vertex_attributes,
parsed_q.target_edge_attributes)
except MapQuestionToSchemaException as e:
logger.warn(f"request_id={req_id_cv.get()} WARN MapQuestionToSchema to validate schema")
logger.warning(f"request_id={req_id_cv.get()} WARN MapQuestionToSchema to validate schema")
raise e
logger.info(f"request_id={req_id_cv.get()} EXIT MapQuestionToSchema._run()")
return parsed_q
Expand Down

0 comments on commit 660d1a1

Please sign in to comment.