mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-15 23:31:29 +00:00
(sap) fix after bot review
This commit is contained in:
parent
19fe0cf0b4
commit
8eb81b5202
2 changed files with 9 additions and 2 deletions
|
|
@ -1,8 +1,9 @@
|
|||
from typing import Union, Literal, Optional
|
||||
from typing import Union, Literal, Optional, Any, Self
|
||||
from enum import Enum
|
||||
import warnings
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
from pydantic.config import ExtraValues
|
||||
|
||||
|
||||
def validate_different_content(v: Union[str, dict, list]) -> str:
|
||||
|
|
@ -67,6 +68,10 @@ class ChatCompletionTool(BaseModel):
|
|||
type_: Literal["function"] = Field(default="function", alias="type")
|
||||
function: FunctionTool
|
||||
|
||||
def model_dump(self, **kwargs) -> Self:
|
||||
kwargs["exclude_unset"] = False
|
||||
return super().model_dump(**kwargs)
|
||||
|
||||
|
||||
class MessageToolCall(BaseModel):
|
||||
id: str
|
||||
|
|
|
|||
|
|
@ -128,7 +128,9 @@ class TestToolTransformationIntegration:
|
|||
|
||||
validated_tool = validate_dict(openai_tool, ChatCompletionTool)
|
||||
|
||||
assert validated_tool["function"]["name"] == "web_search"
|
||||
# After validation, parameters should have type='object'
|
||||
assert validated_tool["function"]["parameters"]["type"] == "object"
|
||||
assert "properties" in validated_tool["function"]["parameters"]
|
||||
|
||||
|
||||
def test_should_transform_tool_with_existing_parameters(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue