I’m trying to use memory to keep the context for SQLDatabaseChain:
db = SQLDatabase.from_uri("sqlite:///test.db")
llm = ChatOpenAI(temperature=0, verbose=True)
db_chain = SQLDatabaseChain.from_llm(llm, db, verbose=True, memory=ConversationBufferMemory())
Then subsequent calls to the chain should preserve the context but it doesn’t work:
while True:
query = input ( "Query: " )
print(db_chain.run(query))
Note: by preserving the context of the chat I mean something like in the following imaginary example:
query: what is the top rated movie?
response: the top rated movie is Pulp Fiction
query: and what is its rating?
response: its rating is 8.5
Thanks!