mirror of
https://github.com/hwchase17/langchain
synced 2024-10-31 15:20:26 +00:00
Fix tests
This commit is contained in:
parent
894cf7824b
commit
1df6da2583
@ -210,9 +210,9 @@ class ChildTool(BaseTool):
|
||||
You can use these to eg identify a specific instance of a tool with its use case.
|
||||
"""
|
||||
|
||||
handle_tool_error: Optional[Union[bool, str, Callable[[ToolException], str]]] = (
|
||||
False
|
||||
)
|
||||
handle_tool_error: Optional[
|
||||
Union[bool, str, Callable[[ToolException], str]]
|
||||
] = False
|
||||
"""Handle the content of the ToolException thrown."""
|
||||
|
||||
handle_validation_error: Optional[
|
||||
@ -838,7 +838,7 @@ class StructuredTool(BaseTool):
|
||||
# Description example:
|
||||
# search_api(query: str) - Searches the API for the query.
|
||||
sig = signature(source_function)
|
||||
description = f"{name}{sig} - {description_.strip()}"
|
||||
description_ = f"{name}{sig} - {description_.strip()}"
|
||||
_args_schema = args_schema
|
||||
if _args_schema is None and infer_schema:
|
||||
# schema name is appended within function
|
||||
|
@ -3,6 +3,7 @@
|
||||
import asyncio
|
||||
import json
|
||||
import sys
|
||||
import textwrap
|
||||
from datetime import datetime
|
||||
from enum import Enum
|
||||
from functools import partial
|
||||
@ -333,7 +334,7 @@ def test_structured_tool_from_function_docstring() -> None:
|
||||
|
||||
prefix = "foo(bar: int, baz: str) -> str - "
|
||||
assert foo.__doc__ is not None
|
||||
assert structured_tool.description == prefix + foo.__doc__.strip()
|
||||
assert structured_tool.description == prefix + textwrap.dedent(foo.__doc__.strip())
|
||||
|
||||
|
||||
def test_structured_tool_from_function_docstring_complex_args() -> None:
|
||||
@ -366,7 +367,7 @@ def test_structured_tool_from_function_docstring_complex_args() -> None:
|
||||
|
||||
prefix = "foo(bar: int, baz: List[str]) -> str - "
|
||||
assert foo.__doc__ is not None
|
||||
assert structured_tool.description == prefix + foo.__doc__.strip()
|
||||
assert structured_tool.description == prefix + textwrap.dedent(foo.__doc__).strip()
|
||||
|
||||
|
||||
def test_structured_tool_lambda_multi_args_schema() -> None:
|
||||
@ -701,7 +702,7 @@ def test_structured_tool_from_function() -> None:
|
||||
|
||||
prefix = "foo(bar: int, baz: str) -> str - "
|
||||
assert foo.__doc__ is not None
|
||||
assert structured_tool.description == prefix + foo.__doc__.strip()
|
||||
assert structured_tool.description == prefix + textwrap.dedent(foo.__doc__.strip())
|
||||
|
||||
|
||||
def test_validation_error_handling_bool() -> None:
|
||||
|
Loading…
Reference in New Issue
Block a user