armanddemasson commited on
Commit
87c0d3c
·
2 Parent(s): 26dc6ad 184a10c

add retrieve by poc node in the graph

Browse files
app.py CHANGED
@@ -66,7 +66,7 @@ user_id = create_user_id()
66
  embeddings_function = get_embeddings_function()
67
  vectorstore = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX"))
68
  vectorstore_graphs = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX_OWID"), text_key="description")
69
- vectorstore_region = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX_REGION"))
70
 
71
  llm = get_llm(provider="openai",max_tokens = 1024,temperature = 0.0)
72
  if os.environ["GRADIO_ENV"] == "local":
@@ -75,7 +75,7 @@ else :
75
  reranker = get_reranker("large")
76
 
77
  agent = make_graph_agent(llm=llm, vectorstore_ipcc=vectorstore, vectorstore_graphs=vectorstore_graphs, vectorstore_region = vectorstore_region, reranker=reranker, threshold_docs=0.2)
78
- agent_poc = make_graph_agent_poc(llm=llm, vectorstore_ipcc=vectorstore, vectorstore_graphs=vectorstore_graphs, vectorstore_region = vectorstore_region, reranker=reranker, threshold_docs=0)#TODO put back default 0.2
79
 
80
 
81
  async def chat(query, history, audience, sources, reports, relevant_content_sources_selection, search_only):
 
66
  embeddings_function = get_embeddings_function()
67
  vectorstore = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX"))
68
  vectorstore_graphs = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX_OWID"), text_key="description")
69
+ vectorstore_region = get_pinecone_vectorstore(embeddings_function, index_name=os.getenv("PINECONE_API_INDEX_LOCAL_V2"))
70
 
71
  llm = get_llm(provider="openai",max_tokens = 1024,temperature = 0.0)
72
  if os.environ["GRADIO_ENV"] == "local":
 
75
  reranker = get_reranker("large")
76
 
77
  agent = make_graph_agent(llm=llm, vectorstore_ipcc=vectorstore, vectorstore_graphs=vectorstore_graphs, vectorstore_region = vectorstore_region, reranker=reranker, threshold_docs=0.2)
78
+ agent_poc = make_graph_agent_poc(llm=llm, vectorstore_ipcc=vectorstore, vectorstore_graphs=vectorstore_graphs, vectorstore_region = vectorstore_region, reranker=reranker, threshold_docs=0, version="v4")#TODO put back default 0.2
79
 
80
 
81
  async def chat(query, history, audience, sources, reports, relevant_content_sources_selection, search_only):
climateqa/engine/chains/prompts.py CHANGED
@@ -200,56 +200,52 @@ Graphs and their HTML embedding:
200
  Output the result as json with a key "graphs" containing a list of dictionaries of the relevant graphs with keys 'embedding', 'category', and 'source'. Do not modify the graph HTML embedding, the category or the source. Do not put any message or text before or after the JSON output.
201
  """
202
 
203
- retrieve_chapter_prompt_template = """A partir de la question de l'utilisateur et d'une liste de documents avec leurs tables des matières, retrouve les 5 chapitres de niveau 0 les plus pertinents qui pourraient aider à répondre à la question tout en prenant bien en compte leurs sous-chapitres.
204
 
205
-
206
- La table des matières est structurée de cette façon :
207
  {{
208
  "level": 0,
209
- "Chapitre 1": {{}},
210
- "Chapitre 2" : {{
211
  "level": 1,
212
- "Chapitre 2.1": {{
213
  ...
214
  }}
215
  }},
216
  }}
217
 
218
- Ici level correspond au niveau du chapitre. Ici par exemple Chapitre 1 et Chapitre 2 sont au niveau 0, et Chapitre 2.1 est au niveau 1
219
-
220
- -----------------------
221
- Suis impérativement cette guideline ci-dessous.
222
 
223
  ### Guidelines ###
224
- - Retiens bien la liste complète des documents.
225
- - Chaque chapitre doit conserver **EXACTEMENT** le niveau qui lui est attribué dans la table des matières. **NE MODIFIE PAS LES NIVEAUX.**
226
- - Vérifie systématiquement le niveau d’un chapitre avant de l’inclure dans la réponse.
227
- - Retourne un résultat **JSON valide**.
228
 
229
  --------------------
230
- Question de l'utilisateur :
231
  {query}
232
 
233
- Liste des documents avec leurs tables des matières :
234
  {doc_list}
235
 
236
  --------------------
237
 
238
- Retourne le résultat en JSON contenant une liste des chapitres pertinents avec les clés suivantes sans l'indicateur markdown du json:
239
- - "document" : le document contenant le chapitre
240
- - "chapter" : le titre du chapitre
241
 
242
- **IMPORTANT : Assure-toi que les niveaux dans la réponse sont exactement ceux de la table des matières.**
243
 
244
- Exemple de réponse JSON :
245
  [
246
  {{
247
  "document": "Document A",
248
- "chapter": "Chapitre 1",
249
  }},
250
  {{
251
  "document": "Document B",
252
- "chapter": "Chapitre 1.1",
253
  }}
254
  ]
255
- """
 
200
  Output the result as json with a key "graphs" containing a list of dictionaries of the relevant graphs with keys 'embedding', 'category', and 'source'. Do not modify the graph HTML embedding, the category or the source. Do not put any message or text before or after the JSON output.
201
  """
202
 
203
+ retrieve_chapter_prompt_template = """Given the user question and a list of documents with their table of contents, retrieve the 5 most relevant level 0 chapters which could help to answer to the question while taking account their sub-chapters.
204
 
205
+ The table of contents is structured like that :
 
206
  {{
207
  "level": 0,
208
+ "Chapter 1": {{}},
209
+ "Chapter 2" : {{
210
  "level": 1,
211
+ "Chapter 2.1": {{
212
  ...
213
  }}
214
  }},
215
  }}
216
 
217
+ Here level is the level of the chapter. For example, Chapter 1 and Chapter 2 are at level 0, and Chapter 2.1 is at level 1.
 
 
 
218
 
219
  ### Guidelines ###
220
+ - Keep all the list of documents that is given to you
221
+ - Each chapter must keep **EXACTLY** its assigned level in the table of contents. **DO NOT MODIFY THE LEVELS. **
222
+ - Check systematically the level of a chapter before including it in the answer.
223
+ - Return **valid JSON** result.
224
 
225
  --------------------
226
+ User question :
227
  {query}
228
 
229
+ List of documents with their table of contents :
230
  {doc_list}
231
 
232
  --------------------
233
 
234
+ Return a JSON result with a list of relevant chapters with the following keys **WITHOUT** the json markdown indicator ```json at the beginning:
235
+ - "document" : the document in which we can find the chapter
236
+ - "chapter" : the title of the chapter
237
 
238
+ **IMPORTANT : Make sure that the levels of the answer are exactly the same as the ones in the table of contents**
239
 
240
+ Example of a JSON response:
241
  [
242
  {{
243
  "document": "Document A",
244
+ "chapter": "Chapter 1",
245
  }},
246
  {{
247
  "document": "Document B",
248
+ "chapter": "Chapter 5",
249
  }}
250
  ]
251
+ """
climateqa/engine/chains/retrieve_documents.py CHANGED
@@ -127,6 +127,21 @@ def remove_duplicates_chunks(docs):
127
  result.append(doc)
