Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(QueryExecTracker): store and get last log id from query tracker #733

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

ArslanSaleem
Copy link
Collaborator

@ArslanSaleem ArslanSaleem commented Nov 7, 2023

Summary by CodeRabbit

  • New Features
    • Introduced a new property last_query_log_id to track the last query log ID across multiple classes.
  • Refactor
    • Updated add_query_info method to accept conversation_id as a string.
    • Enhanced publish method to parse response and update the last log ID.

Copy link
Contributor

coderabbitai bot commented Nov 7, 2023

Walkthrough

The recent changes primarily focus on tracking the last query log ID in the pandasai system. The QueryExecTracker class now stores the last log ID, and this information is made accessible through new properties in the Agent, SmartDataFrame, and SmartDataLake classes.

Changes

File Path Change Summary
pandasai/agent/init.py Added a new property last_query_log_id to return the last query log ID.
pandasai/helpers/query_exec_tracker.py Added json and uuid imports, modified add_query_info method, added _last_log_id attribute, modified publish method to update _last_log_id, and added last_log_id property.
pandasai/smart_dataframe/init.py Added a new property last_query_log_id to return the last query log ID.
pandasai/smart_datalake/init.py Added a new property last_query_log_id to return the last query log ID.

Poem

🍂 As the leaves fall, changes come, 🍁

In the code of pandasai, under the autumn sun. 🌞

Tracking queries, log IDs in sight, 📝

Making data lakes smart, oh what a delight! 🏞️

On this day in history, magic was spun, 🎩

Just like our code, evolving and never done. 💻

So here's to the coders, in the light or the dark, 🌓

Your creations are poetry, each line a spark. ✨


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • If you reply to a review comment from CodeRabbit, the bot will automatically respond.
  • To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment
  • Note: Review comments are made on code diffs or files, not on the PR overview.
  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai help to get help.
  • @coderabbitai resolve to resolve all the CodeRabbit review comments.

Note: For conversation with the bot, please use the review comments on code diffs or files.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between d7a7b18 and 34152c1.
Files selected for processing (4)
  • pandasai/agent/init.py (1 hunks)
  • pandasai/helpers/query_exec_tracker.py (7 hunks)
  • pandasai/smart_dataframe/init.py (1 hunks)
  • pandasai/smart_datalake/init.py (1 hunks)
Additional comments: 10
pandasai/agent/__init__.py (1)
  • 209-215: The new property last_query_log_id is correctly retrieving the value from _lake.last_query_log_id. Ensure that the _lake object is always initialized before this property is accessed to avoid potential AttributeError.
pandasai/smart_dataframe/__init__.py (2)
  • 703-704: Ensure that the sample_head argument is a valid pandas DataFrame before converting it to CSV.

  • 706-708: The new property last_query_log_id is correctly retrieving the value from the _lake attribute.

pandasai/smart_datalake/__init__.py (1)
  • 777-783: The new property last_query_log_id is correctly implemented and retrieves the last log ID from the _query_exec_tracker as expected.
pandasai/helpers/query_exec_tracker.py (6)
  • 1-9: The new imports json and uuid are used correctly in the code.

  • 32-35: The new attribute _last_log_id is initialized correctly in the start_new_track method and updated in the publish method.

  • 54-64: > Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [56-75]

The add_query_info method now accepts conversation_id as uuid.UUID and stores it as a string. This change is consistent with the rest of the code.

  • 83-84: The _last_log_id attribute is correctly reset in the start_new_track method.

  • 275-281: The publish method has been updated to parse the response and update the _last_log_id. Ensure that the response from the server always contains the data field and that it is not None.

  • 290-296: The last_log_id property is correctly implemented to retrieve the _last_log_id.

@gventuri gventuri merged commit 3b6378c into main Nov 7, 2023
9 checks passed
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