-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue: Issue providing LLMChain with multiple variables when memory is used #8710
Comments
I am not so sure why are you using template = """Tell me a {adjective} joke about {subject}."""
prompt = PromptTemplate(
template=template, input_variables=["adjective", "subject"]
)
llm = OpenAI(temperature=0)
memory = ConversationKGMemory(llm=llm, input_key="adjective")
llm_chain = LLMChain(prompt=prompt, llm=OpenAI(temperature=0), memory=memory)
print(llm_chain.predict(adjective="sad", subject="ducks"))
|
Just to clarify. Whenever any Memory is used, it will take at most one single input key? And when no Memory is used, it will take multiple input keys? |
No, that's not right. The number of input keys and Memory are independent, but the Memory requires a way to access its buffer through input keys. Therefore, you need to specify an input key for certain types of memory, such as VectorBasedMemory. This input key allows the VectorBased memory to identify which specific input it needs to compare against the documents in the Vector DB. |
If you are satisfied, please close the issue. |
I face similar issue while using
after specifying the template:
chain:
|
Oh, ok, I got it... I was facing the same issue, but adding
|
Hi, @dreysco I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, the issue you raised involved using the LLMChain class with multiple variables when using a memory object, resulting in a ValueError indicating that only one input key is expected. keenborder786 clarified that certain types of memory, such as VectorBasedMemory, require specifying an input key to access its buffer. Other users also shared their experiences and solutions with different memory types. Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. |
Issue you'd like to raise.
I'm having an issue with providing the LLMChain class with multiple variables when I provide it with a memory object. It works fine when I don't have memory attached to it. I followed the example given in this document: LLM Chain Multiple Inputs
Here is the code that I used, which is mostly based on the example from the above documentation, besides I've added memory.
With the above code, I get the following error:
Python version: 3.11
LangChain version: 0.0.250
Suggestion:
Is there support for using multiple input variables when memory is involved?
The text was updated successfully, but these errors were encountered: