Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -13,11 +13,7 @@ import numpy as np
|
|
| 13 |
|
| 14 |
from langchain.agents import AgentExecutor
|
| 15 |
from langchain.agents.agent_types import AgentType
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
from langchain_community.agent_toolkits import create_sql_agent
|
| 19 |
-
from langchain_community.utilities import SQLDatabase
|
| 20 |
-
from sqlalchemy import create_engine
|
| 21 |
|
| 22 |
from deep_translator import GoogleTranslator
|
| 23 |
|
|
@@ -71,22 +67,13 @@ async def on_chat_start():
|
|
| 71 |
llm = HuggingFaceEndpoint(
|
| 72 |
repo_id=repo_id, temperature=1.0
|
| 73 |
)
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
#agent = create_csv_agent(
|
| 84 |
-
# llm,
|
| 85 |
-
# "https://cipen.univ-gustave-eiffel.fr/typo3conf/ext/cipen_package/Resources/Public/Dataviz/datalab/crossfilterings/EmploisRome/" + selectRomes[1:] + ".csv",
|
| 86 |
-
# verbose=False,
|
| 87 |
-
# agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 88 |
-
# max_iterations=5,
|
| 89 |
-
#)
|
| 90 |
cl.user_session.set("runnable", agent)
|
| 91 |
|
| 92 |
@cl.on_message
|
|
|
|
| 13 |
|
| 14 |
from langchain.agents import AgentExecutor
|
| 15 |
from langchain.agents.agent_types import AgentType
|
| 16 |
+
from langchain_experimental.agents.agent_toolkits import create_csv_agent
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
from deep_translator import GoogleTranslator
|
| 19 |
|
|
|
|
| 67 |
llm = HuggingFaceEndpoint(
|
| 68 |
repo_id=repo_id, temperature=1.0
|
| 69 |
)
|
| 70 |
+
agent = create_csv_agent(
|
| 71 |
+
llm,
|
| 72 |
+
"https://cipen.univ-gustave-eiffel.fr/typo3conf/ext/cipen_package/Resources/Public/Dataviz/datalab/crossfilterings/EmploisRome/" + selectRomes[1:] + ".csv",
|
| 73 |
+
verbose=False,
|
| 74 |
+
agent_type=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 75 |
+
max_iterations=5,
|
| 76 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
cl.user_session.set("runnable", agent)
|
| 78 |
|
| 79 |
@cl.on_message
|