Giter Site home page Giter Site logo

Comments (1)

dosubot avatar dosubot commented on July 22, 2024 4

To resolve the KeyError: '__import__' when trying to describe a table, ensure that the __import__ key is correctly set in the variables used within the DirectSQLPrompt class. The error might be occurring due to a missing or incorrect setup in the variables.

Here is a potential fix by ensuring that the default_import variable is correctly set:

def on_prompt_generation(self) -> None:
    default_import = f"import {pd.__name__} as pd"
    self.set_var("default_import", default_import)
    self.set_var("reasoning", SimpleReasoningPrompt())

Make sure that the default_import variable is correctly set and used in the template or wherever it is required. If the error persists, you might need to check other parts of the code where __import__ might be referenced or required [1].

Additionally, the issue might be related to the use of non-whitelisted libraries. Ensure that the libraries you are using are whitelisted or allowed in the execution environment. Check if the execution environment has restrictions on dynamic imports or specific security policies that prevent the use of __import__ [2].

If the problem continues, you might need to review the _is_jailbreak method in the code_cleaning.py file, which checks for dangerous built-ins, including __import__, and removes them to prevent malicious code execution [3].

To continue talking to Dosu, mention @dosu.

from pandas-ai.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.