fix: more server patches for dev portal (#1475)
This commit is contained in:
@@ -1042,8 +1042,8 @@ class Agent(object):
|
||||
user_id=self.agent_state.user_id,
|
||||
tools=self.agent_state.tools,
|
||||
system=self.system,
|
||||
persona=self.agent_state.persona, # TODO: remove
|
||||
human=self.agent_state.human, # TODO: remove
|
||||
persona=self.agent_state.persona, # TODO: remove (stores persona_name)
|
||||
human=self.agent_state.human, # TODO: remove (stores human_name)
|
||||
## "model_state"
|
||||
llm_config=self.agent_state.llm_config,
|
||||
embedding_config=self.agent_state.embedding_config,
|
||||
|
||||
@@ -47,10 +47,14 @@ def load_module_tools(module_name="base"):
|
||||
for name, schema in functions_to_schema.items():
|
||||
# print([str(inspect.getsource(line)) for line in schema["imports"]])
|
||||
source_code = inspect.getsource(schema["python_function"])
|
||||
tags = [module_name]
|
||||
if module_name == "base":
|
||||
tags.append("memgpt-base")
|
||||
|
||||
tools.append(
|
||||
ToolModel(
|
||||
name=name,
|
||||
tags=["base"],
|
||||
tags=tags,
|
||||
source_type="python",
|
||||
module=schema["module"],
|
||||
source_code=source_code,
|
||||
|
||||
@@ -73,14 +73,14 @@ def setup_agents_index_router(server: SyncServer, interface: QueuingInterface, p
|
||||
tool_names = request.config["function_names"]
|
||||
|
||||
# TODO: remove this -- should be added based on create agent fields
|
||||
print("TOOLS", tool_names, len(tool_names))
|
||||
if isinstance(tool_names, str): # TODO: fix this on clinet side?
|
||||
tool_names = tool_names.split(",")
|
||||
if tool_names is None or tool_names == "":
|
||||
tool_names = []
|
||||
for name in BASE_TOOLS: # TODO: remove this
|
||||
if name not in tool_names:
|
||||
tool_names.append(name)
|
||||
|
||||
print("PRESET", preset)
|
||||
assert isinstance(tool_names, list), "Tool names must be a list of strings."
|
||||
|
||||
try:
|
||||
agent_state = server.create_agent(
|
||||
|
||||
@@ -704,7 +704,6 @@ class SyncServer(LockingServer):
|
||||
else:
|
||||
preset_obj.system = system
|
||||
preset_override = True
|
||||
print("system", preset_obj.system, system)
|
||||
|
||||
# Overwrite fields in the preset if they were specified
|
||||
if human is not None and human != preset_obj.human:
|
||||
@@ -741,7 +740,11 @@ class SyncServer(LockingServer):
|
||||
embedding_config = embedding_config if embedding_config else self.server_embedding_config
|
||||
|
||||
# get tools
|
||||
tool_objs = [self.ms.get_tool(name) for name in tools]
|
||||
tool_objs = []
|
||||
for tool_name in tools:
|
||||
tool_obj = self.ms.get_tool(tool_name)
|
||||
assert tool_obj is not None, f"Tool {tool_name} does not exist"
|
||||
tool_objs.append(tool_obj)
|
||||
|
||||
# If the user overrode any parts of the preset, we need to create a new preset to refer back to
|
||||
if preset_override:
|
||||
|
||||
Reference in New Issue
Block a user