diff --git a/litellm/main.py b/litellm/main.py index 37fc1db8f..5da2b4a52 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -294,6 +294,7 @@ async def acompletion( "api_version": api_version, "api_key": api_key, "model_list": model_list, + "extra_headers": extra_headers, "acompletion": True, # assuming this is a required parameter } if custom_llm_provider is None: diff --git a/litellm/proxy/_super_secret_config.yaml b/litellm/proxy/_super_secret_config.yaml index d39cd6775..ca108e631 100644 --- a/litellm/proxy/_super_secret_config.yaml +++ b/litellm/proxy/_super_secret_config.yaml @@ -24,8 +24,8 @@ general_settings: database_connection_timeout: 60 health_check_interval: 300 ui_access_mode: all -litellm_settings: - json_logs: true +# litellm_settings: +# json_logs: true model_list: - litellm_params: api_base: http://0.0.0.0:8080 @@ -43,5 +43,14 @@ model_list: api_version: '2023-05-15' model: azure/chatgpt-v-2 model_name: gpt-3.5-turbo +- litellm_params: + model: anthropic.claude-3-sonnet-20240229-v1:0 + model_name: bedrock-anthropic-claude-3 +- litellm_params: + api_base: https://openai-gpt-4-test-v-1.openai.azure.com/ + api_key: os.environ/AZURE_API_KEY + api_version: '2023-05-15' + model: azure/chatgpt-v-2 + model_name: gpt-3.5-turbo router_settings: enable_pre_call_checks: true diff --git a/litellm/tests/test_bedrock_completion.py b/litellm/tests/test_bedrock_completion.py index 8b13765da..e7346c3f3 100644 --- a/litellm/tests/test_bedrock_completion.py +++ b/litellm/tests/test_bedrock_completion.py @@ -13,7 +13,7 @@ import pytest import litellm from litellm import embedding, completion, completion_cost, Timeout, ModelResponse from litellm import RateLimitError -from litellm.llms.custom_httpx.http_handler import HTTPHandler +from litellm.llms.custom_httpx.http_handler import HTTPHandler, AsyncHTTPHandler from unittest.mock import patch, AsyncMock, Mock # litellm.num_retries = 3 @@ -519,20 +519,21 @@ def test_bedrock_ptu(): mock_client_post.assert_called_once() -def test_bedrock_extra_headers(): +@pytest.mark.asyncio +async def test_bedrock_extra_headers(): """ Check if a url with 'modelId' passed in, is created correctly Reference: https://github.com/BerriAI/litellm/issues/3805 """ - client = HTTPHandler() + client = AsyncHTTPHandler() - with patch.object(client, "post", new=Mock()) as mock_client_post: + with patch.object(client, "post", new=AsyncMock()) as mock_client_post: litellm.set_verbose = True from openai.types.chat import ChatCompletion try: - response = litellm.completion( + response = await litellm.acompletion( model="anthropic.claude-3-sonnet-20240229-v1:0", messages=[{"role": "user", "content": "What's AWS?"}], client=client,