mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-07-25 21:14:06 +00:00
fix(agent): Fix long-term memory error
This commit is contained in:
parent
3d7d52250f
commit
a059ef1412
@ -69,7 +69,7 @@ class HybridMemory(Memory, Generic[T]):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def from_chroma(
|
def from_chroma(
|
||||||
cls,
|
cls,
|
||||||
vstore_name: Optional[str] = "_chroma_agent_memory_",
|
vstore_name: Optional[str] = "agent_memory_long_term",
|
||||||
vstore_path: Optional[str] = None,
|
vstore_path: Optional[str] = None,
|
||||||
embeddings: Optional[Embeddings] = None,
|
embeddings: Optional[Embeddings] = None,
|
||||||
executor: Optional[Executor] = None,
|
executor: Optional[Executor] = None,
|
||||||
|
@ -102,6 +102,7 @@ class ToolPack(ResourcePack):
|
|||||||
args: Optional[Dict[str, Any]] = None,
|
args: Optional[Dict[str, Any]] = None,
|
||||||
function: Optional[Callable] = None,
|
function: Optional[Callable] = None,
|
||||||
parse_execute_args_func: Optional[PARSE_EXECUTE_ARGS_FUNCTION] = None,
|
parse_execute_args_func: Optional[PARSE_EXECUTE_ARGS_FUNCTION] = None,
|
||||||
|
overwrite: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add a command to the commands.
|
"""Add a command to the commands.
|
||||||
|
|
||||||
@ -118,6 +119,8 @@ class ToolPack(ResourcePack):
|
|||||||
the command is executed. Defaults to None.
|
the command is executed. Defaults to None.
|
||||||
parse_execute_args (callable, optional): A callable function to parse the
|
parse_execute_args (callable, optional): A callable function to parse the
|
||||||
execute arguments. Defaults to None.
|
execute arguments. Defaults to None.
|
||||||
|
overwrite (bool, optional): Whether to overwrite the command if it already
|
||||||
|
exists. Defaults to False.
|
||||||
"""
|
"""
|
||||||
if args is not None:
|
if args is not None:
|
||||||
tool_args = {}
|
tool_args = {}
|
||||||
@ -151,7 +154,7 @@ class ToolPack(ResourcePack):
|
|||||||
description=command_label,
|
description=command_label,
|
||||||
parse_execute_args_func=parse_execute_args_func,
|
parse_execute_args_func=parse_execute_args_func,
|
||||||
)
|
)
|
||||||
self.append(ft)
|
self.append(ft, overwrite=overwrite)
|
||||||
|
|
||||||
def _get_execution_tool(
|
def _get_execution_tool(
|
||||||
self,
|
self,
|
||||||
@ -347,6 +350,7 @@ class MCPToolPack(ToolPack):
|
|||||||
ssl_verify: Optional[Dict[str, Union[ssl.SSLContext, str, bool]]] = None,
|
ssl_verify: Optional[Dict[str, Union[ssl.SSLContext, str, bool]]] = None,
|
||||||
default_ssl_verify: Union[ssl.SSLContext, str, bool] = True,
|
default_ssl_verify: Union[ssl.SSLContext, str, bool] = True,
|
||||||
default_ssl_cafile: Optional[str] = None,
|
default_ssl_cafile: Optional[str] = None,
|
||||||
|
overwrite_same_tool: bool = True,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Create an Auto-GPT plugin tool pack."""
|
"""Create an Auto-GPT plugin tool pack."""
|
||||||
@ -363,6 +367,7 @@ class MCPToolPack(ToolPack):
|
|||||||
self._default_ssl_verify = default_ssl_verify
|
self._default_ssl_verify = default_ssl_verify
|
||||||
self._ssl_verify_map = ssl_verify or {}
|
self._ssl_verify_map = ssl_verify or {}
|
||||||
self.server_ssl_verify_map = {}
|
self.server_ssl_verify_map = {}
|
||||||
|
self._overwrite_same_tool = overwrite_same_tool
|
||||||
|
|
||||||
def switch_mcp_input_schema(self, input_schema: dict):
|
def switch_mcp_input_schema(self, input_schema: dict):
|
||||||
args = {}
|
args = {}
|
||||||
@ -450,5 +455,6 @@ class MCPToolPack(ToolPack):
|
|||||||
args,
|
args,
|
||||||
call_mcp_tool,
|
call_mcp_tool,
|
||||||
parse_execute_args_func=json_parse_execute_args_func,
|
parse_execute_args_func=json_parse_execute_args_func,
|
||||||
|
overwrite=self._overwrite_same_tool,
|
||||||
)
|
)
|
||||||
self._loaded = True
|
self._loaded = True
|
||||||
|
@ -142,7 +142,7 @@ class MultiAgents(BaseComponent, ABC):
|
|||||||
).create()
|
).create()
|
||||||
|
|
||||||
storage_manager = StorageManager.get_instance(self.system_app)
|
storage_manager = StorageManager.get_instance(self.system_app)
|
||||||
index_name = "_agent_memory_"
|
index_name = "agent_memory_long_term"
|
||||||
vector_store = storage_manager.create_vector_store(index_name=index_name)
|
vector_store = storage_manager.create_vector_store(index_name=index_name)
|
||||||
if not vector_store.vector_name_exists():
|
if not vector_store.vector_name_exists():
|
||||||
vector_store.create_collection(collection_name=index_name)
|
vector_store.create_collection(collection_name=index_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user