mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 13:54:48 +00:00
infra: xfail pydantic v2 arg to py function (#25686)
Issue to track: #25687
This commit is contained in:
parent
ee98da4f4e
commit
b35ee09b3f
@ -296,6 +296,21 @@ def test_convert_to_openai_function(
|
||||
assert actual == runnable_expected
|
||||
|
||||
|
||||
@pytest.mark.xfail(reason="Direct pydantic v2 models not yet supported")
|
||||
def test_convert_to_openai_function_nested_v2() -> None:
|
||||
class NestedV2(BaseModelV2Maybe):
|
||||
nested_v2_arg1: int = FieldV2Maybe(..., description="foo")
|
||||
nested_v2_arg2: Literal["bar", "baz"] = FieldV2Maybe(
|
||||
..., description="one of 'bar', 'baz'"
|
||||
)
|
||||
|
||||
def my_function(arg1: NestedV2) -> None:
|
||||
"""dummy function"""
|
||||
pass
|
||||
|
||||
convert_to_openai_function(my_function)
|
||||
|
||||
|
||||
def test_convert_to_openai_function_nested() -> None:
|
||||
class Nested(BaseModel):
|
||||
nested_arg1: int = Field(..., description="foo")
|
||||
@ -303,13 +318,7 @@ def test_convert_to_openai_function_nested() -> None:
|
||||
..., description="one of 'bar', 'baz'"
|
||||
)
|
||||
|
||||
class NestedV2(BaseModelV2Maybe):
|
||||
nested_v2_arg1: int = FieldV2Maybe(..., description="foo")
|
||||
nested_v2_arg2: Literal["bar", "baz"] = FieldV2Maybe(
|
||||
..., description="one of 'bar', 'baz'"
|
||||
)
|
||||
|
||||
def my_function(arg1: Nested, arg2: NestedV2) -> None:
|
||||
def my_function(arg1: Nested) -> None:
|
||||
"""dummy function"""
|
||||
pass
|
||||
|
||||
@ -331,20 +340,10 @@ def test_convert_to_openai_function_nested() -> None:
|
||||
},
|
||||
"required": ["nested_arg1", "nested_arg2"],
|
||||
},
|
||||
"arg2": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"nested_v2_arg1": {"type": "integer", "description": "foo"},
|
||||
"nested_v2_arg2": {
|
||||
"type": "string",
|
||||
"enum": ["bar", "baz"],
|
||||
"description": "one of 'bar', 'baz'",
|
||||
},
|
||||
},
|
||||
"required": ["nested_v2_arg1", "nested_v2_arg2"],
|
||||
},
|
||||
},
|
||||
"required": ["arg1", "arg2"],
|
||||
"required": [
|
||||
"arg1",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user