Skip to content

Commit

Permalink
Release/v2.2 (Sinaptik-AI#1226)
Browse files Browse the repository at this point in the history
* feat(pandasai_server): pandasai server code commit

* fix(docker-compose): add pandasbi backend in docker

* fix(pandasai-lint): sort linting errors

* refactor: rename modle file name

* feat(chat): adding chat endpoint

* fix: remove some keywords from spellcheck

* fix: poetry lock file

* me api integrated

* chat api integrated

* renamed, fix and add documentation

* workspace replaced

* fix: add conversation id to response

* feat(conversation): return all user conversations

* fix: should be equal equal

* feat(pandasai_server): pandasai server code commit (Sinaptik-AI#1189)

* feat(pandasai_server): pandasai server code commit

* fix(docker-compose): add pandasbi backend in docker

* fix(pandasai-lint): sort linting errors

* refactor: rename modle file name

* feat(chat): adding chat endpoint

* fix: remove some keywords from spellcheck

* fix: poetry lock file

* me api integrated

* chat api integrated

* renamed, fix and add documentation

* workspace replaced

* fix: add conversation id to response

* feat(conversation): return all user conversations

* fix: should be equal equal

---------

Co-authored-by: Shahrukh Khan <[email protected]>

* get all datasets endpoint completed

* feat(conversation_messages): return conversation messages (Sinaptik-AI#1196)

* get all datasets endpoint completed (Sinaptik-AI#1197)

* chore: update poetry.lock

* chore: add pgdata to gitignore

* chore: fix postgres url in the server .env example

* chore: add .env.example for the client

* fix: add rollbar

* fix: wrong redirects

* fix: docker compose to wait for postgres before starting (Sinaptik-AI#1198)

* fix: response message should be value for strings and numbers (Sinaptik-AI#1199)

* docs: mention the platform in the docs

* style: hide rightbar for now

* style: move the "new chat" button next to chat

* [PAN-816]: Past conversations integrated and workspace removed (Sinaptik-AI#1200)

* feat(conversation_messages): return conversation messages

* past conversations integrated

* workspace page removed

* workspace page removed

* workspace page removed

* workspace page removed

* bugfix

---------

Co-authored-by: ArslanSaleem <[email protected]>

* style: remove tooltip from the sidebar

* style: clean up the UI

* chore: fix typo in volume name

* conversation actions removed

* conversation actions removed (Sinaptik-AI#1201)

* fix: filter out empty conversations

* docs: add platform in the docs

* get users by workspace id api added

* docs: add docs about the platform

* pydantic response for workspace user added

* workspace datasets endpoint added

* archive conversation api added (Sinaptik-AI#1209)

* [PAN-820]: archive api integrated on frontend (Sinaptik-AI#1210)

* archive conversation api added

* archive conversation integrated on frontend

* chore: add link about the roadmap

* past conversation issues fixed

* [PAN-824]: Ui stuck fixed (Sinaptik-AI#1215)

* ui stuck fixed

* docker fixed

* style: ctas in the sidebar fade out on collapse

* scroll to bottom bug fix (Sinaptik-AI#1217)

* tests(pandasai): write python test cases (Sinaptik-AI#1216)

* new conversation not adding to sidebar fixed

* fix: frontend docker build (Sinaptik-AI#1219)

* merge main to release

---------

Co-authored-by: ArslanSaleem <[email protected]>
Co-authored-by: Shahrukh Khan <[email protected]>
Co-authored-by: Shahrukh khan <[email protected]>
  • Loading branch information
4 people authored Jun 12, 2024
1 parent 3547329 commit 4148c14
Show file tree
Hide file tree
Showing 222 changed files with 16,108 additions and 50 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ exports/
# coverage
.coverage
coverage.xml

# pgdata
pgdata/
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ format_diff: ## run code formatters in diff mode
poetry run ruff --select I pandasai examples tests

spell_check: ## run codespell on the project
poetry run codespell --toml pyproject.toml --skip=$(IGNORE_FORMATS) -L NotIn
poetry run codespell --toml pyproject.toml --ignore-words=ignore-words.txt --skip=$(IGNORE_FORMATS)

spell_fix: ## run codespell on the project and fix the errors
poetry run codespell --toml pyproject.toml --skip=$(IGNORE_FORMATS) -L NotIn -w
poetry run codespell --toml pyproject.toml --ignore-words=ignore-words.txt --skip=$(IGNORE_FORMATS) -w

######################
# DOCS
Expand Down
68 changes: 49 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ![PandasAI](images/logo.png)
# ![PandasAI](assets/logo.png)

[![Release](https://img.shields.io/pypi/v/pandasai?label=Release&style=flat-square)](https://pypi.org/project/pandasai/)
[![CI](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)](https://github.com/gventuri/pandas-ai/actions/workflows/ci.yml/badge.svg)
Expand All @@ -8,13 +8,49 @@
[![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)

PandasAI is a Python library that makes it easy to ask questions to your data in natural language. It helps you to explore, clean, and analyze your data using generative AI.
PandasAI 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 PandasAI

PandasAI 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 PandasAI Cloud or our self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).

# 🔧 Getting started

The documentation for PandasAI to use it with specific LLMs, vector stores and connectors, can be found [here](https://pandas-ai.readthedocs.io/en/latest/).
You can find the full documentation for PandasAI [here](https://pandas-ai.readthedocs.io/en/latest/).

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

## ☁️ Using the platform

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

### 📦 Installation

PandasAI platform is uses a dockerized client-server architecture. You will need to have Docker installed in your machine.

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

### 🚀 Running the platform

## 📦 Installation
Once you have built the platform, you can run it with:

```bash
docker-compose up
```

This will start the client and server, and you can access the client at `http://localhost:3000`.

## 📚 Using the library

### 📦 Installation

You can install the PandasAI library using pip or poetry.

With pip:

Expand All @@ -28,21 +64,15 @@ With poetry:
poetry add pandasai
```

## 🔍 Demo
### 🔍 Demo

Try out PandasAI yourself in your browser:
Try out the PandasAI 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)

# 🚀 Deploying PandasAI

PandasAI can be deployed 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 managed PandasAI Cloud or self-hosted Enterprise Offering, take a look at [our website](https://pandas-ai.com) or [book a meeting with us](https://zcal.co/gventuri/pandas-ai-demo).

## 💻 Usage
### 💻 Usage

### Ask questions
#### Ask questions

```python
import os
Expand All @@ -52,7 +82,7 @@ from pandasai import Agent
# Sample DataFrame
sales_by_country = pd.DataFrame({
"country": ["United States", "United Kingdom", "France", "Germany", "Italy", "Spain", "Canada", "Australia", "Japan", "China"],
"sales": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
"revenue": [5000, 3200, 2900, 4100, 2300, 2100, 2500, 2600, 4500, 7000]
})

# By default, unless you choose a different LLM, it will use BambooLLM.
Expand Down Expand Up @@ -81,19 +111,19 @@ agent.chat(
The total sales for the top 3 countries by sales is 16500.
```

### Visualize charts
#### Visualize charts

You can also ask PandasAI to generate charts for you:

```python
agent.chat(
"Plot the histogram of countries showing for each the gdp, using different colors for each bar",
"Plot the histogram of countries showing for each one the gd. Use different colors for each bar",
)
```

![Chart](images/histogram-chart.png?raw=true)
![Chart](assets/histogram-chart.png?raw=true)

### Multiple DataFrames
#### Multiple DataFrames

You can also pass in multiple dataframes to PandasAI and ask questions relating them.

Expand Down
Binary file added 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.
File renamed without changes
File renamed without changes
15 changes: 15 additions & 0 deletions client/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# THE URL OF YOUR CLIENT
NEXT_PUBLIC_API_URL='http://localhost:8000/'

# ENVIRONMENT
NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN="development"

# ANALYTICS
NEXT_PUBLIC_MIXPANEL_TOKEN="04a81d58ade99299e19e5a89fe84c670"
NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="G-SD7MBGS6J9"

# SUPPORT CHAT
NEXT_PUBLIC_INTERCOM_APP_ID="jzfk3qc5"

# ENV
NODE_ENV="development"
27 changes: 27 additions & 0 deletions client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"next/core-web-vitals",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"react"
],
"rules": {
"react/no-unescaped-entities": ["error", { "forbid": [">", "}"] }],
"@typescript-eslint/no-explicit-any": "off",
"no-useless-catch": "off",
"react-hooks/exhaustive-deps": 0
}
}
40 changes: 40 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js
.yarn/install-state.gz

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local
.env
# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts

# lock files
package-lock.json
yarn-lock.json
15 changes: 15 additions & 0 deletions client/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM node:19.4.0-alpine3.17

WORKDIR /app

COPY package*.json ./

RUN npm install

COPY . .

RUN npm run build

EXPOSE 3000

CMD ["npm", "start"]
62 changes: 62 additions & 0 deletions client/Providers/AppProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"use client";
import React, { ReactNode, useEffect } from "react";
import ContextProvider from "@/contexts/ContextProvider";
import { usePathname } from "next/navigation";
import dynamic from "next/dynamic";
import { getTitleFromPath } from "@/utils/getTitleFromPath";
import {
NEXT_PUBLIC_INTERCOM_APP_ID,
NEXT_PUBLIC_MIXPANEL_TOKEN,
NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN,
} from "@/utils/constants";
import mixpanel from "mixpanel-browser";
import { Provider as RollbarProvider, ErrorBoundary } from "@rollbar/react";
import QueryProvider from "./QueryProvider";
import Intercom from "@/components/Intercom/Intercom";
import { ToastContainer } from "react-toastify";
import "styles/globals.css";
import "styles/App.css";
import "styles/multi-range-slider.css";
import "react-toastify/dist/ReactToastify.css";
import "react-tooltip/dist/react-tooltip.css";

const _NoSSR = ({ children }) => <React.Fragment>{children}</React.Fragment>;
const NoSSR = dynamic(() => Promise.resolve(_NoSSR), {
ssr: false,
});

export default function AppProvider({ children }: { children: ReactNode }) {
const pathname = usePathname();
const defaultTitle = getTitleFromPath(pathname);

const rollbarConfig = {
accessToken: NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN,
environment: process.env.NODE_ENV || "development",
};

useEffect(() => {
document.title = `${defaultTitle} | PandaBI`;
}, [defaultTitle]);

useEffect(() => {
mixpanel.init(NEXT_PUBLIC_MIXPANEL_TOKEN, {
autotrack: true,
track_pageview: true,
});
}, []);
return (
<>
<RollbarProvider config={rollbarConfig}>
<ErrorBoundary>
<ContextProvider>
<NoSSR>
<ToastContainer autoClose={3000} className="w-64 text-white" />
<QueryProvider>{children}</QueryProvider>
</NoSSR>
</ContextProvider>
</ErrorBoundary>
</RollbarProvider>
<Intercom appID={NEXT_PUBLIC_INTERCOM_APP_ID} />
</>
);
}
17 changes: 17 additions & 0 deletions client/Providers/QueryProvider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use client";
import React, { ReactNode, useState } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";

const QueryProvider = ({ children }: { children: ReactNode }) => {
const [queryClient] = useState(() => new QueryClient());
return (
// Provide the client to your App
<QueryClientProvider client={queryClient}>
<ReactQueryDevtools initialIsOpen={false} />
{children}
</QueryClientProvider>
);
};

export default QueryProvider;
36 changes: 36 additions & 0 deletions client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Loading

0 comments on commit 4148c14

Please sign in to comment.