fix: circular `db` import
Browse files- app.py +1 -0
- db/connection.py +3 -0
- tools/__init__.py +0 -3
- tools/driver_performance.py +2 -1
- tools/event_performance.py +2 -1
- tools/telemetry_analysis.py +2 -1
- tools/tyre_performance.py +2 -1
- tools/weather_impact.py +2 -4
app.py
CHANGED
@@ -11,6 +11,7 @@ from langchain_google_genai import ChatGoogleGenerativeAI
|
|
11 |
from gradio import ChatMessage
|
12 |
import textwrap
|
13 |
from tools import *
|
|
|
14 |
load_dotenv()
|
15 |
os.environ['LANGCHAIN_PROJECT'] = 'gradio-test'
|
16 |
|
|
|
11 |
from gradio import ChatMessage
|
12 |
import textwrap
|
13 |
from tools import *
|
14 |
+
from db.connection import db
|
15 |
load_dotenv()
|
16 |
os.environ['LANGCHAIN_PROJECT'] = 'gradio-test'
|
17 |
|
db/connection.py
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
from langchain_community.utilities import SQLDatabase
|
2 |
+
|
3 |
+
db = SQLDatabase.from_uri("sqlite:///db/Bahrain_2023_Q.db")
|
tools/__init__.py
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
from langchain_community.utilities import SQLDatabase
|
2 |
from rich.console import Console
|
3 |
from .driver_performance import GetDriverPerformance
|
4 |
from .event_performance import GetEventPerformance
|
@@ -8,8 +7,6 @@ from .weather_impact import GetWeatherImpact
|
|
8 |
|
9 |
console = Console(style="chartreuse1 on grey7")
|
10 |
|
11 |
-
db = SQLDatabase.from_uri("sqlite:///db/Bahrain_2023_Q.db")
|
12 |
-
|
13 |
__all__ = [
|
14 |
"GetDriverPerformance",
|
15 |
"GetEventPerformance",
|
|
|
|
|
1 |
from rich.console import Console
|
2 |
from .driver_performance import GetDriverPerformance
|
3 |
from .event_performance import GetEventPerformance
|
|
|
7 |
|
8 |
console = Console(style="chartreuse1 on grey7")
|
9 |
|
|
|
|
|
10 |
__all__ = [
|
11 |
"GetDriverPerformance",
|
12 |
"GetEventPerformance",
|
tools/driver_performance.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from langchain_core.tools import BaseTool
|
3 |
-
from . import db
|
|
|
4 |
|
5 |
|
6 |
class GetDriverPerformanceOutput(BaseModel):
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from langchain_core.tools import BaseTool
|
3 |
+
from db.connection import db
|
4 |
+
from . import console
|
5 |
|
6 |
|
7 |
class GetDriverPerformanceOutput(BaseModel):
|
tools/event_performance.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
-
from . import db
|
|
|
5 |
|
6 |
|
7 |
class GetEventPerformanceOutput(BaseModel):
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
+
from db.connection import db
|
5 |
+
from . import console
|
6 |
|
7 |
|
8 |
class GetEventPerformanceOutput(BaseModel):
|
tools/telemetry_analysis.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
-
from . import db
|
|
|
5 |
|
6 |
|
7 |
class GetTelemetryAndWeatherInput(BaseModel):
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
+
from db.connection import db
|
5 |
+
from . import console
|
6 |
|
7 |
|
8 |
class GetTelemetryAndWeatherInput(BaseModel):
|
tools/tyre_performance.py
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
-
from . import db
|
|
|
5 |
|
6 |
|
7 |
class GetTyrePerformanceInput(BaseModel):
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
+
from db.connection import db
|
5 |
+
from . import console
|
6 |
|
7 |
|
8 |
class GetTyrePerformanceInput(BaseModel):
|
tools/weather_impact.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
-
from
|
5 |
-
from . import
|
6 |
-
|
7 |
-
console = Console(style="chartreuse1 on grey7")
|
8 |
|
9 |
|
10 |
class GetWeatherImpactInput(BaseModel):
|
|
|
1 |
from pydantic import BaseModel, Field
|
2 |
from typing import Type
|
3 |
from langchain_core.tools import BaseTool
|
4 |
+
from db.connection import db
|
5 |
+
from . import console
|
|
|
|
|
6 |
|
7 |
|
8 |
class GetWeatherImpactInput(BaseModel):
|