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

feat(sandbox): add sandbox support in pai.chat and df.chat #1595

Merged
merged 3 commits into from
Feb 6, 2025

Conversation

ArslanSaleem
Copy link
Collaborator

@ArslanSaleem ArslanSaleem commented Feb 6, 2025

Important

Add sandbox support to pai.chat and df.chat for secure code execution, with updated documentation and tests.

  • Behavior:
    • Add optional sandbox parameter to chat() in pandasai/__init__.py and pandasai/dataframe/base.py for secure code execution.
    • Update README.md with Docker sandbox usage instructions.
  • Testing:
    • Add unit tests in test_dataframe.py and test_pandasai_init.py to verify sandbox parameter handling in chat().
    • Ensure Agent is called with sandbox in tests.

This description was created by Ellipsis for 71ac630. It will automatically update as commits are pushed.

@ArslanSaleem ArslanSaleem requested a review from gventuri February 6, 2025 15:07
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 818eadd in 1 minute and 45 seconds

More details
  • Looked at 222 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. pandasai/dataframe/base.py:104
  • Draft comment:
    Typo in docstring: change 'securily' to 'securely'.
  • Reason this comment was not posted:
    Marked as duplicate.
2. pandasai/__init__.py:167
  • Draft comment:
    Typo in docstring: 'securily' should be 'securely'.
  • Reason this comment was not posted:
    Marked as duplicate.
3. pandasai/__init__.py:31
  • Draft comment:
    Duplicate import of 'Column' from semantic_layer_schema detected; please remove the redundant import.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. pandasai/dataframe/base.py:104
  • Draft comment:
    Typo in docstring: 'securily' should be 'securely'.
  • Reason this comment was not posted:
    Marked as duplicate.
5. pandasai/__init__.py:141
  • Draft comment:
    Consider using a logging framework instead of print statements for better production practices.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. pandasai/dataframe/base.py:187
  • Draft comment:
    Consider replacing print statements with proper logging for production use.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_Gc5ADzEaHCJC8Wb2


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

"""
Start a new chat interaction with the assistant on Dataframe(s).

Args:
query (str): The query to run against the dataframes.
*dataframes: Variable number of dataframes to query.
sandbox (Sandbox, optional): The sandbox to execute code securily.
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo in docstring: change 'securily' to 'securely'.

tests/unit_tests/test_pandasai_init.py Outdated Show resolved Hide resolved
Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.42%. Comparing base (8a0123c) to head (c350b0e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1595   +/-   ##
=======================================
  Coverage   89.41%   89.42%           
=======================================
  Files          72       72           
  Lines        2579     2581    +2     
=======================================
+ Hits         2306     2308    +2     
  Misses        273      273           
Flag Coverage Δ
unittests 89.42% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@gventuri gventuri left a comment

Choose a reason for hiding this comment

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

Approved once the minor typos are fixed!!

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on 71ac630 in 37 seconds

More details
  • Looked at 38 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. pandasai/dataframe/base.py:104
  • Draft comment:
    Corrected typo in docstring ('securily' -> 'securely').
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, as it only mentions a typo correction in a docstring. It doesn't provide any actionable feedback or suggestions for improvement.
2. tests/unit_tests/test_pandasai_init.py:61
  • Draft comment:
    Fixed function name typo ('sanbox' to 'sandbox').
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative, as it only states that a typo was fixed. It does not provide any actionable feedback or suggestions for improvement.
3. pandasai/dataframe/base.py:23
  • Draft comment:
    Good improvement: Importing Sandbox outside the TYPE_CHECKING block ensures it's available at runtime for the chat method.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50%
    This comment is purely informative and does not provide any actionable feedback or suggestions for improvement. It simply acknowledges a change without offering any constructive criticism or guidance.
4. pandasai/dataframe/base.py:104
  • Draft comment:
    Fixed a typo in the docstring: 'securily' is now 'securely'.
  • Reason this comment was not posted:
    Marked as duplicate.
5. tests/unit_tests/test_pandasai_init.py:61
  • Draft comment:
    Renamed test function from 'test_chat_sanbox_passed_to_agent' to 'test_chat_sandbox_passed_to_agent' to fix the typo.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_iGYnSu8lgxvJEHUR


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

pandasai/__init__.py Outdated Show resolved Hide resolved
@gventuri gventuri merged commit be3e158 into main Feb 6, 2025
1 check passed
@ArslanSaleem ArslanSaleem deleted the feat/chat_add_sandbox branch February 6, 2025 17:13
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