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
initialize_standard_built_in_tools_params
Ishaan Jaff10da28722512
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex 3e694220a54..f437755771c 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -35,6 +35,9 @@ from litellm.integrations.custom_logger import CustomLoggerfrom litellm.integrations.mlflow import MlflowLoggerfrom litellm.integrations.pagerduty.pagerduty import PagerDutyAlertingfrom litellm.litellm_core_utils.get_litellm_params import get_litellm_params+from litellm.litellm_core_utils.llm_cost_calc.tool_call_cost_tracking import (+ StandardBuiltInToolCostTracking,+)from litellm.litellm_core_utils.model_param_helper import ModelParamHelperfrom litellm.litellm_core_utils.redact_messages import (redact_message_input_output_from_custom_logger,@@ -48,6 +51,7 @@ from litellm.types.llms.openai import (HttpxBinaryResponseContent,ResponseCompletedEvent,ResponsesAPIResponse,+ WebSearchOptions,)from litellm.types.rerank import RerankResponsefrom litellm.types.router import SPECIAL_MODEL_INFO_PARAMS@@ -60,6 +64,7 @@ from litellm.types.utils import (ModelResponse,ModelResponseStream,RawRequestTypedDict,+ StandardBuiltInToolsParams,StandardCallbackDynamicParams,StandardLoggingAdditionalHeaders,StandardLoggingHiddenParams,@@ -264,7 +269,9 @@ class Logging(LiteLLMLoggingBaseClass):self.standard_callback_dynamic_params: StandardCallbackDynamicParams = (self.initialize_standard_callback_dynamic_params(kwargs))-+ self.standard_built_in_tools_params: StandardBuiltInToolsParams = (+ self.initialize_standard_built_in_tools_params(kwargs)+ )## TIME TO FIRST TOKEN LOGGING ##self.completion_start_time: Optional[datetime.datetime] = Noneself._llm_caching_handler: Optional[LLMCachingHandler] = None@@ -369,6 +376,20 @@ class Logging(LiteLLMLoggingBaseClass):"""return _initialize_standard_callback_dynamic_params(kwargs)+ def initialize_standard_built_in_tools_params(+ self, kwargs: Optional[Dict] = None+ ) -> StandardBuiltInToolsParams:+ """+ Initialize the standard built-in tools params from the kwargs++ checks if web_search_options in kwargs or tools and sets the corresponding attribute in StandardBuiltInToolsParams+ """+ return StandardBuiltInToolsParams(+ web_search_options=StandardBuiltInToolCostTracking._get_web_search_options(+ kwargs or {}+ )+ )+def update_environment_variables(self,litellm_params: Dict,@@ -903,6 +924,7 @@ class Logging(LiteLLMLoggingBaseClass):"optional_params": self.optional_params,"custom_pricing": custom_pricing,"prompt": prompt,+ "standard_built_in_tools_params": self.standard_built_in_tools_params,}except Exception as e: # error creating kwargs for cost calculationdebug_info = StandardLoggingModelCostFailureDebugInformation(@@ -1102,6 +1124,7 @@ class Logging(LiteLLMLoggingBaseClass):prompt="",completion=getattr(result, "content", ""),total_time=float_diff,+ standard_built_in_tools_params=self.standard_built_in_tools_params,)return start_time, end_time, result