Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions evoagentx/actions/action.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import json
from pydantic import model_validator
from pydantic_core import PydanticUndefined
from typing import Optional, Type, Tuple, Union, List, Any
from typing import ClassVar, Optional, Type, Tuple, Union, List, Any

from ..core.module import BaseModule
from ..core.registry import MODULE_REGISTRY
from ..core.parser import Parser
from ..core.message import Message
from ..models.base_model import BaseLLM, LLMOutputParser
from ..tools.tool import Toolkit
from ..tools.tool import Tool, Toolkit
from ..prompts.context_extraction import CONTEXT_EXTRACTION
from ..prompts.template import PromptTemplate

Expand Down Expand Up @@ -53,15 +53,15 @@ class ActionOutput(LLMOutputParser):
to convert the output to structured data. It inherits from LLMOutputParser
to support parsing of LLM outputs into structured action results.
"""
fix_json_schema_error: ClassVar[bool] = True

def to_str(self) -> str:
"""Convert the output to a formatted JSON string.

Returns:
A pretty-printed JSON string representation of the structured data.
"""
return json.dumps(self.get_structured_data(), indent=4)

return json.dumps(self.get_structured_data(), indent=4, ensure_ascii=False)

class Action(BaseModule):
"""Base class for all actions in the EvoAgentX framework.
Expand All @@ -83,7 +83,7 @@ class Action(BaseModule):
description: str
prompt: Optional[str] = None
prompt_template: Optional[PromptTemplate] = None
tools: Optional[List[Toolkit]] = None # specify the possible tool for the action
tools: Optional[List[Union[Tool, Toolkit]]] = None # specify the possible tool for the action
inputs_format: Optional[Type[ActionInput]] = None # specify the input format of the action
outputs_format: Optional[Type[Parser]] = None # specify the possible structured output format

Expand Down Expand Up @@ -211,4 +211,4 @@ def execute(self, llm: Optional[BaseLLM] = None, action: Action = None, context:
)
action_inputs_data = action_inputs.get_structured_data()

return action_inputs_data
return action_inputs_data
2 changes: 1 addition & 1 deletion evoagentx/actions/agent_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def execute(self, llm: Optional[BaseLLM] = None, inputs: Optional[dict] = None,
}
for tool in self.tools
]
prompt_params_values["tools"] = AGENT_GENERATION_TOOLS_PROMPT.format(tools_description=tool_description)
prompt_params_values["tools"] = AGENT_GENERATION_TOOLS_PROMPT.format(tool_descriptions=tool_description)
prompt = self.prompt.format(**prompt_params_values)
agents = llm.generate(
prompt = prompt,
Expand Down
Loading
Loading