Spaces:
Runtime error
Runtime error
change memory to window
Browse files
chain.py
CHANGED
@@ -42,8 +42,8 @@ def get_chain():
|
|
42 |
"""
|
43 |
|
44 |
prompt = PromptTemplate(input_variables=["chat_history", "query", "context"], template=template)
|
45 |
-
memory =
|
46 |
-
chat = ChatOpenAI(temperature=0, streaming=True
|
47 |
|
48 |
chain = load_qa_chain(llm=chat, chain_type="stuff", memory=memory, prompt=prompt)
|
49 |
|
|
|
42 |
"""
|
43 |
|
44 |
prompt = PromptTemplate(input_variables=["chat_history", "query", "context"], template=template)
|
45 |
+
memory = ConversationBufferWindowMemory(memory_key="chat_history", input_key="query", k=6)
|
46 |
+
chat = ChatOpenAI(temperature=0, streaming=True)
|
47 |
|
48 |
chain = load_qa_chain(llm=chat, chain_type="stuff", memory=memory, prompt=prompt)
|
49 |
|