mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-06 17:52:35 +00:00
feat: add field validator to flatten context in DelegateWorkToolSchema
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
|
||||
from crewai.tools.agent_tools.base_agent_tools import BaseAgentTool
|
||||
|
||||
@@ -12,6 +12,9 @@ class DelegateWorkToolSchema(BaseModel):
|
||||
..., description="The role/name of the coworker to delegate to"
|
||||
)
|
||||
|
||||
@field_validator("context")
|
||||
def flatten(cls, v):
|
||||
return " ".join(v) if isinstance(v, list) else v
|
||||
|
||||
class DelegateWorkTool(BaseAgentTool):
|
||||
"""Tool for delegating work to coworkers"""
|
||||
|
||||
Reference in New Issue
Block a user