当前位置:   article > 正文

使用 LangChain load_summarize_chain 对文档进行总结_langchain summarize 中文文档,摘要后是英文,怎么样才能让摘要和文档一样是中文

langchain summarize 中文文档,摘要后是英文,怎么样才能让摘要和文档一样是中文

import ChatGLM
from langchain.chains import LLMChain
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain.chains import SimpleSequentialChain

from operator import itemgetter
from langchain_community.document_loaders import PyPDFLoader
import ChatGLM



from langchain_community.tools.tavily_search import TavilySearchResults
from langchain.chains import LLMMathChain


from langchain_community.document_loaders import TextLoader
from langchain.text_splitter import CharacterTextSplitter
from langchain_community.vectorstores import Chroma


from langchain_core.runnables import RunnableParallel, RunnablePassthrough
from langchain_community.embeddings import JinaEmbeddings
from langchain.chains.combine_documents import create_stuff_documents_chain
from langchain.chains import create_retrieval_chain
from langchain.chains.summarize import load_summarize_chain
from langchain_community.document_loaders import WebBaseLoader

llm = ChatGLM.ChatGLM_LLM()
loader = WebBaseLoader("https://www.163.com/dy/article/IQ6PGRNT0514BQ68.html")
documents = loader.load()
chain = load_summarize_chain(llm, chain_type="stuff")
print(chain.run(documents))

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Monodyee/article/detail/610493
推荐阅读
相关标签
  

闽ICP备14008679号