mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 08:38:30 +00:00
improve tool text description and args (#1512)
* improve tool text descriptoin and args * fix lint * Drop print * add back in docstring
This commit is contained in:
committed by
GitHub
parent
f29f4abdd7
commit
26afee9bed
@@ -1,7 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
from inspect import signature
|
|
||||||
from typing import Any, List, Literal, Optional, Union
|
from typing import Any, List, Literal, Optional, Union
|
||||||
|
|
||||||
from pydantic import Field, InstanceOf, PrivateAttr, model_validator
|
from pydantic import Field, InstanceOf, PrivateAttr, model_validator
|
||||||
@@ -405,13 +404,13 @@ class Agent(BaseAgent):
|
|||||||
"""
|
"""
|
||||||
tool_strings = []
|
tool_strings = []
|
||||||
for tool in tools:
|
for tool in tools:
|
||||||
args_schema = str(tool.model_fields)
|
args_schema = {
|
||||||
if hasattr(tool, "func") and tool.func:
|
name: {
|
||||||
sig = signature(tool.func)
|
"description": field.description,
|
||||||
description = (
|
"type": field.annotation.__name__,
|
||||||
f"Tool Name: {tool.name}{sig}\nTool Description: {tool.description}"
|
}
|
||||||
)
|
for name, field in tool.args_schema.model_fields.items()
|
||||||
else:
|
}
|
||||||
description = (
|
description = (
|
||||||
f"Tool Name: {tool.name}\nTool Description: {tool.description}"
|
f"Tool Name: {tool.name}\nTool Description: {tool.description}"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user