replace assertion with valueerror (#3974)

Co-authored-by: Leonardo Pinheiro <lpinheiro@microsoft.com>
This commit is contained in:
Leonardo Pinheiro
2024-10-27 15:13:52 +10:00
committed by GitHub
parent 3fe0f9e97d
commit a626d7cf18

View File

@@ -46,5 +46,6 @@ class FunctionTool(BaseTool[BaseModel, BaseModel]):
cancellation_token.link_future(future)
result = await future
assert isinstance(result, self.return_type())
if not isinstance(result, self.return_type()):
raise ValueError(f"Expected return type {self.return_type()}, got {type(result)}")
return result