Skip to content

Commit

Permalink
docs: use google style for the docstring (sinaptik-ai#185)
Browse files Browse the repository at this point in the history
* Following Features added

1. Re-Factor the docstring using Google Style
2. Updated docs for `Prompts` Module
3. Updated docs for `pai` Module
4. Feature merged with release `0.2.16`

* Added Placeholder for Notebooks and added a Notebook

* Pylint Fixing

* Pylint Fixing

* Fixed Type in `constant.py`

* Pylint Fixing of `too-few-public-methods` and `duplicate-code` in `prompts` Module.

* Pylint Fixing of `too-few-public-methods` and `duplicate-code` in `prompts` Module for Multiple dataframes.

* Pylint Fixing of `super-init-not-called`

* -- Tests Passed
-- Pylint Passed

* Added API docs for Multiple Dataframes Prompts. Also, update the Version of `mkdocs`.

* Added API docs for Multiple Dataframes Prompts. Also, update the Version of `mkdocs`.

* Moved mkdocs dependency to `docs.dependencies`

---------

Co-authored-by: Gabriele Venturi <[email protected]>
  • Loading branch information
amjadraza and gventuri authored May 29, 2023
1 parent 7ae7f1d commit f32aeba
Show file tree
Hide file tree
Showing 31 changed files with 768 additions and 181 deletions.
1 change: 1 addition & 0 deletions Notebooks/Getting Started.ipynb

Large diffs are not rendered by default.

16 changes: 0 additions & 16 deletions docs/API/api.md

This file was deleted.

7 changes: 7 additions & 0 deletions docs/API/helpers.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
## Helpers
This module includes methods classified as helpers.

### Anonymizer

A collection of methods to help handle sensitive information

::: pandasai.helpers.anonymizer
options:
show_root_heading: true

### Jupyter Notebook

Helper functions to handle Jupyter Notebook execution feature

::: pandasai.helpers.notebook
options:
show_root_heading: true
36 changes: 31 additions & 5 deletions docs/API/llms.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
## LLMS
## LLMs
This document outlines the LLMs API wrappers included in the `pandasai`.

### Base

This is a base class to implement any LLM to be used with `pandasai` framework.

::: pandasai.llm.base
options:
show_root_heading: true

::: pandasai.llm.fake
options:
show_root_heading: true
### OpenAI

OpenAI API wrapper extended through BaseOpenAI class.

::: pandasai.llm.openai
options:
show_root_heading: true


### OpenAssistant

OpenAssistant wrapper extended through Base HuggingFace Class

::: pandasai.llm.open_assistant
options:
show_root_heading: true

### Starcoder

Starcoder wrapper extended through Base HuggingFace Class

::: pandasai.llm.starcoder
options:
show_root_heading: true

### Azure OpenAI

OpenAI API through Azure Platform wrapper

::: pandasai.llm.azure_openai
options:
show_root_heading: true

### GooglePalm

GooglePalm class extended through BaseGoogle Class

::: pandasai.llm.google_palm
options:
show_root_heading: true

### Fake

A test fake class
::: pandasai.llm.fake
options:
show_root_heading: true
9 changes: 9 additions & 0 deletions docs/API/pai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## PAI: A CLI tool

### __main__

A base implementation

::: pai.__main__
options:
show_root_heading: true
25 changes: 25 additions & 0 deletions docs/API/pandasai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## PANDASAI

This Section of API covers the BaseModule Implementation along with some Package Constants and Exceptions.


### Main

The `init` of pandasai module contains the a high level wrapper to run the package.
::: pandasai
options:
show_root_heading: true

### Constants
Some of the package level constants are defined here.
::: pandasai.constants
options:
show_root_heading: true

### Exception Handling

The pandasai specific Exception handling mechanism defined here.

::: pandasai.exceptions
options:
show_root_heading: true
51 changes: 51 additions & 0 deletions docs/API/prompts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
## Prompts
This module includes some methods on optimally handling prompts when interacting with LLMs.

### Base Prompt

A base prompt

::: pandasai.prompts.base
options:
show_root_heading: true


### Generate Python Code

A standard prompt is designed to be used when querying the LLMs to generate Python Code.

::: pandasai.prompts.generate_python_code
options:
show_root_heading: true

### Generate Python Code On Error

A prompt to generate Python Code on Error

::: pandasai.prompts.correct_error_prompt
options:
show_root_heading: true

### Generate Response

A prompt to generate Conversational Response

::: pandasai.prompts.generate_response
options:
show_root_heading: true

### Generate Python Code Multiple DataFrames

A standard prompt is designed to be used when querying the LLMs to generate Python Code.

::: pandasai.prompts.multiple_dataframes
options:
show_root_heading: true

### Generate Python Code On Error Multiple DataFrames

A prompt to generate Python Code on Error

::: pandasai.prompts.correct_multiples_prompt
options:
show_root_heading: true
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ markupsafe==2.1.1
# mkdocstrings
mergedeep==1.3.4
# via mkdocs
mkdocs==1.3.0
mkdocs==1.4.0
# via
# -r docs/requirements.in
# mkdocs-autorefs
Expand Down
9 changes: 6 additions & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ nav:
- Getting Started: getting-started.md
- Command Line Tool: pai_cli.md
- API:
- API/api.md
- API/helpers.md
- API/pandasai.md
- API/prompts.md
- API/llms.md
- API/helpers.md
- API/pai.md
- About:
- Release Notes: release-notes.md
- Contributing: CONTRIBUTING.md
Expand All @@ -30,8 +32,9 @@ plugins:
# See: https://mkdocstrings.github.io/python/usage/
python:
options:
docstring_style: sphinx
docstring_style: google
markdown_extensions:
- markdown_include.include:
base_path: .
- admonition

33 changes: 32 additions & 1 deletion pai/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@
""" Driver code for the CLI tool """
""" Driver code for the CLI tool
Pai is the command line tool designed to provide a convenient way to interact with PandasAI
through a command line interface (CLI).
```
pai [OPTIONS]
```
Options:
- **-d, --dataset**: The file path to the dataset.
- **-t, --token**: Your HuggingFace or OpenAI API token, if no token provided pai will pull
from the `.env` file.
- **-m, --model**: Choice of LLM, either `openai`, `open-assistant`, or `starcoder`.
- **-p, --prompt**: Prompt that PandasAI will run.
To view a full list of available options and their descriptions, run the following command:
```
pai --help
```
Example:
```
pai -d "~/pandasai/example/data/Loan payments data.csv" -m "openai"
-p "How many loans are from men and have been paid off?"
```
> Should result in the same output as the `from_csv.py` example.
"""
import os
import click
import pandas as pd
Expand Down
Loading

0 comments on commit f32aeba

Please sign in to comment.