From c1a3cb82a9eb4d8787a3e3a8b06d3250125b2a06 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 10 Mar 2025 14:49:27 -0700 Subject: [PATCH 1/4] docs on contributing --- README.md | 66 +---------- .../docs/extras/contributing_code.md | 110 ++++++++++++++++++ docs/my-website/sidebars.js | 1 + ...odel_prices_and_context_window_backup.json | 40 +++---- 4 files changed, 132 insertions(+), 85 deletions(-) create mode 100644 docs/my-website/docs/extras/contributing_code.md diff --git a/README.md b/README.md index 014df0ccdd..ab83f1927b 100644 --- a/README.md +++ b/README.md @@ -340,71 +340,7 @@ curl 'http://0.0.0.0:4000/key/generate' \ ## Contributing -To contribute: Clone the repo locally -> Make a change -> Submit a PR with the change. - -Here's how to modify the repo locally: - -Step 1: Clone the repo - -``` -git clone https://github.com/BerriAI/litellm.git -``` - -Step 2: Install dependencies: - -``` -pip install -r requirements.txt -``` - -Step 3: Test your change: - -a. Add a pytest test within `tests/litellm/` - -This folder follows the same directory structure as `litellm/`. - -If a corresponding test file does not exist, create one. - -b. Run the test - -``` -cd tests/litellm # pwd: Documents/litellm/litellm/tests/litellm -pytest /path/to/test_file.py -``` - -Step 4: Submit a PR with your changes! 🚀 - -- push your fork to your GitHub repo -- submit a PR from there - -### Building LiteLLM Docker Image - -Follow these instructions if you want to build / run the LiteLLM Docker Image yourself. - -Step 1: Clone the repo - -``` -git clone https://github.com/BerriAI/litellm.git -``` - -Step 2: Build the Docker Image - -Build using Dockerfile.non_root -``` -docker build -f docker/Dockerfile.non_root -t litellm_test_image . -``` - -Step 3: Run the Docker Image - -Make sure config.yaml is present in the root directory. This is your litellm proxy config file. -``` -docker run \ - -v $(pwd)/proxy_config.yaml:/app/config.yaml \ - -e DATABASE_URL="postgresql://xxxxxxxx" \ - -e LITELLM_MASTER_KEY="sk-1234" \ - -p 4000:4000 \ - litellm_test_image \ - --config /app/config.yaml --detailed_debug -``` +Interested in contributing? Contributions to LiteLLM Python SDK, Proxy Server, and contributing LLM integrations are both accepted and highly encouraged! See our Contribution Guide for more details # Enterprise For companies that need better security, user management and professional support diff --git a/docs/my-website/docs/extras/contributing_code.md b/docs/my-website/docs/extras/contributing_code.md new file mode 100644 index 0000000000..395a882478 --- /dev/null +++ b/docs/my-website/docs/extras/contributing_code.md @@ -0,0 +1,110 @@ +# Contributing Code + +Here are the core requirements for any PR submitted to LiteLLM + +- Follow the [fork and pull request workflow](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) +- Fill out the relevant issue(s) your PR solves +- Add testing, **Adding atleast 1 test is a hard requirement** +- Ensure your PR passes the following tests + - Unit Tests + - Formatting / Linting Tests +- Keep scope as isolated as possible. As a general rule, your changes should address 1 specific problem at a time + + + + +## Quick start + +## 1. Setup your local dev environment + + +Here's how to modify the repo locally: + +Step 1: Clone the repo + +```shell +git clone https://github.com/BerriAI/litellm.git +``` + +Step 2: Install dependencies: + +```shell +pip install -r requirements.txt +``` + +That's it, your local dev environment is ready! + +## 2. Adding Testing to your PR + +- Add your test to the [`tests/litellm/` directory](https://github.com/BerriAI/litellm/tree/main/tests/litellm) + +- This directory 1:1 maps the the `litellm/` directory, and can only contain mocked tests. +- Do not add real llm api calls to this directory. + +### 2.1 File Naming Convention for `tests/litellm/` + +The `tests/litellm/` directory follows the same directory structure as `litellm/`. + +- `litellm/proxy/test_caching_routes.py` maps to `litellm/proxy/caching_routes.py` +- `test_{filename}.py` maps to `litellm/{filename}.py` + + + + +### Checklist for PRs + + + +Step 3: Test your change: + +a. Add a pytest test within `tests/litellm/` + +This folder follows the same directory structure as `litellm/`. + +If a corresponding test file does not exist, create one. + +b. Run the test + +```shell +cd tests/litellm # pwd: Documents/litellm/litellm/tests/litellm +pytest /path/to/test_file.py +``` + +Step 4: Submit a PR with your changes! 🚀 + +- push your fork to your GitHub repo +- submit a PR from there + + +## Advanced +### Building LiteLLM Docker Image + +Some people might want to build the LiteLLM docker image themselves. Follow these instructions if you want to build / run the LiteLLM Docker Image yourself. + +Step 1: Clone the repo + +```shell +git clone https://github.com/BerriAI/litellm.git +``` + +Step 2: Build the Docker Image + +Build using Dockerfile.non_root + +```shell +docker build -f docker/Dockerfile.non_root -t litellm_test_image . +``` + +Step 3: Run the Docker Image + +Make sure config.yaml is present in the root directory. This is your litellm proxy config file. + +```shell +docker run \ + -v $(pwd)/proxy_config.yaml:/app/config.yaml \ + -e DATABASE_URL="postgresql://xxxxxxxx" \ + -e LITELLM_MASTER_KEY="sk-1234" \ + -p 4000:4000 \ + litellm_test_image \ + --config /app/config.yaml --detailed_debug +``` diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 85b94182d7..cf4f14b202 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -437,6 +437,7 @@ const sidebars = { type: "category", label: "Contributing", items: [ + "extras/contributing_code", { type: "category", label: "Adding Providers", diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index b61ddd4562..b2a08544f9 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -6057,26 +6057,6 @@ "mode": "chat", "supports_tool_choice": true }, - "jamba-large-1.6": { - "max_tokens": 256000, - "max_input_tokens": 256000, - "max_output_tokens": 256000, - "input_cost_per_token": 0.000002, - "output_cost_per_token": 0.000008, - "litellm_provider": "ai21", - "mode": "chat", - "supports_tool_choice": true - }, - "jamba-mini-1.6": { - "max_tokens": 256000, - "max_input_tokens": 256000, - "max_output_tokens": 256000, - "input_cost_per_token": 0.0000002, - "output_cost_per_token": 0.0000004, - "litellm_provider": "ai21", - "mode": "chat", - "supports_tool_choice": true - }, "jamba-1.5-mini": { "max_tokens": 256000, "max_input_tokens": 256000, @@ -6097,6 +6077,26 @@ "mode": "chat", "supports_tool_choice": true }, + "jamba-large-1.6": { + "max_tokens": 256000, + "max_input_tokens": 256000, + "max_output_tokens": 256000, + "input_cost_per_token": 0.000002, + "output_cost_per_token": 0.000008, + "litellm_provider": "ai21", + "mode": "chat", + "supports_tool_choice": true + }, + "jamba-mini-1.6": { + "max_tokens": 256000, + "max_input_tokens": 256000, + "max_output_tokens": 256000, + "input_cost_per_token": 0.0000002, + "output_cost_per_token": 0.0000004, + "litellm_provider": "ai21", + "mode": "chat", + "supports_tool_choice": true + }, "j2-mid": { "max_tokens": 8192, "max_input_tokens": 8192, From a4b87401d5bcad1f456f79e59497a4901af157c9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 10 Mar 2025 15:43:53 -0700 Subject: [PATCH 2/4] docs contributing to litellm --- .../docs/extras/contributing_code.md | 40 ++++++------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/docs/my-website/docs/extras/contributing_code.md b/docs/my-website/docs/extras/contributing_code.md index 395a882478..47696b3c2e 100644 --- a/docs/my-website/docs/extras/contributing_code.md +++ b/docs/my-website/docs/extras/contributing_code.md @@ -1,15 +1,15 @@ # Contributing Code +## **Checklist before submitting a PR** + Here are the core requirements for any PR submitted to LiteLLM -- Follow the [fork and pull request workflow](https://docs.github.com/en/get-started/exploring-projects-on-github/contributing-to-a-project) -- Fill out the relevant issue(s) your PR solves -- Add testing, **Adding atleast 1 test is a hard requirement** -- Ensure your PR passes the following tests - - Unit Tests - - Formatting / Linting Tests -- Keep scope as isolated as possible. As a general rule, your changes should address 1 specific problem at a time +- [ ] Add testing, **Adding at least 1 test is a hard requirement** - [see details](#2-adding-testing-to-your-pr) +- [ ] Ensure your PR passes the following tests: + - [ ] [Unit Tests](#3-running-unit-tests) + - [ ] Formatting / Linting Tests +- [ ] Keep scope as isolated as possible. As a general rule, your changes should address 1 specific problem at a time @@ -26,10 +26,10 @@ Step 1: Clone the repo git clone https://github.com/BerriAI/litellm.git ``` -Step 2: Install dependencies: +Step 2: Install dev dependencies: ```shell -pip install -r requirements.txt +poetry install --with dev --extras proxy ``` That's it, your local dev environment is ready! @@ -48,29 +48,15 @@ The `tests/litellm/` directory follows the same directory structure as `litellm/ - `litellm/proxy/test_caching_routes.py` maps to `litellm/proxy/caching_routes.py` - `test_{filename}.py` maps to `litellm/{filename}.py` +### 3. Running Unit Tests - - -### Checklist for PRs - - - -Step 3: Test your change: - -a. Add a pytest test within `tests/litellm/` - -This folder follows the same directory structure as `litellm/`. - -If a corresponding test file does not exist, create one. - -b. Run the test +run the following command on the root of the litellm directory ```shell -cd tests/litellm # pwd: Documents/litellm/litellm/tests/litellm -pytest /path/to/test_file.py +make test-unit ``` -Step 4: Submit a PR with your changes! 🚀 +### 4. Submit a PR with your changes! - push your fork to your GitHub repo - submit a PR from there From 856ed0e1fd4ccd46cfc5c539118b703bf62eb8d1 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 10 Mar 2025 15:45:22 -0700 Subject: [PATCH 3/4] docs contributing --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ab83f1927b..97ccc423da 100644 --- a/README.md +++ b/README.md @@ -340,7 +340,7 @@ curl 'http://0.0.0.0:4000/key/generate' \ ## Contributing -Interested in contributing? Contributions to LiteLLM Python SDK, Proxy Server, and contributing LLM integrations are both accepted and highly encouraged! See our Contribution Guide for more details +Interested in contributing? Contributions to LiteLLM Python SDK, Proxy Server, and contributing LLM integrations are both accepted and highly encouraged! [See our Contribution Guide for more details](https://docs.litellm.ai/docs/contributing) # Enterprise For companies that need better security, user management and professional support From 8198bc286251c77677105ce5c6c74dc5cb10c16b Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 10 Mar 2025 15:49:18 -0700 Subject: [PATCH 4/4] Pre-Submission checklist --- .github/pull_request_template.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 3615d030bf..9830074142 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,6 +6,16 @@ +## Pre-Submission checklist + +**Please complete all items before asking a LiteLLM maintainer to review your PR** + +- [ ] I have Added testing in the `tests/litellm/` directory, **Adding at least 1 test is a hard requirement** - [see details](https://docs.litellm.ai/docs/contributing#2-adding-testing-to-your-pr) +- [ ] I have added a screenshot of my new test passing locally +- [ ] My PR passes all unit tests on `make unit-test` [https://docs.litellm.ai/docs/contributing] +- [ ] My PR's scope is as isolated as possible, it only solves 1 specific problem + + ## Type @@ -20,10 +30,4 @@ ## Changes - - -## [REQUIRED] Testing - Attach a screenshot of any new tests passing locally -If UI changes, send a screenshot/GIF of working UI fixes - -