From fff4982fae2363c09a83c92136fa14e61321b8ff Mon Sep 17 00:00:00 2001 From: Nuno Campos Date: Fri, 26 Jan 2024 15:52:09 -0800 Subject: [PATCH] Format --- backend/app/storage.py | 2 +- backend/app/stream.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/app/storage.py b/backend/app/storage.py index ad56a9f5..649a701e 100644 --- a/backend/app/storage.py +++ b/backend/app/storage.py @@ -1,7 +1,6 @@ import os from datetime import datetime from typing import List, Sequence -from app.stream import map_chunk_to_msg import orjson from langchain.schema.messages import AnyMessage @@ -12,6 +11,7 @@ from app.agent import AgentType, get_agent_executor from app.schema import Assistant, AssistantWithoutUserId, Thread, ThreadWithoutUserId +from app.stream import map_chunk_to_msg def assistants_list_key(user_id: str) -> str: diff --git a/backend/app/stream.py b/backend/app/stream.py index e6526037..9e967f83 100644 --- a/backend/app/stream.py +++ b/backend/app/stream.py @@ -1,8 +1,10 @@ from typing import AsyncIterator, Optional, Sequence, Union +import orjson from langchain_core.messages import ( AIMessage, AIMessageChunk, + AnyMessage, BaseMessage, BaseMessageChunk, ChatMessage, @@ -11,11 +13,9 @@ FunctionMessageChunk, HumanMessage, HumanMessageChunk, - AnyMessage, ) from langchain_core.runnables import Runnable, RunnableConfig from langserve.serialization import WellKnownLCSerializer -import orjson MessagesStream = AsyncIterator[Union[list[AnyMessage], str]]