Can't instantiate langchain.chains.LLMChain to create_llama_chat_agent (Setting custom prompt)
Hello everyone,
Working in an implementation Index-GPT+LangChain. I'm trying to set a custom prompt where I can set additional context. Based on the documentation I'm trying to run this code.
langchain 0.0.139 llama-index 0.5.15
template = """Pretend you are Steve Jobs. Answer with motivational content. Steve: How I can help you today?. Person: I want some motivation. Steve: You are amazing you can create any type of business you want.
Person: {question}?
Steve:"""
prompt = PromptTemplate(template=template, input_variables=["question"])
llm=OpenAI(temperature=0)
print(type(llm))
llm = LLMChain(prompt=prompt, llm=llm)
print(type(llm))
memory = ConversationBufferMemory(memory_key="chat_history")
agent_chain = create_llama_chat_agent(
toolkit,
llm,
memory=memory,
verbose=True
)
But I'm getting the below error:
ValidationError: 1 validation error for LLMChain
llm
Can't instantiate abstract class BaseLanguageModel with abstract methods agenerate_prompt, generate_prompt (type=type_error)
Thanks for your help.
@tezcahernandez did you resolve this? What was the issue? I'm facing the same all of a sudden.
@homanp We have changed the approach since this code is not working. Now we are using our own chain/agent with Langchain.
@homanp We have changed the approach since this code is not working. Now we are using our own chain/agent with Langchain.
I Did the same
can you explain how did you do it ???? o where i can found documentation ... i have the same problem ...
Me too, I face the same problem, how do you solve it @tezcahernandez ?
getting the same error when trying this:
self.agent_llm_chain = LLMChain(
llm=OpenAI(model="gpt-3.5-turbo-instruct", temperature=0),
)
self.agent_chain = initialize_agent(
self.tools,
self.agent_llm_chain,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
verbose=True,
memory=self.agent_memory,
)
Hi, @tezcahernandez
I'm helping the LangChain team manage their backlog and am marking this issue as stale. From what I understand, you raised an issue regarding a validation error encountered when trying to instantiate langchain.chains.LLMChain to create a custom prompt for a chat agent. In the comments, you mentioned changing the approach and using your own chain/agent with Langchain. Other users also reported facing the same problem and sought solutions or documentation. The issue remains unresolved at this time.
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. Thank you!