Spaces:
Build error
Build error
adapt to pydantic v2
Browse files
agentverse/agents/simulation_agent/tool.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
import logging
|
| 2 |
from string import Template
|
| 3 |
-
from typing import List, NamedTuple, Optional, Union
|
| 4 |
|
| 5 |
-
from langchain.tools import BaseTool
|
| 6 |
from pydantic import Field
|
| 7 |
|
| 8 |
|
|
@@ -28,7 +28,7 @@ class ToolNotExistError(BaseException):
|
|
| 28 |
|
| 29 |
@agent_registry.register("tool")
|
| 30 |
class ToolAgent(BaseAgent):
|
| 31 |
-
tools: List[
|
| 32 |
tool_memory: BaseMemory = Field(default_factory=ChatHistoryMemory)
|
| 33 |
verbose: bool = Field(default=False)
|
| 34 |
|
|
|
|
| 1 |
import logging
|
| 2 |
from string import Template
|
| 3 |
+
from typing import List, NamedTuple, Optional, Union, Any
|
| 4 |
|
| 5 |
+
# from langchain.tools import BaseTool
|
| 6 |
from pydantic import Field
|
| 7 |
|
| 8 |
|
|
|
|
| 28 |
|
| 29 |
@agent_registry.register("tool")
|
| 30 |
class ToolAgent(BaseAgent):
|
| 31 |
+
tools: List[Any] = Field(default=[])
|
| 32 |
tool_memory: BaseMemory = Field(default_factory=ChatHistoryMemory)
|
| 33 |
verbose: bool = Field(default=False)
|
| 34 |
|
agentverse/environments/simulation_env/rules/describer/prisoner.py
CHANGED
|
@@ -11,7 +11,7 @@ if TYPE_CHECKING:
|
|
| 11 |
|
| 12 |
@DescriberRegistry.register("prisoner")
|
| 13 |
class PrisonerDescriber(BaseDescriber):
|
| 14 |
-
switch_func = {
|
| 15 |
"Both Suspects": "Suspect2",
|
| 16 |
"Suspect1": "Suspect2",
|
| 17 |
"Suspect2": "Suspect1",
|
|
|
|
| 11 |
|
| 12 |
@DescriberRegistry.register("prisoner")
|
| 13 |
class PrisonerDescriber(BaseDescriber):
|
| 14 |
+
switch_func: dict = {
|
| 15 |
"Both Suspects": "Suspect2",
|
| 16 |
"Suspect1": "Suspect2",
|
| 17 |
"Suspect2": "Suspect1",
|
requirements.txt
CHANGED
|
@@ -8,7 +8,7 @@ opencv-python==4.8.0.76
|
|
| 8 |
gradio==3.50.2
|
| 9 |
httpx[socks]
|
| 10 |
astunparse
|
| 11 |
-
langchain==0.0.157
|
| 12 |
scikit-learn
|
| 13 |
pydantic==1.10.7
|
| 14 |
typing-extensions==4.5.0
|
|
@@ -17,3 +17,4 @@ colorlog
|
|
| 17 |
rapidfuzz
|
| 18 |
spacy
|
| 19 |
colorama==0.4.6
|
|
|
|
|
|
| 8 |
gradio==3.50.2
|
| 9 |
httpx[socks]
|
| 10 |
astunparse
|
| 11 |
+
# langchain==0.0.157
|
| 12 |
scikit-learn
|
| 13 |
pydantic==1.10.7
|
| 14 |
typing-extensions==4.5.0
|
|
|
|
| 17 |
rapidfuzz
|
| 18 |
spacy
|
| 19 |
colorama==0.4.6
|
| 20 |
+
tenacity
|