Error when dealing with method load_summarize_chain #10364
-
Hello everyone, from langchain.chains.summarize import load_summarize_chain from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain.llms.openai import OpenAI # split text into texts char_text_splitter = RecursiveCharacterTextSplitter(chunk_size=3000, chunk_overlap=0) texts = char_text_splitter.split_text(text) # summarize using refine model llm = OpenAI(temperature=0, openai_api_key='example_api_key') model = load_summarize_chain(llm=llm,chain_type="refine") model.run(texts) I have this exception on model.run(texts) Do anyone have any idea how to deal with that ? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
🤖 Hello, Based on the error message you're receiving, it seems like the From the context provided, it's not clear what the expected input type for the Also, the Without more information about the Best, Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
🤖
Hello,
Based on the error message you're receiving, it seems like the
run
method of theload_summarize_chain
class is expecting an object with apage_content
attribute, but it's receiving a string instead.From the context provided, it's not clear what the expected input type for the
run
method is, as it's not explicitly defined in theload_summarize_chain
class. However, a similar issue was solved by changing the line of code fromtexts = text_splitter.split_documents(pages)
totexts = text_splitter.create_documents(pages)
. You might want to try a similar approach.Also, the
split_text
method of theRecursiveCharacterTextSplitter
class returns a list of strings, where each string repre…