File tree Expand file tree Collapse file tree 4 files changed +2
-41
lines changed
tests/test_litellm/llms/github_copilot Expand file tree Collapse file tree 4 files changed +2
-41
lines changed Original file line number Diff line number Diff line change @@ -154,18 +154,6 @@ def should_fake_stream(
154154 """
155155 return False
156156
157- def requires_custom_headers_validation (self ) -> bool :
158- """
159- Returns True if the provider needs validate_environment to be called
160- to add custom headers before making the request.
161-
162- This is used for OpenAI-compatible providers that require special headers
163- (e.g., GitHub Copilot needs Copilot-Vision-Request for vision requests).
164-
165- Override this method in provider-specific config classes that need it.
166- """
167- return False
168-
169157 def _add_tools_to_optional_params (self , optional_params : dict , tools : List ) -> dict :
170158 """
171159 Helper util to add tools to optional_params.
Original file line number Diff line number Diff line change @@ -20,14 +20,6 @@ def __init__(
2020 super ().__init__ ()
2121 self .authenticator = Authenticator ()
2222
23- def requires_custom_headers_validation (self ) -> bool :
24- """
25- GitHub Copilot requires custom headers validation to add:
26- - X-Initiator header based on message roles
27- - Copilot-Vision-Request header for vision requests
28- """
29- return True
30-
3123 def _get_openai_compatible_provider_info (
3224 self ,
3325 model : str ,
Original file line number Diff line number Diff line change @@ -554,9 +554,9 @@ def completion( # type: ignore # noqa: PLR0915
554554 model = model , custom_llm_provider = custom_llm_provider , stream = stream
555555 )
556556
557- # Validate environment and update headers for providers that require it
557+ # Always call validate_environment to allow providers to add custom headers
558558 # (e.g., GitHub Copilot needs Copilot-Vision-Request for vision requests)
559- if provider_config and provider_config . requires_custom_headers_validation () :
559+ if provider_config :
560560 validated_headers = provider_config .validate_environment (
561561 headers = headers or {},
562562 model = model or "" ,
Original file line number Diff line number Diff line change @@ -509,22 +509,3 @@ def test_copilot_vision_request_header_with_type_image_url():
509509
510510 assert headers ["Copilot-Vision-Request" ] == "true"
511511 assert headers ["X-Initiator" ] == "user"
512-
513-
514- def test_requires_custom_headers_validation ():
515- """Test that GithubCopilotConfig.requires_custom_headers_validation() returns True"""
516- config = GithubCopilotConfig ()
517-
518- # GitHub Copilot should require custom headers validation
519- assert config .requires_custom_headers_validation () is True
520-
521-
522- def test_base_config_requires_custom_headers_validation ():
523- """Test that BaseConfig.requires_custom_headers_validation() returns False by default"""
524- from litellm .llms .openai .chat .gpt_transformation import OpenAIGPTConfig
525-
526- # Use a concrete implementation that doesn't override requires_custom_headers_validation
527- config = OpenAIGPTConfig ()
528-
529- # Default implementation should return False
530- assert config .requires_custom_headers_validation () is False
You can’t perform that action at this time.
0 commit comments