From 37ef5c0cbf4399ab2ed899af89f081cb9335aed2 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:10:54 -0700 Subject: [PATCH 1/8] fix - test using specific commit --- litellm/__init__.py | 2 ++ litellm/llms/prompt_templates/factory.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index fb513c1337a..3d4ea021a4c 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -7,6 +7,8 @@ from litellm.proxy._types import KeyManagementSystem, KeyManagementSettings import httpx import dotenv +print("IMPORT LITELLM on Ishaan's commit") # noqa + dotenv.load_dotenv() ############################################# if set_verbose == True: diff --git a/litellm/llms/prompt_templates/factory.py b/litellm/llms/prompt_templates/factory.py index cc984a48425..5d3d70a5972 100644 --- a/litellm/llms/prompt_templates/factory.py +++ b/litellm/llms/prompt_templates/factory.py @@ -692,7 +692,7 @@ def anthropic_messages_pt_xml(messages: list): if messages[msg_i].get( "tool_calls", [] ): # support assistant tool invoke convertion - assistant_text += convert_to_anthropic_tool_invoke( + assistant_text += convert_to_anthropic_tool_invoke( # type: ignore messages[msg_i]["tool_calls"] ) From 7ead6f65da65362785b73c2623199b46434e8ad3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:13:55 -0700 Subject: [PATCH 2/8] ci/cd print commit hash to use --- .circleci/config.yml | 3 +++ litellm/__init__.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c9e4ddd0a38..2d7d0f8394c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,9 @@ jobs: steps: - checkout + - run: + name: Show git commit hash + command: echo "Git commit hash: $CIRCLE_SHA1" - run: name: Check if litellm dir was updated or if pyproject.toml was modified diff --git a/litellm/__init__.py b/litellm/__init__.py index 3d4ea021a4c..23d83fdbfa9 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -7,7 +7,6 @@ from litellm.proxy._types import KeyManagementSystem, KeyManagementSettings import httpx import dotenv -print("IMPORT LITELLM on Ishaan's commit") # noqa dotenv.load_dotenv() ############################################# From fdadeabe796de37ee0f118959c2729f351065ca3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:17:53 -0700 Subject: [PATCH 3/8] fix testing yaml --- .circleci/config.yml | 1 + litellm/tests/test_completion.py | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 2d7d0f8394c..e7c4f8a0a49 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,6 +7,7 @@ jobs: steps: - checkout + - run: name: Show git commit hash command: echo "Git commit hash: $CIRCLE_SHA1" diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index aa54f815496..e4936eb02ec 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -50,9 +50,6 @@ def test_completion_custom_provider_model_name(): pytest.fail(f"Error occurred: {e}") -# test_completion_custom_provider_model_name() - - def test_completion_azure_command_r(): try: litellm.set_verbose = True From 91015f533bb7b1d3bc0a825caaa1144969436cc4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:20:07 -0700 Subject: [PATCH 4/8] fix show git commit hash --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e7c4f8a0a49..42240abd25b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -10,7 +10,8 @@ jobs: - run: name: Show git commit hash - command: echo "Git commit hash: $CIRCLE_SHA1" + command: | + echo "Git commit hash: $CIRCLE_SHA1" - run: name: Check if litellm dir was updated or if pyproject.toml was modified From fe24c4b329e90053b0df6bb0fd54c2bad51ca491 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:25:55 -0700 Subject: [PATCH 5/8] ci/cd - use commit hash when building --- .github/workflows/ghcr_deploy.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index b9ab18859f6..d84cd864b61 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -9,6 +9,9 @@ on: description: "Build Stable version" type: boolean default: false + commit_hash: + description: "Commit hash" + required: true # Defines two custom environment variables for the workflow. Used for the Container registry domain, and a name for the Docker image that this workflow builds. env: @@ -106,7 +109,7 @@ jobs: - name: Build and push Docker image uses: docker/build-push-action@4976231911ebf5f32aad765192d35f942aa48cb8 with: - context: https://github.com/BerriAI/litellm.git#26f5823c4ec4806aba82d8c48dc9816713ffc214 + context: https://github.com/BerriAI/litellm.git#${{ github.event.inputs.commit_hash}} push: true tags: ${{ steps.meta.outputs.tags }}-${{ github.event.inputs.tag || 'latest' }}, ${{ steps.meta.outputs.tags }}-${{ env.type_release }} # if a tag is provided, use that, otherwise use the release tag, and if neither is available, use 'latest' labels: ${{ steps.meta.outputs.labels }} @@ -142,7 +145,7 @@ jobs: - name: Build and push Database Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - context: . + context: https://github.com/BerriAI/litellm.git#${{ github.event.inputs.commit_hash}} file: Dockerfile.database push: true tags: ${{ steps.meta-database.outputs.tags }}-${{ github.event.inputs.tag || 'latest' }}, ${{ steps.meta-database.outputs.tags }}-${{ env.type_release }} @@ -179,7 +182,7 @@ jobs: - name: Build and push Database Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 with: - context: . + context: https://github.com/BerriAI/litellm.git#${{ github.event.inputs.commit_hash}} file: ./litellm-js/spend-logs/Dockerfile push: true tags: ${{ steps.meta-spend-logs.outputs.tags }}-${{ github.event.inputs.tag || 'latest' }}, ${{ steps.meta-spend-logs.outputs.tags }}-${{ env.type_release }} From f204857043de1589c49b4027e058d202b1024e47 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:30:50 -0700 Subject: [PATCH 6/8] circle ci - pass commit hash for new docker builds --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 42240abd25b..92892d3ff84 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -298,7 +298,7 @@ jobs: -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ "https://api.github.com/repos/BerriAI/litellm/actions/workflows/ghcr_deploy.yml/dispatches" \ - -d "{\"ref\":\"main\", \"inputs\":{\"tag\":\"v${VERSION}\"}}" + -d "{\"ref\":\"main\", \"inputs\":{\"tag\":\"v${VERSION}\", \"stable\":false, \"commit_hash\":\"$CIRCLE_SHA1\"}}" workflows: version: 2 From ac1e8d36e45386e9fc5fe04a4fbdbd2b748f4019 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:32:00 -0700 Subject: [PATCH 7/8] fix remove extra line - __init__ --- litellm/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index 23d83fdbfa9..fb513c1337a 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -7,7 +7,6 @@ from litellm.proxy._types import KeyManagementSystem, KeyManagementSettings import httpx import dotenv - dotenv.load_dotenv() ############################################# if set_verbose == True: From c224adcb27c440de1ec7df1c1f74f1e082db5a12 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Fri, 5 Apr 2024 16:38:08 -0700 Subject: [PATCH 8/8] fix use correct commit hash when creating releases --- .github/workflows/ghcr_deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ghcr_deploy.yml b/.github/workflows/ghcr_deploy.yml index d84cd864b61..ad4acc8e139 100644 --- a/.github/workflows/ghcr_deploy.yml +++ b/.github/workflows/ghcr_deploy.yml @@ -263,6 +263,7 @@ jobs: const response = await github.rest.repos.createRelease({ draft: false, generate_release_notes: true, + target_commitish: ${{ github.event.inputs.commit_hash}} name: process.env.RELEASE_TAG, owner: context.repo.owner, prerelease: false,