types: allow single or multiple types tool property (#499)
Some checks failed
test / test (3.10) (push) Has been cancelled
test / test (3.11) (push) Has been cancelled
test / test (3.12) (push) Has been cancelled
test / test (3.13) (push) Has been cancelled
test / test (3.8) (push) Has been cancelled
test / test (3.9) (push) Has been cancelled
test / lint (push) Has been cancelled

This commit is contained in:
Parth Sareen 2025-04-08 15:05:54 -07:00 committed by GitHub
parent 1b3406887d
commit 8ac9f4da76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -313,7 +313,7 @@ class Tool(SubscriptableBaseModel):
class Property(SubscriptableBaseModel):
model_config = ConfigDict(arbitrary_types_allowed=True)
type: Optional[str] = None
type: Optional[Union[str, Sequence[str]]] = None
description: Optional[str] = None
enum: Optional[Sequence] = None

View File

@ -1139,7 +1139,7 @@ def test_copy_tools():
'description': 'Test function',
'parameters': {
'type': 'object',
'properties': {'x': {'type': 'string', 'description': 'A string'}},
'properties': {'x': {'type': 'string', 'description': 'A string', 'enum': ['a', 'b', 'c']}, 'y': {'type': ['integer', 'number'], 'description': 'An integer'}},
'required': ['x'],
},
},