[Python] LangChainDeprecationWarning:

Discussão em 'Python' iniciado por Stack, Fevereiro 13, 2025.

  1. Stack

    Stack Membro Participativo

    I've created an langchain based agent where I use chain and invoke it. I got this this warning while running it. LangChainDeprecationWarning: The class LLMChain was deprecated in LangChain 0.1.17 and will be removed in 1.0. Use :meth:~RunnableSequence, e.g., prompt | llm`` instead. return LLMChain(llm=self.llm, prompt=prompt)

    I know i have to give this values to chain prompt | llm but I use the chain in return. Please provide me working code for that.

    Here is my code where I'm using chain as well as import.

    `from langchain.chains import LLMChain

    def _create_chain(self, template: str) -> LLMChain:
    prompt = ChatPromptTemplate.from_template(template)
    return LLMChain(llm=self.llm, prompt=prompt)`

    Continue reading...

Compartilhe esta Página