Skip to content

LangChain Deprecation Warning #259

@sergey-koba-mobidev

Description

@sergey-koba-mobidev

/keybert/llm/_langchain.py:102: LangChainDeprecationWarning: The method Chain.run was deprecated in langchain 0.1.0 and will be removed in 1.0. Use :meth:~invoke instead.
keywords = self.chain.run(input_documents=[input_document], question=self.prompt).strip()

the code

from langchain.chains.question_answering import load_qa_chain

chain = load_qa_chain(model)

from keybert.llm import LangChain
from keybert import KeyLLM

# Create your LLM
llm = LangChain(chain)

# Load it in KeyLLM
kw_model = KeyLLM(llm)

# Extract keywords
keywords = kw_model.extract_keywords(document)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions