Tools
Tools Extend what agents can do! Create tools Basic tool definition The easiest way to create a tool is to use the @tool decorator In this way the docstring will become the description of the tool 1 2 3 4 5 6 7 8 9 10 11 from langchain.tools import tool @tool def search_database(query: str, limit: int = 10) -> str: """Search the customer database for records matching the query. Args: query: Search terms to look for limit: Maximum number of results to return """ return f"Found {limit} results for '{query}'" docstring:’’' ada ’’' 的部分 docstring应该内容丰富且简明扼要 参数的type hints是必须的,因为他们定义了工具的输入参数 ...
FrameworksLangChain