Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,14 @@ from langchain.chains import LLMChain
|
|
23 |
from langchain_core.prompts import PromptTemplate
|
24 |
from langchain.memory.buffer import ConversationBufferMemory
|
25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
# ---------------------------------------------------for backend looks, example file:----------------------------------
|
27 |
#with open('/home/user/.local/lib/python3.10/site-packages/socketio/async_server.py', 'r') as file:
|
28 |
#content = file.read()
|
@@ -131,8 +139,8 @@ def init_session():
|
|
131 |
#cl.user_session.set("memory", memory)
|
132 |
# cl.user_session.set("connection_attempts", 0)
|
133 |
# cl.user_session.set("connection_attempts", connection_attempts + 1)
|
134 |
-
|
135 |
-
llm_chain =
|
136 |
daysoff_assistant_prompt | llm
|
137 |
).configure_history(
|
138 |
memory=conversation_memory,
|
|
|
23 |
from langchain_core.prompts import PromptTemplate
|
24 |
from langchain.memory.buffer import ConversationBufferMemory
|
25 |
|
26 |
+
from pydantic import BaseModel, Field
|
27 |
+
from langchain_core.runnables import (
|
28 |
+
RunnableLambda,
|
29 |
+
ConfigurableFieldSpec,
|
30 |
+
RunnablePassthrough,
|
31 |
+
)
|
32 |
+
from langchain_core.runnables.history import RunnableWithMessageHistory
|
33 |
+
|
34 |
# ---------------------------------------------------for backend looks, example file:----------------------------------
|
35 |
#with open('/home/user/.local/lib/python3.10/site-packages/socketio/async_server.py', 'r') as file:
|
36 |
#content = file.read()
|
|
|
139 |
#cl.user_session.set("memory", memory)
|
140 |
# cl.user_session.set("connection_attempts", 0)
|
141 |
# cl.user_session.set("connection_attempts", connection_attempts + 1)
|
142 |
+
|
143 |
+
llm_chain = RunnableWithMessageHistory(
|
144 |
daysoff_assistant_prompt | llm
|
145 |
).configure_history(
|
146 |
memory=conversation_memory,
|