Skip to content

Commit

Permalink
Merge branch 'main' into dev/integrate-observability
Browse files Browse the repository at this point in the history
  • Loading branch information
bonk1t authored Dec 19, 2024
2 parents baced53 + 1e28824 commit ae44002
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
16 changes: 12 additions & 4 deletions agency_swarm/tools/BaseTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,20 @@
from agency_swarm.util.shared_state import SharedState


class classproperty:
def __init__(self, fget):
self.fget = fget

def __get__(self, instance, owner):
return self.fget(owner)


class BaseTool(BaseModel, ABC):
_shared_state: ClassVar[SharedState] = None
_caller_agent: Any = None
_event_handler: Any = None
_tool_call: ToolCall = None
openai_schema: ClassVar[dict[str, Any]]

def __init__(self, **kwargs):
if not self.__class__._shared_state:
Expand All @@ -38,14 +47,13 @@ class ToolConfig:
output_as_result: bool = False
async_mode: Union[Literal["threading"], None] = None

@classmethod
@property
def openai_schema(cls):
@classproperty
def openai_schema(cls) -> dict[str, Any]:
"""
Return the schema in the format of OpenAI's schema as jsonschema
Note:
Its important to add a docstring to describe how to best use this class, it will be included in the description attribute and be part of the prompt.
It's important to add a docstring to describe how to best use this class; it will be included in the description attribute and be part of the prompt.
Returns:
model_json_schema (dict): A dictionary in the format of OpenAI's schema as jsonschema
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
entry_points={
"console_scripts": ["agency-swarm=agency_swarm.cli:main"],
},
python_requires=">=3.7",
python_requires=">=3.10",
)
3 changes: 2 additions & 1 deletion tests/demos/demo_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ def run(self, **kwargs):
agency = Agency(
[
ceo,
[ceo, test_agent, test_agent2],
[ceo, test_agent],
[test_agent, test_agent2],
],
shared_instructions="",
settings_path="./test_settings.json",
Expand Down

0 comments on commit ae44002

Please sign in to comment.