Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/DomGrieco/phidata
Browse files Browse the repository at this point in the history
  • Loading branch information
DomGrieco committed Dec 1, 2024
2 parents d1648e4 + c7baaf1 commit dc010dd
Show file tree
Hide file tree
Showing 1,244 changed files with 43,794 additions and 19,486 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/stale-issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Close Stale Issues

on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:

jobs:
close_stale_issues:
runs-on: ubuntu-latest
permissions:
issues: write

steps:
- name: Close stale issues
uses: actions/stale@v5
with:
stale-issue-message: >
This issue has been marked as stale because it has been inactive
for more than 14 days. Please update this issue or it will be
automatically closed.
days-before-issue-stale: 14
days-before-issue-close: 0
stale-issue-label: stale

# Disable PR processing
days-before-pr-stale: -1
days-before-pr-close: -1

# Only process issues, not PRs
only-issue-labels: "*"
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
- name: Ruff check
run: |
ruff check .
# - name: Mypy
# run: |
# mypy .
- name: Mypy
run: |
mypy .
# - name: Test
# run: |
# pytest
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ aienv*
scratch
junk
tmp
agents.db
data.db

.ipynb_checkpoints
/eruv
Expand Down
64 changes: 42 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Please follow the [fork and pull request](https://docs.github.com/en/get-started
1. Clone the repository.
2. Create a virtual environment:
- For Unix, use `./scripts/create_venv.sh`.
- For Windows, use `.\scripts\create_venv_win.bat`.
- For Windows, use `.\scripts\create_venv.bat`.
- This setup will:
- Create a `phienv` virtual environment in the current directory.
- Install the required packages.
Expand All @@ -29,10 +29,15 @@ Please follow the [fork and pull request](https://docs.github.com/en/get-started
## Formatting and validation

Ensure your code meets our quality standards by running the appropriate formatting and validation script before submitting a pull request:
- For Unix: `./scripts/format.sh`
- For Windows: `.\scripts\format.bat`
These scripts will perform code formatting with `ruff`, static type checks with `mypy`, and run unit tests with `pytest`.

- For Unix:
- `./scripts/format.sh`
- `./scripts/validate.sh`
- For Windows:
- `.\scripts\format.bat`
- `.\scripts\validate.bat`

These scripts will perform code formatting with `ruff`, static type checks with `mypy`, and run unit tests with `pytest`.

## Adding a new Vector Database

Expand All @@ -42,36 +47,51 @@ These scripts will perform code formatting with `ruff`, static type checks with
- Your Class will be in the `phi/vectordb/<your_db>/<your_db>.py` file.
- The `VectorDb` interface is defined in `phi/vectordb/base
- Import your `VectorDb` Class in `phi/vectordb/<your_db>/__init__.py`.
- Checkout the [`phi/vectordb/pgvector/pgvector2`](https://github.com/phidatahq/phidata/blob/main/phi/vectordb/pgvector/pgvector2.py) file for an example.
4. Add a recipe for using your `VectorDb` under `cookbook/<your_db>`.
- Checkout [`phidata/cookbook/pgvector`](https://github.com/phidatahq/phidata/tree/main/cookbook/pgvector) for an example (you do not need to add the `resources.py` file).
5. Important: Format and validate your code by running `./scripts/format.sh`.
- Checkout the [`phi/vectordb/pgvector/pgvector`](https://github.com/phidatahq/phidata/blob/main/phi/vectordb/pgvector/pgvector.py) file for an example.
4. Add a recipe for using your `VectorDb` under `cookbook/vectordb/<your_db>`.
- Checkout [`phidata/cookbook/vectordb/pgvector`](https://github.com/phidatahq/phidata/tree/main/cookbook/vectordb/pgvector) for an example.
5. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`.
6. Submit a pull request.

## Adding a new LLM provider
## Adding a new Model Provider

1. Setup your local environment by following the [Development setup](#development-setup).
2. Create a new directory under `phi/llm` for the new LLM provider.
3. If the LLM provider supports the OpenAI API spec:
- Create a Class for your LLM provider that inherits the `OpenAILike` Class from `phi/llm/openai/like.py`.
- Your Class will be in the `phi/llm/<your_llm>/<your_llm>.py` file.
- Import your Class in the `phi/llm/<your_llm>/__init__.py` file.
- Checkout the [`phi/llm/together/together.py`](https://github.com/phidatahq/phidata/blob/main/phi/llm/together/together.py) file for an example.
4. If the LLM provider does not support the OpenAI API spec:
2. Create a new directory under `phi/model` for the new Model provider.
3. If the Model provider supports the OpenAI API spec:
- Create a Class for your LLM provider that inherits the `OpenAILike` Class from `phi/model/openai/like.py`.
- Your Class will be in the `phi/model/<your_model>/<your_model>.py` file.
- Import your Class in the `phi/model/<your_model>/__init__.py` file.
- Checkout the [`phi/model/xai/xai.py`](https://github.com/phidatahq/phidata/blob/main/phi/llm/together/together.py) file for an example.
4. If the Model provider does not support the OpenAI API spec:
- Reach out to us on [Discord](https://discord.gg/4MtYHHrgA8) or open an issue to discuss the best way to integrate your LLM provider.
5. Add a recipe for using your LLM provider under `cookbook/<your_llm>`.
- Checkout [`phidata/cookbook/together`](https://github.com/phidatahq/phidata/tree/main/cookbook/together) for an example.
6. Important: Format and validate your code by running `./scripts/format.sh`.
- Checkout [`phi/model/anthropic/claude.py`](https://github.com/phidatahq/phidata/blob/main/phi/model/anthropic/claude.py) or [`phi/model/cohere/chat.py`](https://github.com/phidatahq/phidata/blob/main/phi/model/cohere/chat.py) for inspiration.
5. Add a recipe for using your Model provider under `cookbook/providers/<your_model>`.
- Checkout [`phidata/cookbook/provider/claude`](https://github.com/phidatahq/phidata/tree/main/cookbook/providers/claude) for an example.
6. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`.
7. Submit a pull request.

Message us on [Discord](https://discord.gg/4MtYHHrgA8) if you have any questions or need help with credits.
## Adding a new Tool.

1. Setup your local environment by following the [Development setup](#development-setup).
2. Create a new directory under `phi/tools` for the new Tool.
3. Create a Class for your Tool that inherits the `Toolkit` Class from `phi/tools/toolkit/.py`.
- Your Class will be in `phi/tools/<your_tool>.py`.
- Make sure to register all functions in your class via a flag.
- Checkout the [`phi/tools/youtube_tools.py`](https://github.com/phidatahq/phidata/blob/main/phi/tools/youtube_tools.py) file for an example.
- If your tool requires an API key, checkout the [`phi/tools/serpapi_tools.py`](https://github.com/phidatahq/phidata/blob/main/phi/tools/serpapi_tools.py) as well.
4. Add a recipe for using your Tool under `cookbook/tools/<your_tool>`.
- Checkout [`phidata/cookbook/tools/youtube_tools`](https://github.com/phidatahq/phidata/blob/main/cookbook/tools/youtube_tools.py) for an example.
5. Important: Format and validate your code by running `./scripts/format.sh` and `./scripts/validate.sh`.
6. Submit a pull request.

Message us on [Discord](https://discord.gg/4MtYHHrgA8) or post on [Discourse](https://community.phidata.com/) if you have any questions or need help with credits.

## 📚 Resources

- <a href="https://docs.phidata.com/introduction" target="_blank" rel="noopener noreferrer">Documentation</a>
- <a href="https://discord.gg/4MtYHHrgA8" target="_blank" rel="noopener noreferrer">Discord</a>
- <a href="https://community.phidata.com/" target="_blank" rel="noopener noreferrer">Discourse</a>

## 📝 License

This project is licensed under the terms of the [MIT license](/LICENSE)

This project is licensed under the terms of the [MPL-2.0 license](/LICENSE)
Loading

0 comments on commit dc010dd

Please sign in to comment.