MCPcopy Create free account
hub / github.com/BerriAI/litellm / ProxyBaseLLMRequestProcessing

Class ProxyBaseLLMRequestProcessing

litellm/proxy/common_request_processing.py:2915–6080  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2913
2914
2915class ProxyBaseLLMRequestProcessing:
2916 def __init__(self, data: dict, served_model: str | None = None):
2917 self.data = data
2918 self.served_model = served_model
2919 self.dashboard_fallback_model: str | None = None
2920 self._tags_before_guardrails: frozenset[str] | None = None
2921 self.route_type: str | None = None
2922
2923 @property
2924 def litellm_call_id(self) -> str | None:
2925 return request_litellm_call_id(self.data)
2926
2927 @staticmethod
2928 def _merge_passthrough_streaming_headers(
2929 response_headers: httpx.Headers | Mapping[str, str] | None,
2930 custom_headers: Mapping[str, str],
2931 ) -> dict:
2932 """
2933 Merge upstream passthrough headers with proxy/custom headers.
2934
2935 Proxy/custom headers win on key collisions.
2936 """
2937 excluded_headers: Final = {
2938 "transfer-encoding",
2939 "content-encoding",
2940 "set-cookie",
2941 "connection",
2942 "keep-alive",
2943 "proxy-authenticate",
2944 "proxy-authorization",
2945 "te",
2946 "trailer",
2947 "upgrade",
2948 }
2949
2950 merged_headers: Final = {
2951 key: value for key, value in dict(response_headers or {}).items() if key.lower() not in excluded_headers
2952 }
2953 merged_headers.update(custom_headers)
2954 return merged_headers
2955
2956 @staticmethod
2957 def get_custom_headers(
2958 *,
2959 user_api_key_dict: UserAPIKeyAuth,
2960 call_id: str | None = None,
2961 model_id: object = None,
2962 cache_key: str | None = None,
2963 api_base: str | None = None,
2964 version: str | None = None,
2965 model_region: str | None = None,
2966 response_cost: float | str | None = None,
2967 hidden_params: Mapping[str, object] | None = None,
2968 fastest_response_batch_completion: bool | None = None,
2969 request_data: Mapping[str, object] | None = None,
2970 timeout: float | httpx.Timeout | None = None,
2971 litellm_logging_obj: LiteLLMLoggingObj | None = None,
2972 read_timing_from_logging_obj: bool = True,

Callers 15

chat_completionFunction · 0.90
completionFunction · 0.90
embeddingsFunction · 0.90
vector_store_searchFunction · 0.90
vector_store_createFunction · 0.90
vector_store_retrieveFunction · 0.90
vector_store_listFunction · 0.90
vector_store_updateFunction · 0.90
vector_store_deleteFunction · 0.90
_handle_virtual_mcp_toolFunction · 0.90

Calls

no outgoing calls