Skip to content

Commit

Permalink
Merge pull request #179 from langchain-ai/nc/7feb/fix-other-bots
Browse files Browse the repository at this point in the history
Fix streaming for non-assistant bots
  • Loading branch information
nfcampos authored Feb 7, 2024
2 parents a8740b9 + dd37878 commit bfeca4a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions backend/app/stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def astream_messages(
last_messages_list = event["data"]["chunk"]

yield last_messages_list
elif event["event"] == "on_chat_model_start":
elif event["event"] == "on_chat_model_start" and last_messages_list is None:
input_messages_outer = event["data"]["input"].get("messages")
input_messages = (
input_messages_outer[0]
Expand All @@ -55,7 +55,7 @@ async def astream_messages(
if input_messages is not None
else None
)
if input_messages and input_messages != last_messages_list:
if input_messages:
last_messages_list = input_messages
yield last_messages_list
elif (
Expand Down
5 changes: 4 additions & 1 deletion backend/app/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,7 @@ class AvailableTools(str, Enum):

# Check if dependencies and env vars for each tool are available
for k, v in TOOLS.items():
v()
# Connery requires env vars to be valid even if the tool isn't used,
# so we'll skip the check for it
if k != AvailableTools.CONNERY:
v()
12 changes: 6 additions & 6 deletions backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bfeca4a

Please sign in to comment.