Skip to content

Commit

Permalink
see run-llama#12874: provide the exception to the StreamChatErrorEvent (
Browse files Browse the repository at this point in the history
  • Loading branch information
ziodave authored and chrisalexiuk-nvidia committed Apr 25, 2024
1 parent b4de677 commit 8834e71
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions llama-index-core/llama_index/core/chat_engine/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def write_response_to_history(
chat.message.content = final_text.strip() # final message
memory.put(chat.message)
except Exception as e:
dispatch_event(StreamChatErrorEvent())
dispatch_event(StreamChatErrorEvent(exception=e))
if not raise_error:
logger.warning(
f"Encountered exception writing response to history: {e}"
Expand Down Expand Up @@ -229,7 +229,7 @@ async def awrite_response_to_history(
chat.message.content = final_text.strip() # final message
memory.put(chat.message)
except Exception as e:
dispatch_event(StreamChatErrorEvent())
dispatch_event(StreamChatErrorEvent(exception=e))
logger.warning(f"Encountered exception writing response to history: {e}")
dispatch_event(StreamChatEndEvent())
self._is_done = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def class_name(cls):


class StreamChatErrorEvent(BaseEvent):
exception: Exception

@classmethod
def class_name(cls):
"""Class name."""
Expand Down

0 comments on commit 8834e71

Please sign in to comment.