Skip to content

Commit

Permalink
Update Create-Custom-Tools.md (#311)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
selimhanerhan authored Mar 11, 2024
1 parent 9d3da98 commit e67009e
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion docs/how-to/Create-Custom-Tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,27 @@ agent = Agent(
backstory='An expert analyst with a keen eye for market trends.',
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."
)
```

0 comments on commit e67009e

Please sign in to comment.