Unverified Commit f18ce203 authored by takatost's avatar takatost Committed by GitHub

feat: optimize error logging (#808)

parent b81b8637
...@@ -85,7 +85,7 @@ class AgentLoopGatherCallbackHandler(BaseCallbackHandler): ...@@ -85,7 +85,7 @@ class AgentLoopGatherCallbackHandler(BaseCallbackHandler):
def on_llm_error( def on_llm_error(
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> None: ) -> None:
logging.error(error) logging.exception(error)
self._agent_loops = [] self._agent_loops = []
self._current_loop = None self._current_loop = None
self._message_agent_thought = None self._message_agent_thought = None
...@@ -164,7 +164,7 @@ class AgentLoopGatherCallbackHandler(BaseCallbackHandler): ...@@ -164,7 +164,7 @@ class AgentLoopGatherCallbackHandler(BaseCallbackHandler):
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> None: ) -> None:
"""Do nothing.""" """Do nothing."""
logging.error(error) logging.exception(error)
self._agent_loops = [] self._agent_loops = []
self._current_loop = None self._current_loop = None
self._message_agent_thought = None self._message_agent_thought = None
......
...@@ -68,4 +68,4 @@ class DatasetToolCallbackHandler(BaseCallbackHandler): ...@@ -68,4 +68,4 @@ class DatasetToolCallbackHandler(BaseCallbackHandler):
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> None: ) -> None:
"""Do nothing.""" """Do nothing."""
logging.error(error) logging.exception(error)
...@@ -96,4 +96,4 @@ class LLMCallbackHandler(BaseCallbackHandler): ...@@ -96,4 +96,4 @@ class LLMCallbackHandler(BaseCallbackHandler):
) )
self.conversation_message_task.save_message(llm_message=self.llm_message, by_stopped=True) self.conversation_message_task.save_message(llm_message=self.llm_message, by_stopped=True)
else: else:
logging.error(error) logging.exception(error)
...@@ -72,5 +72,5 @@ class MainChainGatherCallbackHandler(BaseCallbackHandler): ...@@ -72,5 +72,5 @@ class MainChainGatherCallbackHandler(BaseCallbackHandler):
def on_chain_error( def on_chain_error(
self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any self, error: Union[Exception, KeyboardInterrupt], **kwargs: Any
) -> None: ) -> None:
logging.error(error) logging.exception(error)
self.clear_chain_results() self.clear_chain_results()
\ No newline at end of file
...@@ -549,7 +549,7 @@ class IndexingRunner: ...@@ -549,7 +549,7 @@ class IndexingRunner:
qa_documents.append(qa_document) qa_documents.append(qa_document)
format_documents.extend(qa_documents) format_documents.extend(qa_documents)
except Exception as e: except Exception as e:
logging.error(str(e)) logging.exception(e)
all_qa_documents.extend(format_documents) all_qa_documents.extend(format_documents)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment