standard-tests[patch]: test that bind_tools can accept regular python function (#24135)

This commit is contained in:
Isaac Francisco 2024-07-11 10:42:17 -07:00 committed by GitHub
parent 2428984205
commit 7a62d3dbd6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,11 @@ def my_adder_tool(a: int, b: int) -> int:
return a + b return a + b
def my_adder(a: int, b: int) -> int:
"""Takes two integers, a and b, and returns their sum."""
return a + b
class ChatModelTests(ABC): class ChatModelTests(ABC):
@property @property
@abstractmethod @abstractmethod
@ -108,7 +113,7 @@ class ChatModelUnitTests(ChatModelTests):
return return
tool_model = model.bind_tools( tool_model = model.bind_tools(
[Person, Person.schema(), my_adder_tool], tool_choice="any" [Person, Person.schema(), my_adder_tool, my_adder], tool_choice="any"
) )
assert isinstance(tool_model, RunnableBinding) assert isinstance(tool_model, RunnableBinding)