- import pandas as pd
- from langchain.agents import create_pandas_dataframe_agent
- from langchain.chat_models import ChatOpenAI
- from langchain.llms import OpenAI
- from langchain.agents import create_csv_agent
- from langchain.agents.agent_types import AgentType
- import openai
- import tiktoken
- import os
- os.environ["OPENAI_API_KEY"] = "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"
- openai.api_key="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"
- # csv_agent = create_csv_agent(ChatOpenAI(temperature=0), 'Page2.csv', verbose=True,return_intermediate_steps=True, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION)
- # response = csv_agent({"input":"Give me Total net revenue for 1Q23,4Q22,3Q22"})
- # print(response["output"])
- model_id = "gpt-3.5-turbo"
- df = pd.read_csv('Page2.csv', encoding= 'unicode_escape')
- # print(df.columns)
- llm = OpenAI(temperature=0,model_name="gpt-3.5-turbo")
- agent = create_pandas_dataframe_agent(
- llm,
- df,
- verbose=True
- )
- agent.run("From selected income statement row could you provide Total net revenue for 1Q23,4Q22,3Q22")
[text] xl
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
Editor
You can edit this paste and save as new: