Skip to content

Feature/poc #2

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

Merged
merged 24 commits into from
Apr 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
11ec6ef
Update pyupgrade hook to target Python 3.11+ compatibility
shakil1819 Mar 29, 2025
75127e3
ci(pre-commit-file): added pre-commit hook of pyright that runs autom…
shakil1819 Mar 29, 2025
330e075
build(requirements.txt): updated and instaleed ML packages
shakil1819 Mar 29, 2025
44b30df
fix(removed-pyright-checks): removed pyright checks
shakil1819 Mar 30, 2025
35def9b
feat(Makefile): Added pytest, pre-commit, clean, ruff and all combine…
shakil1819 Mar 31, 2025
7f32c22
docs(added-fireducks): fireducks is 125% faster than pandas
shakil1819 Mar 31, 2025
0e9ae41
Add run target to Makefile for starting FastAPI application with uvicorn
shakil1819 Mar 31, 2025
564adc5
Downgrade Python requirement from 3.11 to 3.9 and update dependencies
shakil1819 Apr 2, 2025
cca683a
fix(.env-,-uv-sync): added configs
shakil1819 Apr 2, 2025
fa35b12
Add Data Analyst agent with SQL query generation and update gitignore…
shakil1819 Apr 2, 2025
616b45d
Add initial data science tools agents with SQL, H2O and plotting utils
shakil1819 Apr 2, 2025
831938d
Exclude app/agent directory from Python linting and formatting checks
shakil1819 Apr 2, 2025
eb3d0ce
Update README.md
shakil1819 Apr 2, 2025
9f54582
fix(agents/): removed due to incompatibility
shakil1819 Apr 3, 2025
da34592
feat(notebook/poc.ipynb): enhance package management and module inspe…
shakil1819 Apr 3, 2025
0f36747
fix(pre-commit-hooks,-Dockerfile,-notebook): - added pyright
shakil1819 Apr 4, 2025
796d578
feat(data-visualization-agent): added new agent - data visualization
shakil1819 Apr 5, 2025
7723871
fix(format-workflow): excluded /notebook/logs
shakil1819 Apr 5, 2025
ba3d362
Update linter exclusion paths and remove unused visualization script
shakil1819 Apr 5, 2025
d3786fd
Update exclude path from app/agent to notebook in pre-commit hooks
shakil1819 Apr 5, 2025
ac2368f
fix(many-fixes): many fixes
shakil1819 Apr 6, 2025
be7cc2f
Update package dependencies and lock file versions
shakil1819 Apr 6, 2025
1ecc2a4
Add agent workflow with multi-agent routing and query processing
shakil1819 Apr 6, 2025
51ad84e
Refactor codebase: remove v1 API, add visualization server and agent …
shakil1819 Apr 12, 2025
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
OPENAI_API_KEY=''
MODEL=''
MODEL_PROVIDER=''

8 changes: 4 additions & 4 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
linter: [ruff, mypy]
linter: [ruff] #, mypy]
include:
- linter: ruff
command: ruff check --fix .
- linter: mypy
command: mypy .
command: ruff check --fix . --exclude ./notebook/
# - linter: mypy
# command: mypy . --exclude ./notebook/
steps:
- uses: actions/checkout@v4
- name: Install uv
Expand Down
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# Created by https://www.toptal.com/developers/gitignore/api/python
# Edit at https://www.toptal.com/developers/gitignore?templates=python

*.md
### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
myenv/
*$py.class
.idea
# C extensions
*.so

.env
/notebook/logs
*.csv
*.ipynb
*.db
*.Identifier
# Distribution / packaging
.Python
build/
Expand Down
33 changes: 22 additions & 11 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
# - id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
- id: check-case-conflict
Expand All @@ -19,6 +19,7 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
types: [python]
exclude: ^notebook/
- id: fix-byte-order-marker
- id: mixed-line-ending
- id: name-tests-test
Expand All @@ -30,7 +31,7 @@ repos:
rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py312-plus]
args: [--py39-plus]

- repo: local
hooks:
Expand All @@ -39,19 +40,29 @@ repos:
entry: uv run ruff check --fix
language: system
types: [python]
exclude: ^notebook/

- id: ruff-format
name: Python code formatting with Ruff
entry: uv run ruff format
language: system
types: [python]
exclude: ^notebook/

