litellm/litellm/litellm_core_utils
Alexsander Hamir 6635325629
fix: filter internal params in fallback code and fix test issues (#17941)
- Filter skip_mcp_handler and other internal params in fallback_utils.py before calling acompletion
  Fixes issue where internal parameters were being passed to provider APIs causing errors
- Remove deployment field from GCS bucket logger test metadata
  Fixes model name mismatch where deployment field was overriding the model in logging
- Update Bedrock Titan test to use non-deprecated model (titan-text-express-v1)
  Fixes test failure due to deprecated amazon.titan-text-lite-v1 model
2025-12-13 15:05:26 -08:00
..
audio_utils Use audio content for caching 2025-12-08 19:31:22 +05:30
llm_cost_calc Fix: Gemini image_tokens incorrectly treated as text tokens in cost calculation (#17554) 2025-12-05 15:55:38 -08:00
llm_response_utils fix: prompt injection not working (#16701) 2025-11-17 20:04:57 -08:00
prompt_templates Add support for computer use for gemini 2025-12-10 10:34:08 +05:30
specialty_caches [Bug]: Performance Fix Max langfuse clients reached: 20 is greater than 20 (#11285) 2025-05-30 22:34:39 -07:00
tokenizers
api_route_to_call_types.py Guardrails API - add streaming support (#17400) 2025-12-02 22:52:09 -08:00
app_crypto.py [Fix] SQS Logger - Add Base64 handling (#16028) 2025-10-28 16:41:32 -07:00
asyncify.py
cached_imports.py fix: reduced __inits__ overhead in 7% (#14689) 2025-09-18 17:18:05 -07:00
cli_token_utils.py [Feat] Proxy CLI: Create a python method to login using litellm proxy (#14782) 2025-09-22 21:28:38 -07:00
core_helpers.py [Fix] CI/CD - Fix Bedrock tool calling test failures with non-serializable objects and internal parameters (#17930) 2025-12-13 12:38:07 -08:00
coroutine_checker.py fix: iscoroutine removed from hot path +50 RPS (#14649) 2025-09-17 19:01:43 -07:00
credential_accessor.py
custom_logger_registry.py bump: version 0.1.23 → 0.1.24 2025-12-09 19:31:12 -08:00
dd_tracing.py [Feat]: Performance add DD profiler to monitor python profile of LiteLLM CPU% (#11375) 2025-06-03 12:03:08 -07:00
default_encoding.py
dot_notation_indexing.py fix: Improve type safety in dot_notation_indexing for nested field removal 2025-12-09 17:44:24 +05:30
duration_parser.py feat: add Asia/Bangkok timezone support for budget resets 2025-09-18 14:56:12 +07:00
exception_mapping_utils.py Fix: Add Gemini context window exception mapping (#17751) 2025-12-09 18:24:13 -08:00
fallback_utils.py fix: filter internal params in fallback code and fix test issues (#17941) 2025-12-13 15:05:26 -08:00
get_litellm_params.py [Feat] Agent Gateway - Add cost per query for agent invocations (#17774) 2025-12-10 10:43:52 -08:00
get_llm_provider_logic.py [Feat] New Provider - add langgraph (#17783) 2025-12-10 12:30:35 -08:00
get_model_cost_map.py
get_provider_specific_headers.py [Fix] Forward anthropic-beta headers to Bedrock, VertexAI (#15700) 2025-10-18 16:26:32 -07:00
get_supported_openai_params.py [New provider] Sap gen ai hub (#16053) 2025-12-08 12:31:06 -08:00
health_check_helpers.py Add Vertex and Gemini Videos API with Cost Tracking + UI support (#16323) 2025-11-08 16:03:51 -08:00
health_check_utils.py
initialize_dynamic_callback_params.py Litellm dev 07 03 2025 p2 (#12301) 2025-07-03 22:40:21 -07:00
json_validation_rule.py [Feat] Add Bridge from generateContent <> /chat/completions (#12081) 2025-06-27 11:08:55 -07:00
litellm_logging.py Prompt Management - new API for integrating providers (#17829) 2025-12-11 15:43:40 -08:00
llm_request_utils.py [Feat] Enterprise - Allow dynamically disabling callbacks in request headers (#11985) 2025-06-23 14:32:05 -07:00
logging_callback_manager.py Native Webhook Integration Sumologic (#17630) 2025-12-07 23:23:39 -08:00
logging_utils.py feat(llm_http_handler.py): add OTEL tracing for actual llm api call 2025-08-16 15:42:30 -07:00
logging_worker.py Fix: prevent memory blowout in LoggingWorker (#16559) 2025-11-22 13:58:29 -08:00
mock_functions.py Support returning virtual key in custom auth + Handle provider-specific optional params for embedding calls (#11346) 2025-06-03 07:24:13 -07:00
model_param_helper.py
model_response_utils.py fix: resolve memory leak caused by Pydantic 2.11+ deprecation warnings (#16110) 2025-11-01 13:16:32 -07:00
README.md Guardrails API - add streaming support (#17400) 2025-12-02 22:52:09 -08:00
realtime_streaming.py build: merge in https://github.com/BerriAI/litellm/pull/10909 2025-05-17 07:36:56 -07:00
redact_messages.py revert changes to redaction 2025-11-08 13:43:01 -08:00
response_header_helpers.py
rules.py fix: remove slow string operation (#14955) 2025-09-26 13:25:59 -07:00
safe_json_dumps.py add safe_dumps 2025-11-08 10:19:38 -08:00
safe_json_loads.py add support to parse metadata (#10832) 2025-05-14 12:03:49 -07:00
sensitive_data_masker.py [Fix] Exclude litellm_credential_name from Sensitive Data Masker (Updated) (#16958) 2025-11-21 19:09:48 -08:00
streaming_chunk_builder_utils.py include server_tool_use in streaming usage (#16826) 2025-11-25 14:50:17 -08:00
streaming_handler.py [New provider] Sap gen ai hub (#16053) 2025-12-08 12:31:06 -08:00
thread_pool_executor.py
token_counter.py fix: support Anthropic tool_use and tool_result in token counter (#16351) 2025-11-13 14:30:46 -08:00

Folder Contents

This folder contains general-purpose utilities that are used in multiple places in the codebase.

Core files:

  • streaming_handler.py: The core streaming logic + streaming related helper utils
  • core_helpers.py: code used in types/ - e.g. map_finish_reason.
  • exception_mapping_utils.py: utils for mapping exceptions to openai-compatible error types.
  • default_encoding.py: code for loading the default encoding (tiktoken)
  • get_llm_provider_logic.py: code for inferring the LLM provider from a given model name.
  • duration_parser.py: code for parsing durations - e.g. "1d", "1mo", "10s"
  • api_route_to_call_types.py: mapping of API routes to their corresponding CallTypes (e.g., /chat/completions -> [acompletion, completion])