128
  return result
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  async def get_POC_relevant_documents(
131
  query: str,
132
  vectorstore:VectorStore,
@@ -177,6 +192,86 @@ async def get_POC_relevant_documents(
177
  "docs_question" : docs_question,
178
  "docs_images" : docs_images
179
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
180
 
181
 
182
  async def get_IPCC_relevant_documents(
@@ -241,7 +336,6 @@ async def get_IPCC_relevant_documents(
241
  "report_type": { "$nin":["SPM"]},
242
  }
243
  docs_full = vectorstore.similarity_search_with_score(query=query,filter = filters_full,k = k_total)
244
- docs_full = vectorstore.similarity_search_with_score(query=query,filter = filters_full,k = k_total)
245
 
246
  if search_figures:
247
  # Images
@@ -280,6 +374,7 @@ def concatenate_documents(index, source_type, docs_question_dict, k_by_question,
280
  return docs_question, images_question
281
 
282
 
 
283
  # The chain callback is not necessary, but it propagates the langchain callbacks to the astream_events logger to display intermediate results
284
  # @chain
285
  async def retrieve_documents(
@@ -344,13 +439,10 @@ async def retrieve_documents(
344
  reports = reports,
345
  )
346
 
347
- # if source_type == "POC":
348
- #
349
-
350
  if source_type == 'POC':
351
  if by_toc == True:
352
  print("---- Retrieve documents by ToC----")
353
- docs_question_dict = await get_POC_by_ToC_relevant_documents(
354
  query=question,
355
  tocs = tocs,
356
  vectorstore=vectorstore,
@@ -469,6 +561,32 @@ async def retrieve_documents_for_all_questions(
469
  new_state["related_contents"].extend(images_question)
470
  return new_state
471
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
  def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
473
 
474
  async def retrieve_IPx_docs(state, config):
@@ -536,124 +654,6 @@ def make_POC_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_
536
  return retrieve_POC_docs_node
537
 
538
 
539
- # ToC Retriever
540
- async def get_relevant_toc_level_for_query(
541
- query: str,
542
- tocs: list[Document],
543
- ) -> list[dict] :
544
-
545
- doc_list = []
546
- for doc in tocs:
547
- doc_name = doc[0].metadata['name']
548
- toc = doc[0].page_content
549
- doc_list.append({'document': doc_name, 'toc': toc})
550
-
551
- llm = get_llm(provider="openai",max_tokens = 1024,temperature = 0.0)
552
-
553
- prompt = ChatPromptTemplate.from_template(retrieve_chapter_prompt_template)
554
- chain = prompt | llm | StrOutputParser()
555
- response = chain.invoke({"query": query, "doc_list": doc_list})
556
-
557
- try:
558
- relevant_tocs = eval(response)
559
- except Exception as e:
560
- print(f" Failed to parse the result because of : {e}")
561
-
562
- return relevant_tocs
563
-
564
-
565
- async def get_POC_by_ToC_relevant_documents(
566
- query: str,
567
- tocs: list[str],
568
- vectorstore:VectorStore,
569
- version: str = "",
570
- sources:list = ["Acclimaterra","PCAET","Plan Biodiversite"],
571
- search_figures:bool = False,
572
- search_only:bool = False,
573
- k_documents:int = 10,
574
- threshold:float = 0.6,
575
- k_images: int = 5,
576
- reports:list = [],
577
- min_size:int = 200,
578
- proportion: float = 0.5,
579
- ) :
580
- # Prepare base search kwargs
581
- filters = {}
582
- docs_question = []
583
- docs_images = []
584
-
585
- # TODO add source selection
586
- # if len(reports) > 0:
587
- # filters["short_name"] = {"$in":reports}
588
- # else:
589
- # filters["source"] = { "$in": sources}
590
-
591
- k_documents_toc = round(k_documents * proportion)
592
-
593
- relevant_tocs = await get_relevant_toc_level_for_query(query, tocs)
594
-
595
- print(f"Relevant ToCs : {relevant_tocs}")
596
- # Transform the ToC dict {"document": str, "chapter": str} into a list of string
597
- toc_filters = [toc['chapter'] for toc in relevant_tocs]
598
-
599
- filters_text_toc = {
600
- **filters,
601
- "chunk_type":"text",
602
- "toc_level0": {"$in": toc_filters},
603
- "version": version
604
- # "report_type": {}, # TODO to be completed to choose the right documents / chapters according to the analysis of the question
605
- }
606
-
607
- docs_question = vectorstore.similarity_search_with_score(query=query,filter = filters_text_toc,k = k_documents_toc)
608
-
609
- filters_text = {
610
- **filters,
611
- "chunk_type":"text",
612
- "version": version
613
- # "report_type": {}, # TODO to be completed to choose the right documents / chapters according to the analysis of the question
614
- }
615
-
616
- docs_question += vectorstore.similarity_search_with_score(query=query,filter = filters_text,k = k_documents - k_documents_toc)
617
-
618
- # remove duplicates or almost duplicates
619
- docs_question = remove_duplicates_chunks(docs_question)
620
- docs_question = [x for x in docs_question if x[1] > threshold]
621
-
622
- if search_figures:
623
- # Images
624
- filters_image = {
625
- **filters,
626
- "chunk_type":"image"
627
- }
628
- docs_images = vectorstore.similarity_search_with_score(query=query,filter = filters_image,k = k_images)
629
-
630
- docs_question, docs_images = _add_metadata_and_score(docs_question), _add_metadata_and_score(docs_images)
631
-
632
- docs_question = [x for x in docs_question if len(x.page_content) > min_size]
633
-
634
- return {
635
- "docs_question" : docs_question,
636
- "docs_images" : docs_images
637
- }
638
-
639
-
640
- def get_ToCs(version: str) :
641
-
642
- filters_text = {
643
- "chunk_type":"toc",
644
- "version": version
645
- }
646
- embeddings_function = get_embeddings_function()
647
- vectorstore = get_pinecone_vectorstore(embeddings_function, index_name="climateqa-v2")
648
- tocs = vectorstore.similarity_search_with_score(query="",filter = filters_text)
649
-
650
- # remove duplicates or almost duplicates
651
- tocs = remove_duplicates_chunks(tocs)
652
-
653
- return tocs
654
-
655
-
656
-
657
  def make_POC_by_ToC_retriever_node(
658
  vectorstore: VectorStore,
659
  reranker,
 
127
  result.append(doc)
128
  return result
129
 
130
+ def get_ToCs(version: str) :
131
+
132
+ filters_text = {
133
+ "chunk_type":"toc",
134
+ "version": version
135
+ }
136
+ embeddings_function = get_embeddings_function()
137
+ vectorstore = get_pinecone_vectorstore(embeddings_function, index_name="climateqa-v2")
138
+ tocs = vectorstore.similarity_search_with_score(query="",filter = filters_text)
139
+
140
+ # remove duplicates or almost duplicates
141
+ tocs = remove_duplicates_chunks(tocs)
142
+
143
+ return tocs
144
+
145
  async def get_POC_relevant_documents(
146
  query: str,
147
  vectorstore:VectorStore,
 
192
  "docs_question" : docs_question,
193
  "docs_images" : docs_images
194
  }
195
+
196
+ async def get_POC_documents_by_ToC_relevant_documents(
197
+ query: str,
198
+ tocs: list,
199
+ vectorstore:VectorStore,
200
+ version: str,
201
+ sources:list = ["Acclimaterra","PCAET","Plan Biodiversite"],
202
+ search_figures:bool = False,
203
+ search_only:bool = False,
204
+ k_documents:int = 10,
205
+ threshold:float = 0.6,
206
+ k_images: int = 5,
207
+ reports:list = [],
208
+ min_size:int = 200,
209
+ proportion: float = 0.5,
210
+ ) :
211
+ """
212
+ Args:
213
+ - tocs : list with the table of contents of each document
214
+ - version : version of the parsed documents (e.g. "v4")
215
+ - proportion : share of documents retrieved using ToCs
216
+ """
217
+ # Prepare base search kwargs
218
+ filters = {}
219
+ docs_question = []
220
+ docs_images = []
221
+
222
+ # TODO add source selection
223
+ # if len(reports) > 0:
224
+ # filters["short_name"] = {"$in":reports}
225
+ # else:
226
+ # filters["source"] = { "$in": sources}
227
+
228
+ k_documents_toc = round(k_documents * proportion)
229
+
230
+ relevant_tocs = await get_relevant_toc_level_for_query(query, tocs)
231
+
232
+ print(f"Relevant ToCs : {relevant_tocs}")
233
+ # Transform the ToC dict {"document": str, "chapter": str} into a list of string
234
+ toc_filters = [toc['chapter'] for toc in relevant_tocs]
235
+
236
+ filters_text_toc = {
237
+ **filters,
238
+ "chunk_type":"text",
239
+ "toc_level0": {"$in": toc_filters},
240
+ "version": version
241
+ # "report_type": {}, # TODO to be completed to choose the right documents / chapters according to the analysis of the question
242
+ }
243
+
244
+ docs_question = vectorstore.similarity_search_with_score(query=query,filter = filters_text_toc,k = k_documents_toc)
245
+
246
+ filters_text = {
247
+ **filters,
248
+ "chunk_type":"text",
249
+ "version": version
250
+ # "report_type": {}, # TODO to be completed to choose the right documents / chapters according to the analysis of the question
251
+ }
252
+
253
+ docs_question += vectorstore.similarity_search_with_score(query=query,filter = filters_text,k = k_documents - k_documents_toc)
254
+
255
+ # remove duplicates or almost duplicates
256
+ docs_question = remove_duplicates_chunks(docs_question)
257
+ docs_question = [x for x in docs_question if x[1] > threshold]
258
+
259
+ if search_figures:
260
+ # Images
261
+ filters_image = {
262
+ **filters,
263
+ "chunk_type":"image"
264
+ }
265
+ docs_images = vectorstore.similarity_search_with_score(query=query,filter = filters_image,k = k_images)
266
+
267
+ docs_question, docs_images = _add_metadata_and_score(docs_question), _add_metadata_and_score(docs_images)
268
+
269
+ docs_question = [x for x in docs_question if len(x.page_content) > min_size]
270
+
271
+ return {
272
+ "docs_question" : docs_question,
273
+ "docs_images" : docs_images
274
+ }
275
 
276
 
277
  async def get_IPCC_relevant_documents(
 
336
  "report_type": { "$nin":["SPM"]},
337
  }
338
  docs_full = vectorstore.similarity_search_with_score(query=query,filter = filters_full,k = k_total)
 
339
 
340
  if search_figures:
341
  # Images
 
374
  return docs_question, images_question
375
 
376
 
377
+
378
  # The chain callback is not necessary, but it propagates the langchain callbacks to the astream_events logger to display intermediate results
379
  # @chain
380
  async def retrieve_documents(
 
439
  reports = reports,
440
  )
441
 
 
 
 
442
  if source_type == 'POC':
443
  if by_toc == True:
444
  print("---- Retrieve documents by ToC----")
445
+ docs_question_dict = await get_POC_documents_by_ToC_relevant_documents(
446
  query=question,
447
  tocs = tocs,
448
  vectorstore=vectorstore,
 
561
  new_state["related_contents"].extend(images_question)
562
  return new_state
563
 
564
+ # ToC Retriever
565
+ async def get_relevant_toc_level_for_query(
566
+ query: str,
567
+ tocs: list[Document],
568
+ ) -> list[dict] :
569
+
570
+ doc_list = []
571
+ for doc in tocs:
572
+ doc_name = doc[0].metadata['name']
573
+ toc = doc[0].page_content
574
+ doc_list.append({'document': doc_name, 'toc': toc})
575
+
576
+ llm = get_llm(provider="openai",max_tokens = 1024,temperature = 0.0)
577
+
578
+ prompt = ChatPromptTemplate.from_template(retrieve_chapter_prompt_template)
579
+ chain = prompt | llm | StrOutputParser()
580
+ response = chain.invoke({"query": query, "doc_list": doc_list})
581
+
582
+ try:
583
+ relevant_tocs = eval(response)
584
+ except Exception as e:
585
+ print(f" Failed to parse the result because of : {e}")
586
+
587
+ return relevant_tocs
588
+
589
+
590
  def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
591
 
592
  async def retrieve_IPx_docs(state, config):
 
654
  return retrieve_POC_docs_node
655
 
656
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
657
  def make_POC_by_ToC_retriever_node(
658
  vectorstore: VectorStore,
659
  reranker,
climateqa/engine/graph.py CHANGED
@@ -19,7 +19,7 @@ from .chains.answer_ai_impact import make_ai_impact_node
19
  from .chains.query_transformation import make_query_transform_node
20
  from .chains.translation import make_translation_node
21
  from .chains.intent_categorization import make_intent_categorization_node
22
- from .chains.retrieve_documents import make_IPx_retriever_node, make_POC_retriever_node
23
  from .chains.answer_rag import make_rag_node
24
  from .chains.graph_retriever import make_graph_retriever_node
25
  from .chains.chitchat_categorization import make_chitchat_intent_categorization_node
@@ -211,8 +211,23 @@ def make_graph_agent(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_regi
211
  app = workflow.compile()
212
  return app
213
 
214
- def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_region, reranker, threshold_docs=0.2):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
 
 
216
  workflow = StateGraph(GraphState)
217
 
218
  # Define the node functions
@@ -223,7 +238,8 @@ def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_
223
  answer_ai_impact = make_ai_impact_node(llm)
224
  retrieve_documents = make_IPx_retriever_node(vectorstore_ipcc, reranker, llm)
225
  retrieve_graphs = make_graph_retriever_node(vectorstore_graphs, reranker)
226
- retrieve_local_data = make_POC_retriever_node(vectorstore_region, reranker, llm)
 
227
  answer_rag = make_rag_node(llm, with_docs=True)
228
  answer_rag_no_docs = make_rag_node(llm, with_docs=False)
229
  chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)
 
19
  from .chains.query_transformation import make_query_transform_node
20
  from .chains.translation import make_translation_node
21
  from .chains.intent_categorization import make_intent_categorization_node
22
+ from .chains.retrieve_documents import make_IPx_retriever_node, make_POC_retriever_node, make_POC_by_ToC_retriever_node
23
  from .chains.answer_rag import make_rag_node
24
  from .chains.graph_retriever import make_graph_retriever_node
25
  from .chains.chitchat_categorization import make_chitchat_intent_categorization_node
 
211
  app = workflow.compile()
212
  return app
213
 
214
+ def make_graph_agent_poc(llm, vectorstore_ipcc, vectorstore_graphs, vectorstore_region, reranker, version:str, threshold_docs=0.2):
215
+ """_summary_
216
+
217
+ Args:
218
+ llm (_type_): _description_
219
+ vectorstore_ipcc (_type_): _description_
220
+ vectorstore_graphs (_type_): _description_
221
+ vectorstore_region (_type_): _description_
222
+ reranker (_type_): _description_
223
+ version (str): version of the parsed documents (e.g "v4")
224
+ threshold_docs (float, optional): _description_. Defaults to 0.2.
225
+
226
+ Returns:
227
+ _type_: _description_
228
+ """
229
 
230
+
231
  workflow = StateGraph(GraphState)
232
 
233
  # Define the node functions
 
238
  answer_ai_impact = make_ai_impact_node(llm)
239
  retrieve_documents = make_IPx_retriever_node(vectorstore_ipcc, reranker, llm)
240
  retrieve_graphs = make_graph_retriever_node(vectorstore_graphs, reranker)
241
+ # retrieve_local_data = make_POC_retriever_node(vectorstore_region, reranker, llm)
242
+ retrieve_local_data = make_POC_by_ToC_retriever_node(vectorstore_region, reranker, llm, version=version)
243
  answer_rag = make_rag_node(llm, with_docs=True)
244
  answer_rag_no_docs = make_rag_node(llm, with_docs=False)
245
  chitchat_categorize_intent = make_chitchat_intent_categorization_node(llm)