NL Layer
Understanding the AI and natural language processing capabilities of PandaAI
Release v3 is currently in beta. This documentation reflects the features and functionality in progress and may change before the final release.
How does PandaAI NL Layer work?
The Natural Language Layer uses generative AI to transform natural language queries into production-ready code generated by LLMs.
When you use the .chat
method on a semantic dataframe, PandaAI passes to the LLM the question, the table headers, and 5-10 rows of the Dataframe.
It then instructs the LLM to generate the most relevant code, whether Python or SQL. The code is then executed locally.
There are different output formats supported by PandaAI, which can be found here.
The NL Layer is also one of the core components of our Data Platform, which allows you to turn raw data into collaborative AI dashboards with in-built conversational agents with a single line of code.
Configure the NL Layer
PandaAI allows you to configure the NL Layer with the config.set()
method.
Example:
Parameters
llm
- Description: The LLM to use. You can pass an instance of an LLM or the name of an LLM. See supported LLMs for setup instructions and configuration options.
save_logs
- Type:
bool
- Default:
True
- Description: Whether to save the logs of the LLM. You will find the logs in the
pandasai.log
file in the root of your project.
verbose
- Type:
bool
- Default:
False
- Description: Whether to print the logs in the console as PandaAI is executed.
max_retries
- Type:
int
- Default:
3
- Description: The maximum number of retries to use when using the error correction framework. You can use this setting to override the default number of retries.
Was this page helpful?