-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/support-any-type-of-id
- Loading branch information
Showing
28 changed files
with
619 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Contributing | ||
|
||
## Local Dev Setup | ||
|
||
### Clone the repo | ||
|
||
`git clone git@github.com:vintasoftware/django-ai-assistant.git` | ||
|
||
### Set up a virtualenv, optionally set up nvm, and activate your environment(s) | ||
|
||
You can use [pyenv](https://github.com/pyenv/pyenv), [pipenv](https://github.com/pypa/pipenv/blob/main/docs/installation.md), vanilla venvs or the tool of your choice. | ||
|
||
For installing Node, we recommend [NVM](https://github.com/nvm-sh/nvm). | ||
|
||
### Install dependencies | ||
|
||
#### Backend | ||
|
||
`poetry install` | ||
|
||
#### Frontend | ||
|
||
```bash | ||
cd frontend | ||
npm install | ||
``` | ||
|
||
### Install pre-commit hooks | ||
|
||
`pre-commit install` | ||
|
||
It's critical to run the pre-commit hooks before pushing your code to follow the project's code style, and avoid linting errors. | ||
|
||
### Developing with the example project | ||
|
||
Run the frontend project in build:watch mode: | ||
|
||
```bash | ||
cd frontend | ||
npm run build:watch | ||
``` | ||
|
||
Then follow the instructions in the [example README](https://github.com/vintasoftware/django-ai-assistant/tree/main/example#readme). | ||
|
||
## Tests | ||
|
||
Run tests with: | ||
|
||
```bash | ||
poetry run pytest | ||
``` | ||
|
||
The tests use `pytest-vcr` to record and replay HTTP requests to AI models. | ||
|
||
If you're implementing a new test that needs to call a real AI model, you need to set the `OPENAI_API_KEY` environment variable on root `.env` file. | ||
Then, you will run the tests in record mode: | ||
|
||
```bash | ||
poetry run pytest --record-mode=once | ||
``` | ||
|
||
## Documentation | ||
|
||
We use [mkdocs-material](https://squidfunk.github.io/mkdocs-material/) to generate the documentation from markdown files. | ||
Check the files in the `docs` directory. | ||
|
||
To run the documentation locally, you need to run: | ||
|
||
```bash | ||
poetry run mkdocs serve | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,97 +1,25 @@ | ||
[![Django CI](https://github.com/vintasoftware/django-ai-assistant/actions/workflows/django.yml/badge.svg)](https://github.com/vintasoftware/django-ai-assistant/actions/workflows/django.yml) | ||
[![Node CI](https://github.com/vintasoftware/django-ai-assistant/actions/workflows/node.yml/badge.svg)](https://github.com/vintasoftware/django-ai-assistant/actions/workflows/node.yml) | ||
|
||
# django-ai-assistant | ||
# django-ai-assistant ![docs/images/robot-happy-outline.svg] | ||
|
||
Django app to integrate with [OpenAI Assistants API](https://platform.openai.com/docs/assistants/overview). Supports [Function calling](https://platform.openai.com/docs/assistants/tools/function-calling). | ||
Combine the power of LLMs with Django's productivity to build intelligent applications. | ||
Let AI Assistants call methods from Django's side and do anything your users need! | ||
|
||
⚠️ Under heavy development. Not launched yet! | ||
Use AI Tool Calling and RAG with Django to easily build state of the art AI Assistants. | ||
|
||
## Dev Setup | ||
|
||
### Clone the repo | ||
|
||
`git clone git@github.com:vintasoftware/django-ai-assistant.git` | ||
|
||
### Set up a virtualenv, optionally set up nvm, and activate your environment(s) | ||
|
||
You can use [pyenv](https://github.com/pyenv/pyenv), [pipenv](https://github.com/pypa/pipenv/blob/main/docs/installation.md), vanilla venvs or the tool of your choice. | ||
|
||
[NVM](https://github.com/nvm-sh/nvm) | ||
|
||
### Install vite | ||
|
||
`npm install -g vite` or install locally if you prefer | ||
|
||
### Create a .env file at the root of the project | ||
|
||
`cp .env.example .env` | ||
|
||
To gather the API keys for these tools, head to the following links: | ||
- [OpenAI](https://platform.openai.com/api-keys) | ||
- [Weather](https://www.weatherapi.com/) | ||
- [Tavily](https://app.tavily.com/home) | ||
- [Firecrawl](https://www.firecrawl.dev/) | ||
|
||
### Build the frontend | ||
|
||
`cd frontend` | ||
|
||
`vite build` | ||
|
||
### Create a .env file at the example folder | ||
|
||
`cd example` | ||
|
||
`cp .env.example .env` | ||
|
||
### Install dependencies | ||
|
||
#### Backend | ||
|
||
`cd example` | ||
|
||
`poetry install` | ||
|
||
Install pre-commit hooks: | ||
|
||
`pre-commit install` | ||
|
||
#### Frontend | ||
|
||
`cd example` | ||
|
||
`npm install` | ||
|
||
### Run the project | ||
|
||
From the example folder: | ||
|
||
#### Frontend | ||
|
||
`npm run start` | ||
|
||
#### Backend | ||
|
||
`python manage.py migrate` | ||
|
||
`python manage.py createsuperuser` | ||
|
||
`python manage.py runserver` | ||
|
||
### Log in to Django Admin | ||
|
||
Go to /admin and log in with your superuser account. | ||
⚠️ Under heavy development. Not publicly launched yet! | ||
|
||
Please check the documentation: [https://vintasoftware.github.io/django-ai-assistant/](https://vintasoftware.github.io/django-ai-assistant/) | ||
|
||
## Contributing | ||
|
||
If you wish to contribute to this project, please first discuss the change you wish to make via an [issue](https://github.com/vintasoftware/django-react-boilerplate/issues). | ||
You're welcome to contribute with Django AI Assistant! Please feel free to tackle existing [issues](https://github.com/vintasoftware/django-ai-assistant/issues). If you have a new idea, please open a new issue to discuss it. | ||
|
||
Check our [contributing guide](https://github.com/vintasoftware/django-react-boilerplate/blob/main/CONTRIBUTING.md) to learn more about our development process and how you can test your changes to the boilerplate. | ||
Check our [contributing guide](CONTRIBUTING.md) to learn more about how to develop and test the project locally, before opening a pull request. | ||
|
||
## Commercial Support | ||
|
||
[![alt text](https://avatars2.githubusercontent.com/u/5529080?s=80&v=4 "Vinta Logo")](https://www.vinta.com.br/) | ||
[![alt text](https://avatars2.githubusercontent.com/u/5529080?s=80&v=4 "Vinta Logo")](https://www.vintasoftware.com/) | ||
|
||
This project is maintained by [Vinta Software](https://www.vinta.com.br/) and is used in products of Vinta's clients. We are always looking for exciting work! If you need any commercial support, feel free to get in touch: contact@vinta.com.br | ||
This is an open-source project maintained by [Vinta Software](https://www.vinta.com.br/) and is used in products of Vinta's clients. We are always looking for exciting work! If you need any commercial support, feel free to get in touch: contact@vinta.com.br |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
class AIAssistantMisconfiguredError(Exception): | ||
"""Raised when the AI assistant is misconfigured, e.g. when assistant id is invalid.""" | ||
|
||
pass | ||
|
||
|
||
class AIAssistantNotDefinedError(Exception): | ||
"""Raised when the AI assistant is not defined when trying to get it by id.""" | ||
|
||
pass | ||
|
||
|
||
class AIUserNotAllowedError(Exception): | ||
"""Raised when the user has no permission to manage a Thread, Message, or AIAssistant.""" | ||
|
||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.