Skip to content

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]

fix(azure.py): track azure llm api latency metric

Krrish Dholakia5ffd3f56f8f4
diff --git a/litellm/llms/azure/azure.py b/litellm/llms/azure/azure.py
index e0c1079a2a1..7fba70141c2 100644
--- a/litellm/llms/azure/azure.py
+++ b/litellm/llms/azure/azure.py
@@ -9,6 +9,7 @@ from openai import APITimeoutError, AsyncAzureOpenAI, AzureOpenAI
import litellm
from litellm.constants import DEFAULT_MAX_RETRIES
from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLoggingObj
+from litellm.litellm_core_utils.logging_utils import track_llm_api_timing
from litellm.llms.custom_httpx.http_handler import (
AsyncHTTPHandler,
HTTPHandler,
@@ -197,11 +198,13 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM):
except Exception as e:
raise e
+ @track_llm_api_timing()
async def make_azure_openai_chat_completion_request(
self,
azure_client: AsyncAzureOpenAI,
data: dict,
timeout: Union[float, httpx.Timeout],
+ logging_obj: LiteLLMLoggingObj,
):
"""
Helper to:
@@ -485,6 +488,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM):
azure_client=azure_client,
data=data,
timeout=timeout,
+ logging_obj=logging_obj,
)
logging_obj.model_call_details["response_headers"] = headers
@@ -643,6 +647,7 @@ class AzureChatCompletion(BaseAzureLLM, BaseLLM):
azure_client=azure_client,
data=data,
timeout=timeout,
+ logging_obj=logging_obj,
)
logging_obj.model_call_details["response_headers"] = headers
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index 9436e8af0f3..9e2425c7025 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -1,17 +1,10 @@
model_list:
- - model_name: amazon.nova-canvas-v1:0
- litellm_params:
- model: bedrock/amazon.nova-canvas-v1:0
- aws_region_name: "us-east-1"
- litellm_credential_name: "azure"
+ - model_name: "gpt-3.5-turbo"
+ litellm_params:
+ model: azure/chatgpt-v-2
+ api_key: os.environ/AZURE_API_KEY
+ api_base: os.environ/AZURE_API_BASE
-credential_list:
- - credential_name: azure
- credential_values:
- api_key: os.environ/AZURE_API_KEY
- api_base: os.environ/AZURE_API_BASE
- credential_info:
- description: "Azure API Key and Base URL"
- type: "azure"
- required: true
- default: "azure"
\ No newline at end of file
+litellm_settings:
+ callbacks: ["prometheus"]
+ service_callback: ["prometheus_system"]
\ No newline at end of file