File size: 796 Bytes
8677815
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
from haystack.nodes import PromptNode, PromptTemplate
from haystack.nodes import AnswerParser
from haystack.nodes import TransformersSummarizer
from haystack import Document




def prompting_model():
    '''
    Define a prompt node in haystack pipeline
    ''' 

    prompt_node = PromptNode(model_name_or_path="facebook/galactica-125m", default_prompt_template="deepset/question-answering-per-document")
    
    # prompt_node = PromptNode(model_name_or_path="facebook/opt-350m", default_prompt_template=lfqa_prompt)

    return prompt_node


def summarize():

    '''
    Use a summarizer node, to summarize the output of generator
    To remove redundancy/repitition
    '''

    summarizer = TransformersSummarizer(model_name_or_path="google/pegasus-xsum")

    return summarizer