Skip to content

Commit

Permalink
fix(tools): address issue using args
Browse files Browse the repository at this point in the history
  • Loading branch information
thehapyone committed Dec 9, 2024
1 parent b4bfa07 commit d37a21a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion examples/agents/impact_assessment_crew.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ agents:
goal: Retrieve all data about the merge request for further processing from the GitLab API
backstory: An adept communicator with GitLab, retrieving and presenting all information efficiently.
tools:
- GitlabMergeRequestTool
- name: GitlabMergeRequestTool
args:
result_as_answer: true

- role: Content Analysis Agent
goal: Categorize the changed files (e.g., code, documentation, configuration, assets) and assign an impact score based on content type significance on a scale from 0 to 10.
Expand Down
10 changes: 5 additions & 5 deletions sage/validators/crew_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ToolsConfig(BaseModel):
"""ToolsConfig model"""

name: str
args: Optional[dict[str, Any]] = None
args: dict[str, Any] = {}


class TaskConfig(Task):
Expand All @@ -34,7 +34,7 @@ class AgentConfig(Agent):
allow_delegation: bool = Field(
default=False, description="Allow delegation of tasks to agents"
)
tools: Optional[List[ToolsConfig | BaseTool | str | dict]] = Field(
tools: Optional[List[ToolsConfig | BaseTool | str ]] = Field(
default_factory=list, description="Tools at agents' disposal"
)

Expand Down Expand Up @@ -76,9 +76,9 @@ def validate_tools(cls, tools: list):
if isinstance(tool_entry, str):
tool_name = tool_entry
tool_args = {}
elif isinstance(tool_entry, dict):
tool_name = tool_entry.get("name")
tool_args = tool_entry.get("args", {})
elif isinstance(tool_entry, ToolsConfig):
tool_name = tool_entry.name
tool_args = tool_entry.args
else:
raise ValueError(f"Invalid tool format: {tool_entry}")

Expand Down

0 comments on commit d37a21a

Please sign in to comment.