timeki commited on
Commit
feeccc7
·
1 Parent(s): 8bd064f

Small clean POC Local

Browse files
climateqa/engine/chains/retrieve_documents.py CHANGED
@@ -621,10 +621,7 @@ def make_IPx_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_
621
 
622
  def make_POC_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
623
 
624
- async def retrieve_POC_docs_node(state, config):
625
- if "POC region" not in state["relevant_content_sources_selection"] :
626
- return {}
627
-
628
  source_type = "POC"
629
  POC_questions_index = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "POC"]
630
 
@@ -665,10 +662,7 @@ def make_POC_by_ToC_retriever_node(
665
  k_summary=5,
666
  ):
667
 
668
- async def retrieve_POC_docs_node(state, config):
669
- if "POC region" not in state["relevant_content_sources_selection"] :
670
- return {}
671
-
672
  search_figures = "Figures (IPCC/IPBES)" in state["relevant_content_sources_selection"]
673
  search_only = state["search_only"]
674
  search_only = state["search_only"]
 
621
 
622
  def make_POC_retriever_node(vectorstore,reranker,llm,rerank_by_question=True, k_final=15, k_before_reranking=100, k_summary=5):
623
 
624
+ async def retrieve_POC_docs_node(state, config):
 
 
 
625
  source_type = "POC"
626
  POC_questions_index = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "POC"]
627
 
 
662
  k_summary=5,
663
  ):
664
 
665
+ async def retrieve_POC_docs_node(state, config):
 
 
 
666
  search_figures = "Figures (IPCC/IPBES)" in state["relevant_content_sources_selection"]
667
  search_only = state["search_only"]
668
  search_only = state["search_only"]
climateqa/engine/graph.py CHANGED
@@ -100,15 +100,6 @@ def route_continue_retrieve_documents(state):
100
  else:
101
  return "retrieve_documents"
102
 
103
- def route_continue_retrieve_local_documents(state):
104
- index_question_poc = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "POC"]
105
- questions_poc_finished = all(elem in state["handled_questions_index"] for elem in index_question_poc)
106
- # if questions_poc_finished and state["search_only"]:
107
- # return END
108
- if questions_poc_finished or ("POC region" not in state["relevant_content_sources_selection"]):
109
- return "end_retrieve_local_documents"
110
- else:
111
- return "retrieve_local_data"
112
 
113
  def route_retrieve_documents(state):
114
  sources_to_retrieve = []
 
100
  else:
101
  return "retrieve_documents"
102
 
 
 
 
 
 
 
 
 
 
103
 
104
  def route_retrieve_documents(state):
105
  sources_to_retrieve = []
front/tabs/chat_interface.py CHANGED
@@ -21,21 +21,21 @@ What do you want to learn ?
21
  """
22
 
23
  init_prompt_poc = """
24
- Hello, I am ClimateQ&A, a conversational assistant designed to help you understand climate change and biodiversity loss. I will answer your questions by **sifting through the IPCC and IPBES scientific reports, PCAET of Paris, the Plan Biodiversité 2018-2024, and Acclimaterra reports from la Région Nouvelle-Aquitaine **.
25
 
26
- How to use
27
- - **Language**: You can ask me your questions in any language.
28
- - **Audience**: You can specify your audience (children, general public, experts) to get a more adapted answer.
29
- - **Sources**: You can choose to search in the IPCC or IPBES reports, and POC sources for local documents (PCAET, Plan Biodiversité, Acclimaterra).
30
- - **Relevant content sources**: You can choose to search for figures, papers, or graphs that can be relevant for your question.
31
 
32
  ⚠️ Limitations
33
- *Please note that the AI is not perfect and may sometimes give irrelevant answers. If you are not satisfied with the answer, please ask a more specific question or report your feedback to help us improve the system.*
34
 
35
- 🛈 Information
36
- Please note that we log your questions for meta-analysis purposes, so avoid sharing any sensitive or personal information.
37
 
38
- What do you want to learn ?
39
  """
40
 
41
 
 
21
  """
22
 
23
  init_prompt_poc = """
24
+ Bonjour, je suis ClimateQ&A, un assistant conversationnel conçu pour vous aider à comprendre le changement climatique et la perte de biodiversité. Je réponds à vos questions en **parcourant les rapports scientifiques du GIEC et de l'IPBES, le PCAET de Paris, le Plan Biodiversité 2018-2024, et les rapports Acclimaterra de la Région Nouvelle-Aquitaine**.
25
 
26
+ Mode d'emploi
27
+ - **Language** : Vous pouvez me poser vos questions dans n'importe quelle langue.
28
+ - **Audience** : Vous pouvez préciser votre public (enfants, grand public, experts) pour obtenir une réponse plus adaptée.
29
+ - **Sources** : Vous pouvez choisir de chercher dans les rapports du GIEC ou de l'IPBES, et dans les sources POC pour les documents locaux (PCAET, Plan Biodiversité, Acclimaterra).
30
+ - **Relevant content sources** : Vous pouvez choisir de rechercher des images, des papiers scientifiques ou des graphiques qui peuvent être pertinents pour votre question.
31
 
32
  ⚠️ Limitations
33
+ *Veuillez noter que l'IA n'est pas parfaite et peut parfois donner des réponses non pertinentes. Si vous n'êtes pas satisfait de la réponse, veuillez poser une question plus précise ou nous faire part de vos commentaires pour nous aider à améliorer le système.*
34
 
35
+ 🛈 Informations
36
+ Veuillez noter que nous enregistrons vos questions à des fins de méta-analyse, évitez donc de partager toute information sensible ou personnelle.
37
 
38
+ Que voulez-vous apprendre ?
39
  """
40
 
41
 
front/tabs/tab_config.py CHANGED
@@ -37,9 +37,9 @@ def create_config_modal():
37
  )
38
 
39
  dropdown_external_sources = gr.CheckboxGroup(
40
- choices=["Figures (IPCC/IPBES)", "Papers (OpenAlex)", "Graphs (OurWorldInData)","POC region"],
41
  label="Select database to search for relevant content",
42
- value=["Figures (IPCC/IPBES)","POC region"],
43
  interactive=True
44
  )
45
 
 
37
  )
38
 
39
  dropdown_external_sources = gr.CheckboxGroup(
40
+ choices=["Figures (IPCC/IPBES)", "Papers (OpenAlex)", "Graphs (OurWorldInData)"],
41
  label="Select database to search for relevant content",
42
+ value=["Figures (IPCC/IPBES)"],
43
  interactive=True
44
  )
45