-
Hi there! const output = await splitter.createDocuments([t.text]);
const chain = loadSummarizationChain(model, { type: "map_reduce" });
const res = await chain.call({
input_documents: output,
}); |
Beta Was this translation helpful? Give feedback.
Answered by
giuice
May 3, 2023
Replies: 1 comment
-
I don't know if works, but I'm doing this way with map_reduce(I believe this will work better for stuff, just to exemplify) const output = await this.splitter.createDocuments([t.text]);
const template = `TLDR; the following text, The focus should be on identifying and analyzing the strategies the author uses to make their point, rather than summarizing the passage:
Title: ${t.title}
"{text}"
CONCISE SUMMARY:`;
const myPrompt = new PromptTemplate({
template,
inputVariables: ["text"],
});
const res = await loadSummarizationChain(this.model, {
type: "map_reduce",
combineMapPrompt: myPrompt,
}).call({
input_documents: output,
}); If you are calling another summarization type change the parameters: type SummarizationChainParams = {
type?: "stuff";
prompt?: BasePromptTemplate;
} | {
type?: "map_reduce";
combineMapPrompt?: BasePromptTemplate;
combinePrompt?: BasePromptTemplate;
} | {
type?: "refine";
refinePrompt?: BasePromptTemplate;
questionPrompt?: BasePromptTemplate;
}; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
giuice
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know if works, but I'm doing this way with map_reduce(I believe this will work better for stuff, just to exemplify)