jcnok commited on
Commit
85c2e3b
·
verified ·
1 Parent(s): 6c37ec2
Files changed (1) hide show
  1. utils.py +19 -19
utils.py CHANGED
@@ -1,20 +1,20 @@
1
- ##from langchain.agents import create_pandas_dataframe_agent #This import has been recently replaced by the below
2
- from langchain_experimental.agents import create_pandas_dataframe_agent
3
- import pandas as pd
4
- #from langchain.llms import OpenAI
5
- #New import from langchain, which replaces the above
6
- from langchain_openai import OpenAI
7
-
8
- def query_agent(data, query):
9
-
10
- # Parse the CSV file and create a Pandas DataFrame from its contents.
11
- df = pd.read_csv(data)
12
-
13
- llm = OpenAI()
14
-
15
- # Create a Pandas DataFrame agent.
16
- agent = create_pandas_dataframe_agent(llm, df, verbose=True)
17
-
18
- #Python REPL: A Python shell used to evaluating and executing Python commands.
19
- #It takes python code as input and outputs the result. The input python code can be generated from another tool in the LangChain
20
  return agent.invoke(query)
 
1
+ ##from langchain.agents import create_pandas_dataframe_agent #This import has been recently replaced by the below
2
+ from langchain_experimental.agents import create_pandas_dataframe_agent
3
+ import pandas as pd
4
+ #from langchain.llms import OpenAI
5
+ #New import from langchain, which replaces the above
6
+ from langchain_openai import OpenAI
7
+
8
+ def query_agent(data, query):
9
+
10
+ # Parse the CSV file and create a Pandas DataFrame from its contents.
11
+ df = pd.read_csv(data)
12
+
13
+ llm = OpenAI("gpt-3.5-turbo")
14
+
15
+ # Create a Pandas DataFrame agent.
16
+ agent = create_pandas_dataframe_agent(llm, df, verbose=True)
17
+
18
+ #Python REPL: A Python shell used to evaluating and executing Python commands.
19
+ #It takes python code as input and outputs the result. The input python code can be generated from another tool in the LangChain
20
  return agent.invoke(query)