Skip to content

Validated Bigframes.pands package to query BQ#1

Open
alexhumpy98 wants to merge 5 commits into
sunholo-data:devfrom
jpramos:feature/reading_bq_table
Open

Validated Bigframes.pands package to query BQ#1
alexhumpy98 wants to merge 5 commits into
sunholo-data:devfrom
jpramos:feature/reading_bq_table

Conversation

@alexhumpy98

@alexhumpy98 alexhumpy98 commented Feb 19, 2024

Copy link
Copy Markdown
  • Created "BQ-agent" directory by coping "csv-agent" director
  • agent_pandas.py contains agent reading from BQ table: annular-form-389809.merged_data.crm_ga4
  • Using create_pands_datagrame_agent function from langchain

Ellipsis 🚀 This PR description was created by Ellipsis for commit 63a7879.

Summary:

This PR introduces a new 'BQ-agent' that reads a BigQuery table into a pandas dataframe, creates a pandas dataframe agent, and provides instructions on how to use the new package.

Key points:

  • Created a new 'BQ-agent' directory, which is a copy of the 'csv-agent' directory.
  • The agent.py file reads a BigQuery table into a pandas dataframe using the bigframes.pandas package.
  • The dataframe is used to create a pandas dataframe agent.
  • The agent executor is defined and can be invoked with a question.
  • The README file provides instructions on how to use the new package.
  • The ingest.py file creates a vectorstore index from a CSV file.
  • The main.py file invokes the agent executor with a question.
  • The kaggle.json file contains sensitive information and should be removed.
  • The change in the csv_agent/agent.py file is just a newline at the end of the file.

Generated with ❤️ by ellipsis.dev

Comment thread big_frames_test.ipynb Outdated
Comment thread langserve/packages/bq-agent/README.md Outdated

# csv-agent

This template uses a [csv agent](https://python.langchain.com/docs/integrations/toolkits/csv) with tools (Python REPL) and memory (vectorstore) for interaction (question-answering) with text data.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need some docs on bq-agent

)
tools = [repl, retriever_tool]
agent = OpenAIFunctionsAgent(
llm=ChatOpenAI(temperature=0, model="gpt-4"), prompt=prompt, tools=tools

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this model doesn't have a large context window (8k ?)

from langchain.indexes import VectorstoreIndexCreator
from langchain.vectorstores import FAISS

loader = CSVLoader("/Users/harrisonchase/Downloads/titanic.csv")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is not needed?

@@ -0,0 +1,37 @@
[tool.poetry]
name = "csv-agent"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs to be updated to bq_agent for langserve to work

langchain-cli = ">=0.0.15"

[tool.langserve]
export_module = "csv_agent"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this needs updating too, to bq_agent

Comment thread langserve/packages/bq-agent/pyproject.toml

@MarkEdmondson1234 MarkEdmondson1234 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexhumpy98 can the bq_agent/dev folder be ignored too?

@ellipsis-dev ellipsis-dev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❌ Changes requested.

  • Reviewed the entire pull request up to 63a7879
  • Looked at 181 lines of code in 8 files
  • Took 1 minute and 26 seconds to review
More info
  • Skipped 6 files when reviewing.
  • Skipped posting 4 additional comments because they didn't meet confidence threshold of 50%.
1. /langserve/packages/bq-agent/bq_agent/agent.py:21:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    Consider parameterizing the SQL query or making it more dynamic to increase the flexibility and robustness of the agent.
  • Reasoning:
    The bq_agent/agent.py file contains a hardcoded SQL query. This could be a problem if the table structure or the database changes. It also limits the flexibility of the agent.
2. /langserve/packages/bq-agent/bq_agent/agent.py:27:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    Consider removing the hardcoded question or making it more dynamic to increase the flexibility of the agent.
  • Reasoning:
    The bq_agent/agent.py file contains a hardcoded question 'How many rows are there in this dataframe?'. This could be a problem if the agent is supposed to handle different types of questions.
3. /langserve/packages/bq-agent/ingest.py:5:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    Consider parameterizing the file path or making it more dynamic to increase the flexibility and robustness of the agent.
  • Reasoning:
    The ingest.py file contains a hardcoded path to a CSV file. This could be a problem if the file location changes or if the agent is supposed to handle different files.
4. /langserve/packages/bq-agent/main.py:4:
  • Assessed confidence : 100%
  • Grade: 0%
  • Comment:
    Consider removing the hardcoded question or making it more dynamic to increase the flexibility of the agent.
  • Reasoning:
    The main.py file contains a hardcoded question 'how many unique users are there?'. This could be a problem if the agent is supposed to handle different types of questions.

Workflow ID: wflow_uKs5hpo0BST7zUD7


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. We'll respond in a few minutes. Learn more here.

@@ -0,0 +1,71 @@

# csv-agent

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The title of the README.md file should be updated to reflect the correct package name. Consider changing 'csv-agent' to 'bq-agent'.

@@ -0,0 +1 @@
{"username":"alexanderhumpert","key":"ecebeed6b450fd85320b282a494866bd"} No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensitive information such as usernames and keys should not be stored in plaintext. Consider using environment variables or a secure method of storing these values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants