Fix for python 3.10
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} ----")
|