- id: mypy
name: Python type checking with MyPy
entry: uv run mypy
language: system
types: [python]
pass_filenames: false
args:
- "app"
- "tests"
# - id: mypy
# name: Python type checking with MyPy
# entry: uv run mypy
# language: system
# types: [python]
# pass_filenames: false
# args:
# - "app"
# - "tests"
# exclude: ^notebook/
# - repo: local
# hooks:
# - id: pyright
# name: pyright
# entry: pyright
# language: system
# types: [python]
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,10 @@ COPY ./app /code/app
RUN groupadd -r nonroot && useradd -r -g nonroot nonroot
USER nonroot

CMD ["/code/.venv/bin/uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
CMD ["/code/.venv/bin/uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
# To build the Docker image, use the following command:
# docker build -t my-fastapi-app .

# To run the Docker container, use the following command:
# docker run -p 8000:8000 my-fastapi-app

28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
pytest:
pytest --cov-report term --cov=app ./tests

pre-commit:
pre-commit run --all-files

clean:
find . | grep -E "(__pycache__|\.pyc|\.pyo)" | xargs rm -rf
find . | grep -E ".pytest_cache" | xargs rm -rf
find . | grep -E ".ipynb_checkpoints" | xargs rm -rf
rm -rf .coverage

ruff-check:
ruff check --fix .

ruff-format:
ruff format .

ruff: ruff-check ruff-format

run:
uv run uvicorn main:app --port 8000 --reload

ops: pytest pre-commit clean ruff
@echo "\033[92mAll operations completed successfully.\033[0m"
@echo "\033[93mPlease check the output above for any errors or warnings.\033[0m"
@echo "\033[93mIf you see any issues, please address them before proceeding.\033[0m"
@echo "\033[92mThank you for using this Makefile!\033[0m"
53 changes: 0 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,60 +23,7 @@
</a>
</div>

# Python FastAPI Template

A template for a Python FastAPI service:
- [x] [uv](https://docs.astral.sh/uv/getting-started/) for dependency management
- [x] [FastAPI](https://fastapi.tiangolo.com/) for building the API
- [x] [Devcontainer](https://code.visualstudio.com/docs/devcontainers/tutorial) for development environment
- [x] [Docker](https://www.docker.com/) for containerization
- [x] [Black](https://black.readthedocs.io/) & [isort](https://pycqa.github.io/isort/) for code formatting
- [x] [pre-commit](https://pre-commit.com/) for code quality checks
- [x] [Github Actions](https://github.com/features/actions) for CI/CD
- [x] [pytest](https://docs.pytest.org/) for testing

## Build and run locally

Install `uv` and `python3.11`
```
curl -LsSf https://astral.sh/uv/install.sh | sh
uv python install 3.11
```

Then install dependencies
```
uv sync --frozen
```

Run locally
```
uv run uvicorn app.main:app --port 8000 --reload
```

## Run tests
```
uv run pytest
```

## Build and run using Docker

```
docker build -t app .
docker run -p 8000:8000 -it app
```

### Notes
- If you face an issue with **git ssh access** while pushing new changes, run `ssh-add $HOME/.ssh/<your ssh key>` in terminal outside the devcontainer.

- If you face an issue during **devcontainer build**, make sure the repo is marked as trusted in VSCode. Check `Source Control` tab in the sidebar to mark the repo safe, then rebuild the devcontainer.

## Sample CRUD API

The `/v1` directory contains a sample API router demonstrating basic CRUD operations for users:

- Endpoints: Create, Read, Update, Delete users
- Router setup: `app/v1/routers/base.py` and `app/v1/routers/users.py`
- User model: `app/v1/models/user.py`
- User management: `app/v1/services/user/user_manager.py`

Use the samples as a starting point for your own API endpoints. View available endpoints at `http://localhost:8000/docs`.
16 changes: 16 additions & 0 deletions app/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# app/__init__.py

from .agent_orchestrator import determine_data_source, process_user_input_stream, run_agent_orchestrator
from .tools.data_analyst_agent import DataVisualizationAgent
from .tools.sql_data_analyst_agent import SQLDataAnalysisAgent
from .visualization_server import VisualizationServer


__all__ = [
"determine_data_source",
"process_user_input_stream",
"run_agent_orchestrator",
"VisualizationServer",
"DataVisualizationAgent",
"SQLDataAnalysisAgent",
]
Loading
Loading