Skip to content

Commit 7073946

Browse files
Merge branch 'main' into template_improvements
# Conflicts: # poetry.lock
2 parents 8464b87 + 20241be commit 7073946

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+459
-1128
lines changed

README.md

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,6 @@ You can find the full documentation for PandasAI [here](https://pandas-ai.readth
1616

1717
You can either decide to use PandasAI in your Jupyter notebooks, Streamlit apps, or use the client and server architecture from the repo.
1818

19-
## ☁️ Using the platform
20-
21-
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.
22-
23-
Load your data, save them as a dataframe, and push them to the platform
24-
25-
```python
26-
import pandasai as pai
27-
28-
pai.api_key.set("your-pai-api-key")
29-
30-
file = pai.read_csv("./filepath.csv")
31-
32-
dataset = pai.create(path="your-organization/dataset-name",
33-
df=file,
34-
name="dataset-name",
35-
description="dataset-description")
36-
37-
dataset.push()
38-
```
39-
40-
Your team can now access and query this data using natural language through the platform.
41-
42-
![PandasAI](assets/demo.gif)
43-
4419
## 📚 Using the library
4520

4621
### Python Requirements
@@ -69,17 +44,20 @@ poetry add "pandasai>=3.0.0b2"
6944

7045
```python
7146
import pandasai as pai
47+
from pandasai_openai.openai import OpenAI
48+
49+
llm = OpenAI("OPEN_AI_API_KEY")
50+
51+
pai.config.set({
52+
"llm": llm
53+
})
7254

7355
# Sample DataFrame
7456
df = pai.DataFrame({
7557
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
7658
"revenue": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
7759
})
7860

79-
# By default, unless you choose a different LLM, it will use BambooLLM.
80-
# You can get your free API key signing up at https://app.pandabi.ai (you can also configure it in your .env file)
81-
pai.api_key.set("your-pai-api-key")
82-
8361
df.chat('Which are the top 5 countries by sales?')
8462
```
8563

@@ -119,6 +97,7 @@ You can also pass in multiple dataframes to PandasAI and ask questions relating
11997

12098
```python
12199
import pandasai as pai
100+
from pandasai_openai.openai import OpenAI
122101

123102
employees_data = {
124103
'EmployeeID': [1, 2, 3, 4, 5],
@@ -131,12 +110,15 @@ salaries_data = {
131110
'Salary': [5000, 6000, 4500, 7000, 5500]
132111
}
133112

113+
llm = OpenAI("OPEN_AI_API_KEY")
114+
115+
pai.config.set({
116+
"llm": llm
117+
})
118+
134119
employees_df = pai.DataFrame(employees_data)
135120
salaries_df = pai.DataFrame(salaries_data)
136121

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

141123
pai.chat("Who gets paid the most?", employees_df, salaries_df)
142124
```
@@ -160,6 +142,7 @@ pip install "pandasai-docker"
160142
```python
161143
import pandasai as pai
162144
from pandasai_docker import DockerSandbox
145+
from pandasai_openai.openai import OpenAI
163146

164147
# Initialize the sandbox
165148
sandbox = DockerSandbox()
@@ -176,13 +159,15 @@ salaries_data = {
176159
'Salary': [5000, 6000, 4500, 7000, 5500]
177160
}
178161

162+
llm = OpenAI("OPEN_AI_API_KEY")
163+
164+
pai.config.set({
165+
"llm": llm
166+
})
167+
179168
employees_df = pai.DataFrame(employees_data)
180169
salaries_df = pai.DataFrame(salaries_data)
181170

182-
# By default, unless you choose a different LLM, it will use BambooLLM.
183-
# You can get your free API key signing up at https://app.pandabi.ai (you can also configure it in your .env file)
184-
pai.api_key.set("your-pai-api-key")
185-
186171
pai.chat("Who gets paid the most?", employees_df, salaries_df, sandbox=sandbox)
187172

188173
# Don't forget to stop the sandbox when done

docs/mint.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"navigation": [
5555
{
5656
"group": "Overview",
57-
"pages": ["v3/introduction", "v3/getting-started", "v3/cli", "v3/privacy-security"],
57+
"pages": ["v3/introduction", "v3/getting-started", "v3/privacy-security"],
5858
"version": "v3"
5959
},
6060
{

docs/v3/ai-dashboards.mdx

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,63 @@
11
---
2-
title: 'AI Dashboards'
3-
description: 'Turn your dataframes into collaborative AI dashboards'
2+
title: "AI Dashboards"
3+
description: "Turn your dataframes into interactive AI dashboards"
44
---
55

66
<Note title="Beta Notice">
7-
Release v3 is currently in beta. This documentation reflects the features and functionality in progress and may change before the final release.
7+
Release v3 is currently in beta. This documentation reflects the features and
8+
functionality in progress and may change before the final release.
89
</Note>
910

10-
PandasAI provides a [data platform](https://app.pandabi.ai) that maximizes the power of your [semantic dataframes](/v3/semantic-layer).
11+
PandasAI provides a [data platform](https://app.pandabi.ai) that maximizes the power of your [semantic dataframes](/v3/semantic-layer).
1112
With a single line of code, you can turn your dataframes into auto-updating AI dashboards - no UI development needed.
1213
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.
1314

1415
```python
1516
import pandasai as pai
1617

1718
df = pai.load("company/heart-data")
18-
df.push()
1919
```
2020

21-
The pushed datasets can then be accessed by your team-mates that can use natural language to ask questions about the data.
22-
[![PandasAI](../assets/demo.gif)](https://app.pandabi.ai)
23-
2421
## Auto-generated Dashboards
2522

2623
For each materialized dataframe, the platform automatically:
24+
2725
- Generates relevant questions about your data
2826
- Creates insightful charts and visualizations
2927
- Provides a pre-built dashboard with key insights
3028
- Includes a conversational agent for dynamic analysis
3129

3230
## Conversational Data Analysis
3331

34-
The platform provides a powerful chat interface where your team can interact with your data using natural language.
32+
The platform provides a powerful chat interface where your team can interact with your data using natural language.
3533
The conversational agent uses your [semantic layer](/v3/semantic-layer) definitions to understand business context and maintain consistency across analyses.
3634

3735
When you ask questions, PandasAI:
36+
3837
1. Uses AI to generate precise code snippets for your analysis
3938
2. Executes the code securely within the platform
4039
3. Returns visualizations and insights from the results
4140

4241
Your data never leaves the platform - the AI only generates code, while all data processing happens in your secure environment.
4342

4443
Ask any question about your data and:
44+
4545
- Get instant answers with explanatory visualizations
4646
- Save insights as new dashboard cards
4747

4848
## Dynamic Analysis
4949

5050
Your dashboards and conversational agent stay continuously synchronized with your data sources through code execution:
51+
5152
- Each insight is powered by auto-generated code snippets
5253
- Code runs on live data, ensuring results are always current
5354
- Inherits all data cleaning and transformations defined in your [semantic layer](/v3/semantic-layer)
5455

5556
## Who should use the Data Platform?
56-
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).
57+
58+
Whether you're a data scientist creating analysis for stakeholders, a business analyst creating reports, or a team leader fostering data-driven decisions, the platform makes it easy to work with data analysis.
5759

5860
## How to get the Data Platform?
59-
Visit [app.pandabi.ai](https://app.pandabi.ai) to get started.
60-
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.
61+
62+
Visit [app.pandabi.ai](https://app.pandabi.ai) to get started.
63+
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.

docs/v3/cli.mdx

Lines changed: 0 additions & 79 deletions
This file was deleted.

docs/v3/getting-started.mdx

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
2-
title: 'Quickstart'
3-
description: 'Start building your data preparation layer with PandasAI and chat with your data'
2+
title: "Quickstart"
3+
description: "Start building your data preparation layer with PandasAI and chat with your data"
44
---
55

66
<Note title="Beta Notice">
7-
PandasAI 3.0 is currently in beta. This documentation reflects the latest features and functionality, which may evolve before the final release.
7+
PandasAI 3.0 is currently in beta. This documentation reflects the latest
8+
features and functionality, which may evolve before the final release.
89
</Note>
910

1011
<iframe
@@ -31,23 +32,42 @@ pip install "pandasai>=3.0.0b2"
3132

3233
## Quick setup
3334

34-
In order to use PandasAI, you need a large language model (LLM). While you can use any LLM, for the purpose of this guide, we are using BambooLLM.
35-
You can get your free API key signing up at [app.pandabi.ai](https://app.pandabi.ai), which allows you to both use the data platform and get BambooLLM credits.
35+
In order to use PandasAI, you need a large language model (LLM). You can use any LLM, but for this guide we'll use OpenAI through the LiteLLM extension.
3636

37-
First, import PandasAI and set up your API key:
37+
First, install the required extension:
38+
39+
```bash
40+
pip install pandasai-litellm
41+
```
42+
43+
Then, import PandasAI and configure the LLM:
3844

3945
```python
4046
import pandasai as pai
47+
from pandasai_litellm.litellm import LiteLLM
4148

42-
# Get your API key from https://app.pandabi.ai
43-
pai.api_key.set("YOUR_PANDABI_API_KEY")
44-
```
49+
# Initialize LiteLLM with your OpenAI model
50+
llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY")
4551

52+
# Configure PandasAI to use this LLM
53+
pai.config.set({
54+
"llm": llm
55+
})
56+
```
4657

4758
## Chat with your data
4859

4960
```python
5061
import pandasai as pai
62+
from pandasai_litellm.litellm import LiteLLM
63+
64+
# Initialize LiteLLM with your OpenAI model
65+
llm = LiteLLM(model="gpt-4.1-mini", api_key="YOUR_OPENAI_API_KEY")
66+
67+
# Configure PandasAI to use this LLM
68+
pai.config.set({
69+
"llm": llm
70+
})
5171

5272
# Load your data
5373
df = pai.read_csv("data/companies.csv")
@@ -58,14 +78,14 @@ print(response)
5878

5979
When you ask a question, PandasAI will use the LLM to generate the answer and output a response.
6080
Depending on your question, it can return different kind of responses:
81+
6182
- string
6283
- dataframe
6384
- chart
6485
- number
6586

6687
Find it more about output data formats [here](/v3/chat-and-output#available-output-formats).
6788

68-
6989
## Creating your first data layer
7090

7191
### 1. Define a data source
@@ -142,29 +162,13 @@ companies = pai.load("organization/companies")
142162
response = stocks.chat("What is the volatility of the Coca Cola stock?")
143163
response = companies.chat("What is the average revenue by region?")
144164

145-
# Query using multiple datasets
165+
# Query using multiple datasets
146166
result = pai.chat("Compare the revenue between Coca Cola and Apple", stocks, companies)
147167
```
148168

149-
## Sharing and collaboration
150-
151-
Share your data layers with your team:
152-
153-
```python
154-
# Push datasets to the platform
155-
stocks.push()
156-
companies.push()
157-
```
158-
159-
Team members can then access and query the shared datasets through:
160-
- The web interface at [app.pandabi.ai](https://app.pandabi.ai)
161-
- Their own PandasAI code using `pai.load("organization/dataset-name")`
162-
163-
Of course, they will only be able to see the datasets they have access to. You can control access using the [permission management](/v3/permission-management) features.
164-
165169
## Next Steps
166170

167171
- Learn more about [Semantic Layer](/v3/semantic-layer)
168172
- Join our [Discord Community](https://discord.gg/KYKj9F2FRH) for support
169-
{/* - Explore [Advanced Views and Joins](/v3/views) */}
170-
{/*- Check out our [Example Projects](/v3/examples) */}
173+
{/* - Explore [Advanced Views and Joins](/v3/views) */}
174+
{/* - Check out our [Example Projects](/v3/examples) */}

0 commit comments

Comments
 (0)