This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
from langchain.tools import tool
|
||||
from typing import List
|
||||
|
||||
@tool
|
||||
def add_numbers(a: int, b: int) -> int:
|
||||
"""
|
||||
Add two numbers and return the sum.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
a : int
|
||||
The first number.
|
||||
b : int
|
||||
The second number.
|
||||
|
||||
Returns
|
||||
-------
|
||||
int
|
||||
The sum of a and b.
|
||||
"""
|
||||
return a + b
|
||||
|
||||
@tool
|
||||
def search_item(items: List[str], query: str) -> List[str]:
|
||||
"""
|
||||
Search for items containing the query string (case-insensitive).
|
||||
|
||||
Parameters
|
||||
----------
|
||||
items : List[str]
|
||||
The list of items to search.
|
||||
query : str
|
||||
The search query.
|
||||
|
||||
Returns
|
||||
-------
|
||||
List[str]
|
||||
A list of items that contain the query string.
|
||||
"""
|
||||
query_lower = query.lower()
|
||||
return [item for item in items if query_lower in item.lower()]
|
||||
Reference in New Issue
Block a user