mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-22 22:24:10 +00:00
fix(azure.py): track azure llm api latency metric
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
litellm_settings:
|
||||
callbacks: ["prometheus"]
|
||||
service_callback: ["prometheus_system"]
|
||||
Reference in New Issue
Block a user