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

Updated readme, docs, notebooks #1522

Merged
merged 8 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 23 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,12 @@
[![CI](https://github.com/sinaptik-ai/pandas-ai/actions/workflows/ci.yml/badge.svg)](https://github.com/sinaptik-ai/pandas-ai/actions/workflows/ci.yml/badge.svg)
[![CD](https://github.com/sinaptik-ai/pandas-ai/actions/workflows/cd.yml/badge.svg)](https://github.com/sinaptik-ai/pandas-ai/actions/workflows/cd.yml/badge.svg)
[![Coverage](https://codecov.io/gh/sinaptik-ai/pandas-ai/branch/main/graph/badge.svg)](https://codecov.io/gh/sinaptik-ai/pandas-ai)
[![Discord](https://dcbadge.vercel.app/api/server/kF7FqH2FwS?style=flat&compact=true)](https://discord.gg/kF7FqH2FwS)
[![Discord](https://dcbadge.vercel.app/api/server/kF7FqH2FwS?style=flat&compact=true)](https://discord.gg/KYKj9F2FRH)
[![Downloads](https://static.pepy.tech/badge/pandasai)](https://pepy.tech/project/pandasai) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)

PandaAI is a Python platform that makes it easy to ask questions to your data in natural language. It helps non-technical users to interact with their data in a more natural way, and it helps technical users to save time, and effort when working with data.

# 🚀 Deploying PandaAI

PandaAI can be used in a variety of ways. You can easily use it in your Jupyter notebooks or Streamlit apps, or you can deploy it as a REST API such as with FastAPI or Flask.

If you are interested in the managed PandaAI Cloud or our self-hosted Enterprise Offering, [contact us](https://forms.gle/JEUqkwuTqFZjhP7h8).

# 🔧 Getting started

You can find the full documentation for PandaAI [here](https://pandas-ai.readthedocs.io/en/latest/).
Expand All @@ -24,30 +18,30 @@ You can either decide to use PandaAI in your Jupyter notebooks, Streamlit apps,

## ☁️ Using the platform

[![PandaAI platform](assets/demo.gif?raw=true)](https://www.youtube.com/watch?v=kh61wEy9GYM)

### 📦 Installation
The library can be used alongside our powerful data platform, making end-to-end conversational data analytics possible with as little as a few lines of code.

PandaAI platform is uses a dockerized client-server architecture. You will need to have Docker installed in your machine.
Load your data, save them as a dataframe, and push them to the platform

```bash
git clone https://github.com/sinaptik-ai/pandas-ai/
cd pandas-ai
docker-compose build
```

### 🚀 Running the platform
```python
import pandasai as pai

Once you have built the platform, you can run it with:
df = pai.read_csv("./filepath.csv")
gventuri marked this conversation as resolved.
Show resolved Hide resolved
df.push()

```bash
docker-compose up
df.save(path="your-organization/dataset-name",
name="dataset-name",
description="dataset-description")
```
Your team can now access and query this data using natural language through the platform.

This will start the client and server, and you can access the client at `http://localhost:3000`.
![PandaAI](assets/demo.gif)

## 📚 Using the library

### Python Requirements

Python version `3.8+ <3.12`

### 📦 Installation

You can install the PandaAI library using pip or poetry.
Expand All @@ -64,18 +58,11 @@ With poetry:
poetry add pandasai
```

### 🔍 Demo

Try out the PandaAI library yourself in your browser:

[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1ZnO-njhL7TBOYPZaqvMvGtsjckZKrv2E?usp=sharing)

### 💻 Usage

#### Ask questions

```python
import os
import pandasai as pai

# Sample DataFrame
Expand All @@ -85,8 +72,8 @@ df = pai.DataFrame({
})

# By default, unless you choose a different LLM, it will use BambooLLM.
# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)
os.environ["PANDABI_API_KEY"] = "YOUR_PANDABI_API_KEY"
# You can get your free API key signing up at https://app.pandabi.ai (you can also configure it in your .env file)
pai.api_key.set("your-pai-api-key")

df.chat('Which are the top 5 countries by sales?')
```
Expand Down Expand Up @@ -126,8 +113,6 @@ df.chat(
You can also pass in multiple dataframes to PandaAI and ask questions relating them.

```python
import os
import pandas as pd
from pandasai import Agent

employees_data = {
Expand All @@ -141,12 +126,12 @@ salaries_data = {
'Salary': [5000, 6000, 4500, 7000, 5500]
}

employees_df = pd.DataFrame(employees_data)
salaries_df = pd.DataFrame(salaries_data)
employees_df = pai.DataFrame(employees_data)
salaries_df = pai.DataFrame(salaries_data)

# By default, unless you choose a different LLM, it will use BambooLLM.
# You can get your free API key signing up at https://pandabi.ai (you can also configure it in your .env file)
os.environ["PANDABI_API_KEY"] = "YOUR_PANDABI_API_KEY"
# You can get your free API key signing up at https://app.pandabi.ai (you can also configure it in your .env file)
pai.api_key.set("your-pai-api-key")

agent = Agent([employees_df, salaries_df])
agent.chat("Who gets paid the most?")
Expand All @@ -168,7 +153,7 @@ If you are interested in managed PandaAI Cloud or self-hosted Enterprise Offerin

- [Docs](https://pandas-ai.readthedocs.io/en/latest/) for comprehensive documentation
- [Examples](examples) for example notebooks
- [Discord](https://discord.gg/kF7FqH2FwS) for discussion with the community and PandaAI team
- [Discord](https://discord.gg/KYKj9F2FRH) for discussion with the community and PandaAI team

## 🤝 Contributing

Expand Down
Binary file modified assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"navigation": [
{
"group": "Overview",
"pages": ["v3/introduction", "v3/getting-started", "v3/output-formats"],
"pages": ["v3/introduction", "v3/getting-started"],
"version": "v3"
},
{
Expand All @@ -64,7 +64,7 @@
},
{
"group": "Natural Language",
"pages": ["v3/overview-nl", "v3/large-language-models", "v3/chat-and-cache", "v3/privacy-and-security"],
"pages": ["v3/overview-nl", "v3/large-language-models", "v3/chat-and-cache", "v3/output-formats"],
"version": "v3"
},
{
Expand Down
4 changes: 2 additions & 2 deletions docs/v3/agent.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ You can train PandaAI to understand your data better and to improve its performa

## Prerequisites

Before you start training PandaAI, you need to set your PandaAI API key. You can generate your API key by signing up at [https://pandabi.ai](https://pandabi.ai).
Before you start training PandaAI, you need to set your PandaAI API key. You can generate your API key by signing up at [https://app.pandabi.ai](https://app.pandabi.ai).

Then you can set your API key as an environment variable:

Expand All @@ -35,7 +35,7 @@ As an alternative, if you want to use a local vector store (enterprise only for
```python
from pandasai import Agent

# Set your PandasAI API key (you can generate one signing up at https://pandabi.ai)
# Set your PandasAI API key (you can generate one signing up at https://app.pandabi.ai)
os.environ["PANDABI_API_KEY"] = "YOUR_PANDABI_API_KEY"

agent = Agent("data.csv")
Expand Down
10 changes: 7 additions & 3 deletions docs/v3/ai-dashboards.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@ title: 'AI Dashboards'
description: 'Turn your dataframes into collaborative AI dashboards'
---

PandaAI provides a data platform that maximizes the power of your [semantic dataframes](/v3/dataframes).
PandaAI provides a [data platform](https://app.pandabi.ai) that maximizes the power of your [semantic dataframes](/v3/dataframes).
With a single line of code, you can turn your dataframes into auto-updating AI dashboards - no UI development needed.
Each dashboard comes with a pre-generated set of insights and a conversational agent that helps you and your team explore the data through natural language.

```python
import pandasai as pai

df = pai.load("company/customers")
df = pai.load("company/heart-data")
df.push()
```

The pushed datasets can then be accessed by your team-mates that can use natural language to ask questions about the data.
[![PandaAI](../assets/demo.gif)](https://app.pandabi.ai)

## Auto-generated Dashboards

For each materialized dataframe, the platform automatically:
Expand Down Expand Up @@ -49,4 +52,5 @@ Your dashboards and conversational agent stay continuously synchronized with you
Whether you're a data scientist sharing analysis with stakeholders, a business analyst creating reports, or a team leader fostering data-driven decisions, the platform makes it easy to collaborate on data analysis through our [sharing capabilities](/v3/share-dataframes).

## How to get the Data Platform?
The data platform is available as a Cloud SaaS or as an enterprise solution that can be deployed on your own cloud infrastructure with full privacy and security controls.
Visit [app.pandabi.ai](https://app.pandabi.ai) to get started.
The data platform is available as a Cloud SaaS or as an enterprise solution that can be deployed on your own cloud infrastructure with full privacy and security controls.
44 changes: 33 additions & 11 deletions docs/v3/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ pip install pandasai
## Chat with your data

In order to use PandaAI, you need a large language model (LLM). While you can use any LLM, for the purpose of this guide, we are using BambooLLM.
You can get your free API key signing up at [pandabi.ai](https://pandabi.ai), which allows you to both use the data platform and get BambooLLM credits.
You can get your free API key signing up at [pandabi.ai](https://app.pandabi.ai), which allows you to both use the data platform and get BambooLLM credits.

```python
import pandasai as pai

# replace "YOUR_PANDABI_API_KEY" with your API key from https://pandabi.ai
# get the api key from https://app.pandabi.ai
pai.api_key.set("YOUR_PANDABI_API_KEY")
```

Expand All @@ -38,9 +38,17 @@ df = pai.read_csv("filepath")

# ask questions
df.chat('Which are the top 5 countries by sales?')
# replace "Which are the top 5 countries by sales?" with your question
```

When you ask a question, PandaAI will use the LLM to generate the answer and output a response.
Depending on your question, it can return different objects:
- string
- dataframe
- chart
- number

Find it more about output data formats [here](/v3/output-formats)

### Save and load dataframes

To work faster with your data, you can save dataframes.
Expand Down Expand Up @@ -68,6 +76,27 @@ df = pai.read_csv("filepath")
df.load("organization/dataset-name")
```

## Share with your team

Dataframes can be shared with your team using the [data platform](/v3/ai-dashboards).

```python
import pandasai as pai

df = pai.load("company/heart-data")
df.push()

```

The pushed datasets can then be accessed by your team-mates that can use natural language to ask questions about the data.
[![PandaAI](../assets/demo.gif)](https://app.pandabi.ai)


## Advanced features

- Explore the [Semantic Layer](/v3/semantic-layer) to learn how to configure, save and dataframes
- Learn more about the [Natural Language Layer](/v3/overview-nl)


### Chat with multiple dataframes

Expand All @@ -81,11 +110,4 @@ df_orders = pai.load("company/orders")
df_products = pai.load("company/products")

response = pai.chat('Who are our top 5 customers and what products do they buy most frequently?', df_customers, df_orders, df_products)
```

## Share with your team

## Advances features

- Explore the [Semantic Layer](/v3/semantic-layer) to learn how to configure, save and dataframes
- Learn more about the [Natural Language Layer](/v3/overview-nl)
```
4 changes: 2 additions & 2 deletions docs/v3/large-language-models.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ Then, every time you use the `.chat()` method, it will use the configured LLM.
## BambooLLM

BambooLLM is the default LLM for PandaAI, fine-tuned for data analysis.
You can get your free API key by signing up at [pandabi.ai](https://pandabi.ai).
You can get your free API key by signing up at [pandabi.ai](https://app.pandabi.ai).

```python
import pandasai as pai

# set up BambooLLM
# replace "YOUR_PANDABI_API_KEY" with your API key from https://pandabi.ai
# replace "YOUR_PANDABI_API_KEY" with your API key from https://app.pandabi.ai
os.environ["PANDABI_API_KEY"] = "YOUR_PANDABI_API_KEY"
```

Expand Down
4 changes: 1 addition & 3 deletions docs/v3/output-formats.mdx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title: 'Output Formats'
title: 'Output formats'
description: 'Understanding the different output formats supported by PandaAI'
---

# Output Formats

PandaAI supports multiple output formats for responses, each designed to handle different types of data and analysis results effectively. This document outlines the available output formats and their use cases.

## Available Output Formats
Expand Down
1 change: 1 addition & 0 deletions docs/v3/overview-nl.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description: 'Understanding the AI and natural language processing capabilities
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](/v3/dataframes), 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](/v3/output-formats).

The NL Layer is also one of the core components of our [Data Platform](/v3/ai-dashboards), which allows you to turn raw data into collaborative AI dashboards with in-built conversational agents with a single line of code.
```python
Expand Down
20 changes: 2 additions & 18 deletions docs/v3/permission-management.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,18 @@ You can choose between four levels of access:
- Password-protected: for controlled sharing
- Organization: for team collaboration

![Permission Management](../assets/permissions.png)

Each access level determines who can view and interact with your dataframes, and who consumes query quota when asking questions to the AI agent.

## Private Dataframes
Private dataframes are accessible only by their owner. When asking questions to the agent, the owner consumes their own query quota.

```python
import pandasai as pai

df = pai.load("sales_data.csv")
df.push(access="private")
```

## Public Dataframes
Public dataframes are accessible by anyone with a PandaAI account. They are indexed on the web for discovery. When users ask questions, they consume their own query quota.

```python
df.push(access="public")
```

## Password-Protected Dataframes
Password-protected dataframes are accessible only by users with the correct password. When users ask questions, the dataframe owner consumes their query quota.

```python
df.push(
access="password_protected",
password="secure_password"
)
```

## Organization Dataframes
Organization dataframes are accessible by team members based on their permissions. Members can have read-only or write access. Permissions are handled in-platform by the organization owner and admins.
13 changes: 9 additions & 4 deletions docs/v3/share-dataframes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ title: 'Share Dataframes'
description: 'Learn how to push and pull dataframes to/from the PandaAI Data Platform'
---

## Pushing Dataframes
Once you have turned raw data into dataframes using the [semantic layer](/v3/semantic-layer), you can push them to our data platform with one line of code.
In a similar way, you can pull dataframes your team-mates have pushed to the platform.

## Pushing Dataframes

```python
import pandasai as pai

df_customers = pai.load("company/customers")
df_customers = pai.load("company/heart-data")

df.push()
```
When you push a dataframe to the platform, business users and team mates can chat with your data using natural language.
![PandaAI](../assets/demo.gif)

## Pulling Dataframes

You can pull dataframes your team-mates have pushed to the platform by combining the load and pull methods.


```python

df_customers = pai.pull("company/customers")
df_customers = pai.load("company/heart-data")
df_customers = pai.pull()
```
Loading