diff --git a/.circleci/config.yml b/.circleci/config.yml index aaad8df77..2727cd221 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,4 +1,4 @@ -version: 2.1 +version: 4.3.4 jobs: local_testing: docker: @@ -40,7 +40,7 @@ jobs: pip install "aioboto3==12.3.0" pip install langchain pip install lunary==0.2.5 - pip install "langfuse==2.7.3" + pip install "langfuse==2.27.1" pip install numpydoc pip install traceloop-sdk==0.0.69 pip install openai @@ -57,6 +57,9 @@ jobs: pip install "pytest-mock==3.12.0" pip install python-multipart pip install google-cloud-aiplatform + pip install prometheus-client==0.20.0 + pip install "pydantic==2.7.1" + pip install "diskcache==5.6.1" - save_cache: paths: - ./venv @@ -187,22 +190,28 @@ jobs: command: | docker run -d \ -p 4000:4000 \ - -e DATABASE_URL=$PROXY_DOCKER_DB_URL \ + -e DATABASE_URL=$PROXY_DATABASE_URL \ -e AZURE_API_KEY=$AZURE_API_KEY \ + -e REDIS_HOST=$REDIS_HOST \ + -e REDIS_PASSWORD=$REDIS_PASSWORD \ + -e REDIS_PORT=$REDIS_PORT \ -e AZURE_FRANCE_API_KEY=$AZURE_FRANCE_API_KEY \ -e AZURE_EUROPE_API_KEY=$AZURE_EUROPE_API_KEY \ -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ -e AWS_REGION_NAME=$AWS_REGION_NAME \ + -e AUTO_INFER_REGION=True \ -e OPENAI_API_KEY=$OPENAI_API_KEY \ + -e LANGFUSE_PROJECT1_PUBLIC=$LANGFUSE_PROJECT1_PUBLIC \ + -e LANGFUSE_PROJECT2_PUBLIC=$LANGFUSE_PROJECT2_PUBLIC \ + -e LANGFUSE_PROJECT1_SECRET=$LANGFUSE_PROJECT1_SECRET \ + -e LANGFUSE_PROJECT2_SECRET=$LANGFUSE_PROJECT2_SECRET \ --name my-app \ -v $(pwd)/proxy_server_config.yaml:/app/config.yaml \ my-app:latest \ --config /app/config.yaml \ --port 4000 \ - --num_workers 8 \ --detailed_debug \ - --run_gunicorn \ - run: name: Install curl and dockerize command: | @@ -217,7 +226,7 @@ jobs: background: true - run: name: Wait for app to be ready - command: dockerize -wait http://localhost:4000 -timeout 1m + command: dockerize -wait http://localhost:4000 -timeout 5m - run: name: Run tests command: | diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..0a5eb19b6 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +{ + "name": "Python 3.11", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile + "image": "mcr.microsoft.com/devcontainers/python:3.11-bookworm", + // https://github.com/devcontainers/images/tree/main/src/python + // https://mcr.microsoft.com/en-us/product/devcontainers/python/tags + + // "build": { + // "dockerfile": "Dockerfile", + // "context": ".." + // }, + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + "settings": {}, + "extensions": [ + "ms-python.python", + "ms-python.vscode-pylance", + "GitHub.copilot", + "GitHub.copilot-chat" + ] + } + }, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [4000], + + "containerEnv": { + "LITELLM_LOG": "DEBUG" + }, + + // Use 'portsAttributes' to set default properties for specific forwarded ports. + // More info: https://containers.dev/implementors/json_reference/#port-attributes + "portsAttributes": { + "4000": { + "label": "LiteLLM Server", + "onAutoForward": "notify" + } + }, + + // More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "litellm", + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pipx install poetry && poetry install -E extra_proxy -E proxy" +} \ No newline at end of file diff --git a/.dockerignore b/.dockerignore index efff383d4..78833aa31 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,5 @@ -/docs -/cookbook -/.circleci -/.github -/tests \ No newline at end of file +docs +cookbook +.circleci +.github +tests diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 000000000..f0ced6bed --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,10 @@ +# Add the commit hash of any commit you want to ignore in `git blame` here. +# One commit hash per line. +# +# The GitHub Blame UI will use this file automatically! +# +# Run this command to always ignore formatting commits in `git blame` +# git config blame.ignoreRevsFile .git-blame-ignore-revs + +# Update pydantic code to fix warnings (GH-3600) +876840e9957bc7e9f7d6a2b58c4d7c53dad16481 diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 000000000..b7a164368 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,29 @@ +## Title + + + +## Relevant issues + + + +## Type + + + + +🆕 New Feature +🐛 Bug Fix +🧹 Refactoring +📖 Documentation +🚄 Infrastructure +✅ Test + +## Changes + + + +## [REQUIRED] Testing - Attach a screenshot of any new tests passing locall +If UI changes, send a screenshot/GIF of working UI fixes + + + diff --git a/.github/workflows/interpret_load_test.py b/.github/workflows/interpret_load_test.py index b52d4d2b3..b1a28e069 100644 --- a/.github/workflows/interpret_load_test.py +++ b/.github/workflows/interpret_load_test.py @@ -64,6 +64,11 @@ if __name__ == "__main__": ) # Replace with your repository's username and name latest_release = repo.get_latest_release() print("got latest release: ", latest_release) + print(latest_release.title) + print(latest_release.tag_name) + + release_version = latest_release.title + print("latest release body: ", latest_release.body) print("markdown table: ", markdown_table) @@ -74,8 +79,25 @@ if __name__ == "__main__": start_index = latest_release.body.find("Load Test LiteLLM Proxy Results") existing_release_body = latest_release.body[:start_index] + docker_run_command = f""" +\n\n +## Docker Run LiteLLM Proxy + +``` +docker run \\ +-e STORE_MODEL_IN_DB=True \\ +-p 4000:4000 \\ +ghcr.io/berriai/litellm:main-{release_version} +``` + """ + print("docker run command: ", docker_run_command) + new_release_body = ( existing_release_body + + docker_run_command + + "\n\n" + + "### Don't want to maintain your internal proxy? get in touch 🎉" + + "\nHosted Proxy Alpha: https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat" + "\n\n" + "## Load Test LiteLLM Proxy Results" + "\n\n" diff --git a/.gitignore b/.gitignore index 309f726fe..b75a92309 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .venv .env +litellm/proxy/myenv/* litellm_uuid.txt __pycache__/ *.pyc @@ -50,3 +51,8 @@ kub.yaml loadtest_kub.yaml litellm/proxy/_new_secret_config.yaml litellm/proxy/_new_secret_config.yaml +litellm/proxy/_super_secret_config.yaml +litellm/proxy/_super_secret_config.yaml +litellm/proxy/myenv/bin/activate +litellm/proxy/myenv/bin/Activate.ps1 +myenv/* \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2a84048e0..cc41d85f1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,7 +7,7 @@ repos: rev: 7.0.0 # The version of flake8 to use hooks: - id: flake8 - exclude: ^litellm/tests/|^litellm/proxy/proxy_cli.py|^litellm/integrations/|^litellm/proxy/tests/ + exclude: ^litellm/tests/|^litellm/proxy/proxy_cli.py|^litellm/proxy/tests/ additional_dependencies: [flake8-print] files: litellm/.*\.py - repo: local diff --git a/README.md b/README.md index 6c81181f3..684d5de73 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@
Call all LLM APIs using the OpenAI format [Bedrock, Huggingface, VertexAI, TogetherAI, Azure, OpenAI, etc.]