timeki commited on
Commit
6e717b7
·
1 Parent(s): 3b1d4b4

minor clean

Browse files
Files changed (1) hide show
  1. climateqa/engine/graph.py +3 -27
climateqa/engine/graph.py CHANGED
@@ -39,14 +39,14 @@ class GraphState(TypedDict):
39
  n_questions : int
40
  answer: str
41
  audience: str = "experts"
42
- sources_input: List[str] = ["IPCC","IPBES"]
43
  relevant_content_sources_selection: List[str] = ["Figures (IPCC/IPBES)"]
44
  sources_auto: bool = True
45
  min_year: int = 1960
46
  max_year: int = None
47
  documents: Annotated[List[Document], operator.add]
48
- related_contents : Annotated[List[Document], operator.add]
49
- recommended_content : List[Document]
50
  search_only : bool = False
51
  reports : List[str] = []
52
 
@@ -95,20 +95,10 @@ def route_based_on_relevant_docs(state,threshold_docs=0.2):
95
  def route_continue_retrieve_documents(state):
96
  index_question_ipx = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "IPx"]
97
  questions_ipx_finished = all(elem in state["handled_questions_index"] for elem in index_question_ipx)
98
- # if questions_ipx_finished and state["search_only"]:
99
- # return END
100
  if questions_ipx_finished:
101
  return "end_retrieve_IPx_documents"
102
  else:
103
  return "retrieve_documents"
104
-
105
-
106
- # if state["n_questions"]["IPx"] == len(state["handled_questions_index"]) and state["search_only"] :
107
- # return END
108
- # elif state["n_questions"]["IPx"] == len(state["handled_questions_index"]):
109
- # return "answer_search"
110
- # else :
111
- # return "retrieve_documents"
112
 
113
  def route_continue_retrieve_local_documents(state):
114
  index_question_poc = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "POC"]
@@ -120,20 +110,6 @@ def route_continue_retrieve_local_documents(state):
120
  else:
121
  return "retrieve_local_data"
122
 
123
- # if state["n_questions"]["POC"] == len(state["handled_questions_index"]) and state["search_only"] :
124
- # return END
125
- # elif state["n_questions"]["POC"] == len(state["handled_questions_index"]):
126
- # return "answer_search"
127
- # else :
128
- # return "retrieve_local_data"
129
-
130
- # if len(state["remaining_questions"]) == 0 and state["search_only"] :
131
- # return END
132
- # elif len(state["remaining_questions"]) > 0:
133
- # return "retrieve_documents"
134
- # else:
135
- # return "answer_search"
136
-
137
  def route_retrieve_documents(state):
138
  sources_to_retrieve = []
139
 
 
39
  n_questions : int
40
  answer: str
41
  audience: str = "experts"
42
+ sources_input: List[str] = ["IPCC","IPBES"] # Deprecated -> used only graphs that can only be OWID
43
  relevant_content_sources_selection: List[str] = ["Figures (IPCC/IPBES)"]
44
  sources_auto: bool = True
45
  min_year: int = 1960
46
  max_year: int = None
47
  documents: Annotated[List[Document], operator.add]
48
+ related_contents : Annotated[List[Document], operator.add] # Images
49
+ recommended_content : List[Document] # OWID Graphs # TODO merge with related_contents
50
  search_only : bool = False
51
  reports : List[str] = []
52
 
 
95
  def route_continue_retrieve_documents(state):
96
  index_question_ipx = [i for i, x in enumerate(state["questions_list"]) if x["source_type"] == "IPx"]
97
  questions_ipx_finished = all(elem in state["handled_questions_index"] for elem in index_question_ipx)
 
 
98
  if questions_ipx_finished:
99
  return "end_retrieve_IPx_documents"
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"]
 
110
  else:
111
  return "retrieve_local_data"
112
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
113
  def route_retrieve_documents(state):
114
  sources_to_retrieve = []
115