Update Create-Custom-Tools.md (#311)

Added the langchain "Tool" functionality by creating a python function and then adding the functionality of that function to the tool by 'func' variable in the 'Tool' function.
This commit is contained in:
Selim Erhan
2024-03-11 15:44:04 -04:00
committed by GitHub
parent 9d3da98251
commit e67009ee2e

View File

@@ -66,3 +66,26 @@ agent = Agent(
tools=[integtation_tool]
)
```
### Using the `Tool` function from langchain
For another simple approach, create a function in python directly with the required attributes and a functional logic.
```python
def combine(a, b):
return a + b
```
Then you can add that function into the your tool by using 'func' variable in the Tool function.
```python
from langchain.agents import Tool
math_tool = Tool(
name="Math tool",
func=math_tool,
description="Useful for adding two numbers together, in other words combining them."
)
```