Merge branch 'main' of https://huggingface.co/spaces/Ekimetrics/climate-question-answering
Browse files
climateqa/engine/talk_to_data/workflow.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import os
|
2 |
|
3 |
-
from typing import Any, Callable,
|
4 |
import pandas as pd
|
5 |
|
6 |
from plotly.graph_objects import Figure
|
@@ -35,9 +35,9 @@ class TableState(TypedDict):
|
|
35 |
"""
|
36 |
table_name: str
|
37 |
params: dict[str, Any]
|
38 |
-
sql_query:
|
39 |
-
dataframe:
|
40 |
-
figure:
|
41 |
status: str
|
42 |
|
43 |
class PlotState(TypedDict):
|
@@ -59,7 +59,7 @@ class State(TypedDict):
|
|
59 |
user_input: str
|
60 |
plots: list[str]
|
61 |
plot_states: dict[str, PlotState]
|
62 |
-
error:
|
63 |
|
64 |
async def drias_workflow(user_input: str) -> State:
|
65 |
"""Performs the complete workflow of Talk To Drias : from user input to sql queries, dataframes and figures generated
|
@@ -187,8 +187,8 @@ async def find_param(state: State, param_name:str, table: str) -> dict[str, Any]
|
|
187 |
|
188 |
class Location(TypedDict):
|
189 |
location: str
|
190 |
-
latitude:
|
191 |
-
longitude:
|
192 |
|
193 |
async def find_location(user_input: str, table: str) -> Location:
|
194 |
print(f"---- Find location in table {table} ----")
|
|
|
1 |
import os
|
2 |
|
3 |
+
from typing import Any, Callable, TypedDict, Optional
|
4 |
import pandas as pd
|
5 |
|
6 |
from plotly.graph_objects import Figure
|
|
|
35 |
"""
|
36 |
table_name: str
|
37 |
params: dict[str, Any]
|
38 |
+
sql_query: Optional[str]
|
39 |
+
dataframe: Optional[pd.DataFrame | None]
|
40 |
+
figure: Optional[Callable[..., Figure]]
|
41 |
status: str
|
42 |
|
43 |
class PlotState(TypedDict):
|
|
|
59 |
user_input: str
|
60 |
plots: list[str]
|
61 |
plot_states: dict[str, PlotState]
|
62 |
+
error: Optional[str]
|
63 |
|
64 |
async def drias_workflow(user_input: str) -> State:
|
65 |
"""Performs the complete workflow of Talk To Drias : from user input to sql queries, dataframes and figures generated
|
|
|
187 |
|
188 |
class Location(TypedDict):
|
189 |
location: str
|
190 |
+
latitude: Optional[str]
|
191 |
+
longitude: Optional[str]
|
192 |
|
193 |
async def find_location(user_input: str, table: str) -> Location:
|
194 |
print(f"---- Find location in table {table} ----")
|
requirements.txt
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
gradio==5.0.2
|
2 |
azure-storage-file-share==12.11.1
|
3 |
-
azure-storage-blob
|
4 |
python-dotenv==1.0.0
|
5 |
langchain==0.2.1
|
6 |
langchain_openai==0.1.7
|
7 |
langgraph==0.2.70
|
8 |
pinecone-client==4.1.0
|
9 |
sentence-transformers==2.6.0
|
10 |
-
huggingface-hub
|
11 |
pyalex==0.13
|
12 |
networkx==3.2.1
|
13 |
pyvis==0.3.2
|
@@ -20,4 +20,8 @@ msal==1.31
|
|
20 |
matplotlib==3.9.2
|
21 |
gradio-modal==0.0.4
|
22 |
vanna==0.7.5
|
23 |
-
geopy==2.4.1
|
|
|
|
|
|
|
|
|
|
1 |
gradio==5.0.2
|
2 |
azure-storage-file-share==12.11.1
|
3 |
+
azure-storage-blob==12.23.0
|
4 |
python-dotenv==1.0.0
|
5 |
langchain==0.2.1
|
6 |
langchain_openai==0.1.7
|
7 |
langgraph==0.2.70
|
8 |
pinecone-client==4.1.0
|
9 |
sentence-transformers==2.6.0
|
10 |
+
huggingface-hub==0.25.2
|
11 |
pyalex==0.13
|
12 |
networkx==3.2.1
|
13 |
pyvis==0.3.2
|
|
|
20 |
matplotlib==3.9.2
|
21 |
gradio-modal==0.0.4
|
22 |
vanna==0.7.5
|
23 |
+
geopy==2.4.1
|
24 |
+
duckdb==1.2.1
|
25 |
+
openai==1.61.1
|
26 |
+
pydantic==2.9.2
|
27 |
+
pydantic-settings==2.2.1
|