mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
fix(azure): rebuild content dicts instead of mutating, drop test docstrings
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
d993014dc6
commit
81524d212f
3 changed files with 10 additions and 5 deletions
|
|
@ -30,8 +30,10 @@ from litellm.types.llms.openai import (
|
|||
ChatCompletionAssistantMessage,
|
||||
ChatCompletionAssistantToolCall,
|
||||
ChatCompletionFileObject,
|
||||
ChatCompletionFileObjectFile,
|
||||
ChatCompletionFunctionMessage,
|
||||
ChatCompletionImageObject,
|
||||
ChatCompletionImageUrlObject,
|
||||
ChatCompletionTextObject,
|
||||
ChatCompletionToolCallFunctionChunk,
|
||||
ChatCompletionToolMessage,
|
||||
|
|
@ -1068,11 +1070,17 @@ def _azure_image_url_helper(content: ChatCompletionImageObject):
|
|||
if isinstance(content["image_url"], str):
|
||||
content["image_url"] = {"url": content["image_url"]}
|
||||
else:
|
||||
content["image_url"].pop("format", None)
|
||||
content["image_url"] = cast(
|
||||
ChatCompletionImageUrlObject,
|
||||
{k: v for k, v in content["image_url"].items() if k != "format"},
|
||||
)
|
||||
|
||||
|
||||
def _azure_file_helper(content: ChatCompletionFileObject) -> None:
|
||||
content.get("file", {}).pop("format", None)
|
||||
content["file"] = cast(
|
||||
ChatCompletionFileObjectFile,
|
||||
{k: v for k, v in content.get("file", {}).items() if k != "format"},
|
||||
)
|
||||
|
||||
|
||||
def convert_to_azure_openai_messages(
|
||||
|
|
|
|||
|
|
@ -298,8 +298,6 @@ def test_convert_to_azure_openai_messages():
|
|||
|
||||
|
||||
def test_convert_to_azure_openai_messages_strips_litellm_format_from_file_and_image():
|
||||
"""Managed file ids write file.format = MIME type, which Azure rejects"""
|
||||
|
||||
from litellm.litellm_core_utils.prompt_templates.factory import (
|
||||
convert_to_azure_openai_messages,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -310,7 +310,6 @@ class TestAzureToolSchemaCombinatorFlattening:
|
|||
|
||||
|
||||
def test_transform_request_strips_litellm_format_from_managed_file_id():
|
||||
"""update_messages_with_model_file_ids writes file.format = MIME type, which Azure rejects"""
|
||||
import base64
|
||||
|
||||
from litellm.litellm_core_utils.prompt_templates.common_utils import (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue