Skip to content

Commit

Permalink
fixes for tools
Browse files Browse the repository at this point in the history
  • Loading branch information
BRama10 committed Dec 13, 2024
1 parent 15d6162 commit df79ca3
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 229 deletions.
2 changes: 1 addition & 1 deletion cerebrum/example/local_agent_load_demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from cerebrum.manager.agent import AgentManager

manager = AgentManager(base_url='https://my.aios.foundation')
manager = AgentManager(base_url='https://app.aios.foundation')

agent = manager.load_agent(local=True, path=f"/Users/rama2r/Cerebrum/example/agents/academic_agent")

Expand Down
2 changes: 1 addition & 1 deletion cerebrum/example/local_tool_load_demo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path
from cerebrum.manager.tool import ToolManager

manager = ToolManager(base_url='https://my.aios.foundation')
manager = ToolManager(base_url='https://app.aios.foundation')

tool = manager.load_tool(local=True, name='bing_search')

Expand Down
17 changes: 11 additions & 6 deletions cerebrum/interface/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .. import config

class AutoAgent:
AGENT_MANAGER = AgentManager('https://my.aios.foundation')
AGENT_MANAGER = AgentManager('https://app.aios.foundation')

@classmethod
def from_preloaded(cls, agent_name: str):
Expand All @@ -28,11 +28,15 @@ def from_preloaded(cls, tool_name: str):
n_slash = tool_name.count('/')
if n_slash == 1: # load from author/name
# if tool_name.split('/')[0] != 'core':
author, name, version = cls.TOOL_MANAGER.download_tool(
author=tool_name.split('/')[0],
name=tool_name.split('/')[1]
)
tool, _ = cls.TOOL_MANAGER.load_tool(author, name, version)
try:
author, name, version = cls.TOOL_MANAGER.download_tool(
author=tool_name.split('/')[0],
name=tool_name.split('/')[1]
)
tool, _ = cls.TOOL_MANAGER.load_tool(author, name, version)
except:
print('reload',tool_name.split('/')[1])
tool, _ = cls.TOOL_MANAGER.load_tool(local=True, name=tool_name.split('/')[1])
else:
tool, _ = cls.TOOL_MANAGER.load_tool(local=True, name=tool_name)

Expand All @@ -47,6 +51,7 @@ def from_batch_preload(cls, tool_names: list[str]):
}

for tool_name in tool_names:
print('tool name', tool_name)
tool = AutoTool.from_preloaded(tool_name)

response['tools'].append(tool.get_tool_call_format())
Expand Down
2 changes: 1 addition & 1 deletion cerebrum/manager/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,6 @@ def load_agent(self,


if __name__ == '__main__':
manager = AgentManager('https://my.aios.foundation/')
manager = AgentManager('https://app.aios.foundation/')
agent = manager.download_agent('example', 'academic_agent')
print(agent)
2 changes: 2 additions & 0 deletions cerebrum/manager/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def load_tool(self,
local: bool = False):
"""Load a tool dynamically and return its class and configuration."""

print('local', local)

if not local:
if version is None:
cached_versions = self._get_cached_versions(author, name)
Expand Down
35 changes: 33 additions & 2 deletions cerebrum/tool/core/registry.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,35 @@

PATHS = {

}
'currency_converter': {
'module_name': 'currency_converter.currency_converter',
'class_name': 'CurrencyConverter'
},
'file_downloader': {
'module_name': 'file.downloader',
'class_name': 'Downloader'
},
'google_search': {
'module_name': 'google.google_search',
'class_name': 'GoogleSearch'
},
'google_place': {
'module_name': 'google.google_places',
'class_name': 'GooglePlaces'
},
'imdb_top_movies': {
'module_name': 'imdb.top_movies',
'class_name': 'TopMovies'
},
'imdb_top_series': {
'module_name': 'imdb.top_series',
'class_name': 'TopSeries'
},
'wolfram_alpha': {
'module_name': 'wolfram.wolfram_alpha',
'class_name': 'WolframAlpha'
},
'wikipedia': {
'module_name': 'wikipedia.wikipedia',
'class_name': 'Wikipedia'
}
}
89 changes: 0 additions & 89 deletions interface/__init__.py

This file was deleted.

129 changes: 0 additions & 129 deletions manager/tool.py

This file was deleted.

0 comments on commit df79ca3

Please sign in to comment.