We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 19d846a commit eed2f8cCopy full SHA for eed2f8c
dspy/adapters/types/tool.py
@@ -206,17 +206,23 @@ def from_langchain(cls, tool: "BaseTool") -> "Tool":
206
A Tool object.
207
208
Example:
209
+
210
```python
- from langchain.tools import tool
211
+ import asyncio
212
import dspy
213
+ from langchain.tools import tool as lc_tool
214
- @tool
215
+ @lc_tool
216
def add(x: int, y: int):
217
"Add two numbers together."
218
return x + y
219
- tool = dspy.Tool.from_langchain(add)
- print(await tool.acall(x=1, y=2))
220
+ dspy_tool = dspy.Tool.from_langchain(add)
221
222
+ async def run_tool():
223
+ return await dspy_tool.acall(x=1, y=2)
224
225
+ print(asyncio.run(run_tool()))
226
# 3
227
```
228
"""
0 commit comments