Skip to content

Commit a0ef300

Browse files
committed
Improve gemini support
1 parent ad2b455 commit a0ef300

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/controlflow/tools/tools.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,17 @@ class Tool(ControlFlowModel):
5151
metadata: dict = {}
5252

5353
fn: Callable = Field(None, exclude=True)
54+
_lc_tool: Optional[langchain_core.tools.BaseTool] = None
5455

5556
def to_lc_tool(self) -> dict:
56-
payload = self.model_dump(include={"name", "description", "parameters"})
57-
return dict(type="function", function=payload)
57+
if self._lc_tool is None:
58+
self._lc_tool = langchain_core.tools.StructuredTool.from_function(
59+
self.fn,
60+
name=self.name,
61+
description=self.description,
62+
)
63+
64+
return self._lc_tool
5865

5966
@prefect_task(task_run_name="Tool call: {self.name}")
6067
def run(self, input: dict):

0 commit comments

Comments
 (0)