mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
Merge c50b027c22 into 9dbfb060bd
This commit is contained in:
commit
e80c1cfe9e
2 changed files with 41 additions and 0 deletions
|
|
@ -240,6 +240,22 @@ class GithubCopilotResponsesAPIConfig(OpenAIResponsesAPIConfig):
|
|||
message=str(e),
|
||||
)
|
||||
|
||||
def _validate_input_param(
|
||||
self, input: Union[str, ResponseInputParam]
|
||||
) -> Union[str, ResponseInputParam]:
|
||||
from litellm.litellm_core_utils.prompt_templates.common_utils import (
|
||||
filter_value_from_dict,
|
||||
)
|
||||
|
||||
validated_input = super()._validate_input_param(input)
|
||||
if isinstance(validated_input, list):
|
||||
for item in validated_input:
|
||||
if isinstance(item, dict):
|
||||
filter_value_from_dict(
|
||||
item, "internal_chat_message_metadata_passthrough"
|
||||
)
|
||||
return validated_input
|
||||
|
||||
def get_complete_url(
|
||||
self,
|
||||
api_base: str | None,
|
||||
|
|
|
|||
|
|
@ -317,6 +317,31 @@ class TestGithubCopilotResponsesAPITransformation:
|
|||
for param in expected_params:
|
||||
assert param in supported, f"{param} should be in supported params"
|
||||
|
||||
def test_transform_request_strips_codex_internal_metadata(self):
|
||||
config = GithubCopilotResponsesAPIConfig()
|
||||
transformed = config.transform_responses_api_request(
|
||||
model="gpt-5.3-codex",
|
||||
input=[
|
||||
{
|
||||
"role": "user",
|
||||
"content": "hello",
|
||||
"internal_chat_message_metadata_passthrough": {"local": True},
|
||||
"nested": {
|
||||
"internal_chat_message_metadata_passthrough": "remove-me",
|
||||
"keep": "value",
|
||||
},
|
||||
}
|
||||
],
|
||||
response_api_optional_request_params={"max_output_tokens": 16},
|
||||
litellm_params={},
|
||||
headers={},
|
||||
)
|
||||
|
||||
input_item = transformed["input"][0]
|
||||
assert "internal_chat_message_metadata_passthrough" not in input_item
|
||||
assert "internal_chat_message_metadata_passthrough" not in input_item["nested"]
|
||||
assert input_item["nested"]["keep"] == "value"
|
||||
|
||||
def test_handle_reasoning_item_preserves_encrypted_content(self):
|
||||
"""Test that _handle_reasoning_item preserves encrypted_content for GitHub Copilot.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue