Add memory to sql chain (#8597)

continuation of PR #8550

@hwchase17 please see and merge. And also close the PR #8550.

---------

Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Mohammad Mohtashim
2023-10-04 00:04:39 +05:00
committed by GitHub
parent feabf2e0d5
commit 3bddd708f7
3 changed files with 237 additions and 0 deletions

View File

@@ -122,6 +122,9 @@ class SQLDatabaseChain(Chain):
"table_info": table_info,
"stop": ["\nSQLResult:"],
}
if self.memory is not None:
for k in self.memory.memory_variables:
llm_inputs[k] = inputs[k]
intermediate_steps: List = []
try:
intermediate_steps.append(llm_inputs) # input: sql generation