Tuana commited on
Commit
bab66cf
·
1 Parent(s): 970c4fe

adding llms separately

Browse files
Files changed (1) hide show
  1. utils/haystack.py +6 -6
utils/haystack.py CHANGED
@@ -29,12 +29,12 @@ from haystack.components.builders.prompt_builder import PromptBuilder
29
 
30
  def start_haystack(huggingface_token):
31
  #Use this function to contruct a pipeline
 
 
 
32
  llm = HuggingFaceTGIGenerator("mistralai/Mixtral-8x7B-Instruct-v0.1", token=huggingface_token)
33
  llm.warm_up()
34
- # start_keyword_pipeline(llm)
35
- # start_qa_pipeline(llm)
36
- keyword_llm = llm
37
- answer_llm = llm
38
  keyword_prompt_template = """
39
  Your task is to convert the follwing question into 3 keywords that can be used to find relevant medical research papers on PubMed.
40
  Here is an examples:
@@ -70,13 +70,13 @@ Articles:
70
  pipe.add_component("keyword_llm", keyword_llm)
71
  pipe.add_component("pubmed_fetcher", fetcher)
72
  pipe.add_component("prompt_builder", prompt_builder)
73
- pipe.add_component("llm", answer_llm)
74
 
75
  pipe.connect("keyword_prompt_builder.prompt", "keyword_llm.prompt")
76
  pipe.connect("keyword_llm.replies", "pubmed_fetcher.queries")
77
 
78
  pipe.connect("pubmed_fetcher.articles", "prompt_builder.articles")
79
- pipe.connect("prompt_builder.prompt", "llm.prompt")
80
  return pipe
81
 
82
 
 
29
 
30
  def start_haystack(huggingface_token):
31
  #Use this function to contruct a pipeline
32
+ keyword_llm = HuggingFaceTGIGenerator("mistralai/Mixtral-8x7B-Instruct-v0.1", token=huggingface_token)
33
+ keyword_llm.warm_up()
34
+
35
  llm = HuggingFaceTGIGenerator("mistralai/Mixtral-8x7B-Instruct-v0.1", token=huggingface_token)
36
  llm.warm_up()
37
+
 
 
 
38
  keyword_prompt_template = """
39
  Your task is to convert the follwing question into 3 keywords that can be used to find relevant medical research papers on PubMed.
40
  Here is an examples:
 
70
  pipe.add_component("keyword_llm", keyword_llm)
71
  pipe.add_component("pubmed_fetcher", fetcher)
72
  pipe.add_component("prompt_builder", prompt_builder)
73
+ pipe.add_component("llm", llm)
74
 
75
  pipe.connect("keyword_prompt_builder.prompt", "keyword_llm.prompt")
76
  pipe.connect("keyword_llm.replies", "pubmed_fetcher.queries")
77
 
78
  pipe.connect("pubmed_fetcher.articles", "prompt_builder.articles")
79
+ pipe.connect("prompt_builder.prompt", "llm.prompt")
80
  return pipe
81
 
82