The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Merge branch 'main' into litellm_fix_azure_api_version
Krish Dholakia409306b266c5
diff --cc litellm/proxy/_new_secret_config.yamlindex 521a034d6af,93b1c7770ad..f72e3727868--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@@ -1,6 -1,6 +1,4 @@@model_list:- - model_name: gpt-3.5-turbo+ - model_name: ollama/mistrallitellm_params:- model: azure/chatgpt-v-2- api_key: os.environ/AZURE_API_KEY- api_base: os.environ/AZURE_API_BASE+ model: ollama/mistral--diff --cc tests/otel_tests/test_guardrails.pyindex c48a5ba79bc,52f616bed98..7e9ff613a4d--- a/tests/otel_tests/test_guardrails.py+++ b/tests/otel_tests/test_guardrails.py@@@ -116,3 -143,55 +143,54 @@@ async def test_no_llm_guard_triggered()print("response=", response, "response headers", headers)assert "x-litellm-applied-guardrails" not in headers+-+ @pytest.mark.asyncio+ async def test_guardrails_with_api_key_controls():+ """+ - Make two API Keys+ - Key 1 with no guardrails+ - Key 2 with guardrails+ - Request to Key 1 -> should be success with no guardrails+ - Request to Key 2 -> should be error since guardrails are triggered+ """+ async with aiohttp.ClientSession() as session:+ key_with_guardrails = await generate_key(+ session=session,+ guardrails=[+ "aporia-post-guard",+ "aporia-pre-guard",+ ],+ )++ key_with_guardrails = key_with_guardrails["key"]++ key_without_guardrails = await generate_key(session=session, guardrails=None)++ key_without_guardrails = key_without_guardrails["key"]++ # test no guardrails triggered for key without guardrails+ response, headers = await chat_completion(+ session,+ key_without_guardrails,+ model="fake-openai-endpoint",+ messages=[{"role": "user", "content": f"Hello what's the weather"}],+ )+ await asyncio.sleep(3)++ print("response=", response, "response headers", headers)+ assert "x-litellm-applied-guardrails" not in headers++ # test guardrails triggered for key with guardrails+ try:+ response, headers = await chat_completion(+ session,+ key_with_guardrails,+ model="fake-openai-endpoint",+ messages=[+ {"role": "user", "content": f"Hello my name is [email protected]"}+ ],+ )+ pytest.fail("Should have thrown an exception")+ except Exception as e:+ print(e)+ assert "Aporia detected and blocked PII" in str(e)