Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: one time pass of `autoflake` + add `autoflake` to dev extras (#1097)
Charles Packer637cb9c2b464
diff --git a/examples/openai_client_assistants.py b/examples/openai_client_assistants.pyindex ca21451d6..20ab38479 100644--- a/examples/openai_client_assistants.py+++ b/examples/openai_client_assistants.py@@ -1,5 +1,4 @@from openai import OpenAI-import time"""This script provides an example of how you can use OpenAI's python client with a MemGPT server.@@ -33,7 +32,7 @@ def main():)# Store the run ID- run_id = run.id+ run.id# Retrieve all messages from the threadmessages = client.beta.threads.messages.list(thread_id=thread.id)diff --git a/memgpt/agent.py b/memgpt/agent.pyindex a189e559b..86295e922 100644--- a/memgpt/agent.py+++ b/memgpt/agent.py@@ -674,7 +674,7 @@ class Agent(object):# (if yes) Step 3: call the function# (if yes) Step 4: send the info on the function call and function response to LLMresponse_message = response.choices[0].message- response_message_copy = response_message.copy()+ response_message.copy()all_response_messages, heartbeat_request, function_failed = self._handle_ai_response(response_message)# Add the extra metadata to the assistant responsediff --git a/memgpt/agent_store/chroma.py b/memgpt/agent_store/chroma.pyindex 637f94218..bccf1acf9 100644--- a/memgpt/agent_store/chroma.py+++ b/memgpt/agent_store/chroma.py@@ -1,7 +1,5 @@import uuid-import json-import re-from typing import Optional, List, Iterator, Dict, Tuple, cast, Type+from typing import Optional, List, Iterator, Dict, Tuple, castimport chromadbfrom chromadb.api.types import Include, GetResultdiff --git a/memgpt/agent_store/db.py b/memgpt/agent_store/db.pyindex 7441a659f..98944336f 100644--- a/memgpt/agent_store/db.py+++ b/memgpt/agent_store/db.py@@ -11,9 +11,8 @@ from sqlalchemy_json import mutable_json_type, MutableJsonfrom sqlalchemy import TypeDecorator, CHARimport uuid-import refrom tqdm import tqdm-from typing import Optional, List, Iterator, Dict, Tuple+from typing import Optional, List, Iterator, Dictimport numpy as npfrom tqdm import tqdmimport pandas as pd@@ -26,8 +25,6 @@ from memgpt.data_types import Record, Message, Passage, ToolCall, RecordTypefrom memgpt.constants import MAX_EMBEDDING_DIMfrom memgpt.metadata import MetadataStore-from datetime import datetime-# Custom UUID typeclass CommonUUID(TypeDecorator):diff --git a/memgpt/agent_store/storage.py b/memgpt/agent_store/storage.pyindex a670cd935..89ee8eed9 100644--- a/memgpt/agent_store/storage.py+++ b/memgpt/agent_store/storage.py@@ -3,10 +3,7 @@We originally tried to use Llama Index VectorIndex, but their limited API was extremely problematic."""-from typing import Any, Optional, List, Iterator, Union, Tuple, Type-import re-import pickle-import os+from typing import Optional, List, Iterator, Union, Tuple, Typeimport uuidfrom abc import abstractmethoddiff --git a/memgpt/autogen/memgpt_agent.py b/memgpt/autogen/memgpt_agent.pyindex 51dac3351..91e3cd8a3 100644--- a/memgpt/autogen/memgpt_agent.py+++ b/memgpt/autogen/memgpt_agent.py@@ -265,7 +265,7 @@ def load_autogen_memgpt_agent(# Create the agent object directly from the loaded state (not via preset creation)try:memgpt_agent = MemGPTAgent(agent_state=agent_state, interface=interface)- except Exception as e:+ except Exception:print(f"Failed to create an agent object from agent state =\n{agent_state}")raise@@ -317,8 +317,8 @@ def create_autogen_memgpt_agent(embedding_config = config.default_embedding_config# Overwrite parts of the LLM and embedding configs that were passed into the config dicts- llm_config_was_modified = update_config_from_dict(llm_config, agent_config)- embedding_config_was_modified = update_config_from_dict(embedding_config, agent_config)+ update_config_from_dict(llm_config, agent_config)+ update_config_from_dict(embedding_config, agent_config)# Create the default user, or load the specified userms = MetadataStore(config)diff --git a/memgpt/benchmark/benchmark.py b/memgpt/benchmark/benchmark.pyindex 63c7200c0..593ad65fb 100644--- a/memgpt/benchmark/benchmark.py+++ b/memgpt/benchmark/benchmark.py@@ -3,7 +3,7 @@import uuidimport typerimport time-from typing import Annotated, Optional+from typing import Annotatedfrom memgpt import create_clientfrom memgpt.config import MemGPTConfigdiff --git a/memgpt/cli/cli.py b/memgpt/cli/cli.pyindex 68bce6c93..6fe7761d0 100644--- a/memgpt/cli/cli.py+++ b/memgpt/cli/cli.py@@ -2,8 +2,6 @@ import uuidimport jsonimport requestsimport sys-import shutil-import ioimport loggingfrom pathlib import Pathimport os@@ -722,7 +720,7 @@ def delete_agent(try:ms.delete_agent(agent_id=agent.id)typer.secho(f"🕊️ Successfully deleted agent '{agent_name}' (id={agent.id})", fg=typer.colors.GREEN)- except Exception as e:+ except Exception:typer.secho(f"Failed to delete agent '{agent_name}' (id={agent.id})", fg=typer.colors.RED)sys.exit(1)diff --git a/memgpt/cli/cli_config.py b/memgpt/cli/cli_config.pyindex 9a7e9a48c..912c9f125 100644--- a/memgpt/cli/cli_config.py+++ b/memgpt/cli/cli_config.py@@ -1,9 +1,7 @@import builtins-import jsonimport os-import shutilimport uuid-from typing import Annotated, Tuple, Optional+from typing import Annotated, Optionalfrom enum import Enumfrom typing import Annotated@@ -512,7 +510,7 @@ def configure_embedding_endpoint(config: MemGPTConfig, credentials: MemGPTCredenraise KeyboardInterrupttry:embedding_dim = int(embedding_dim)- except Exception as e:+ except Exception:raise ValueError(f"Failed to cast {embedding_dim} to integer.")else: # local modelsembedding_endpoint_type = "local"@@ -627,7 +625,7 @@ def configure():# check credentialscredentials = MemGPTCredentials.load()openai_key = get_openai_credentials()- azure_creds = get_azure_credentials()+ get_azure_credentials()MemGPTConfig.create_config_dir()diff --git a/memgpt/cli/cli_load.py b/memgpt/cli/cli_load.pyindex d74d7c8d2..105ec9822 100644--- a/memgpt/cli/cli_load.py+++ b/memgpt/cli/cli_load.py@@ -23,7 +23,6 @@ from memgpt.data_types import Source, Passage, Document, Userfrom memgpt.utils import get_utc_time, suppress_stdoutfrom memgpt.agent_store.storage import StorageConnector, TableType-from datetime import datetimeapp = typer.Typer()diff --git a/memgpt/client/client.py b/memgpt/client/client.pyindex 0a923aa8f..8380a6fe9 100644--- a/memgpt/client/client.py+++ b/memgpt/client/client.py@@ -1,4 +1,3 @@-import osimport datetimeimport requestsimport uuiddiff --git a/memgpt/credentials.py b/memgpt/credentials.pyindex 853ea38e7..3464752b0 100644--- a/memgpt/credentials.py+++ b/memgpt/credentials.py@@ -1,8 +1,5 @@from memgpt.log import logger-import inspect-import jsonimport os-import uuidfrom dataclasses import dataclassimport configparserimport typerdiff --git a/memgpt/data_sources/connectors.py b/memgpt/data_sources/connectors.pyindex c54a95b8a..ce55fc8ab 100644--- a/memgpt/data_sources/connectors.py+++ b/memgpt/data_sources/connectors.py@@ -4,7 +4,6 @@ from memgpt.agent_store.storage import StorageConnector, TableTypefrom memgpt.embeddings import embedding_modelfrom memgpt.data_types import Document, Passage-import uuidfrom typing import List, Iterator, Dict, Tuple, Optionalfrom llama_index.core import Document as LlamaIndexDocument@@ -102,7 +101,6 @@ class DirectoryConnector(DataConnector):reader = SimpleDirectoryReader(input_files=[str(f) for f in self.input_files])llama_index_docs = reader.load_data(show_progress=True)- docs = []for llama_index_doc in llama_index_docs:# TODO: add additional metadata?# doc = Document(text=llama_index_doc.text, metadata=llama_index_doc.metadata)diff --git a/memgpt/data_types.py b/memgpt/data_types.pyindex 7e05f76ef..12f58a040 100644--- a/memgpt/data_types.py+++ b/memgpt/data_types.py@@ -2,7 +2,6 @@import uuidfrom datetime import datetime-from abc import abstractmethodfrom typing import Optional, List, Dict, TypeVarimport numpy as npdiff --git a/memgpt/errors.py b/memgpt/errors.pyindex aa1f57fcb..6ac701814 100644--- a/memgpt/errors.py+++ b/memgpt/errors.py@@ -1,8 +1,6 @@class LLMError(Exception):"""Base class for all LLM-related errors."""- pass-class LLMJSONParsingError(LLMError):"""Exception raised for errors in the JSON parsing process."""diff --git a/memgpt/functions/function_sets/base.py b/memgpt/functions/function_sets/base.pyindex 55ab03dca..a5974f88c 100644--- a/memgpt/functions/function_sets/base.py+++ b/memgpt/functions/function_sets/base.py@@ -1,6 +1,5 @@from typing import Optionalimport datetime-import osimport jsonimport math@@ -62,7 +61,7 @@ def core_memory_append(self, name: str, content: str) -> Optional[str]:Returns:Optional[str]: None is always returned as this function does not produce a response."""- new_len = self.memory.edit_append(name, content)+ self.memory.edit_append(name, content)self.rebuild_memory()return None@@ -79,7 +78,7 @@ def core_memory_replace(self, name: str, old_content: str, new_content: str) ->Returns:Optional[str]: None is always returned as this function does not produce a response."""- new_len = self.memory.edit_replace(name, old_content, new_content)+ self.memory.edit_replace(name, old_content, new_content)self.rebuild_memory()return Nonediff --git a/memgpt/interface.py b/memgpt/interface.pyindex a75ea9274..cbaec27a2 100644--- a/memgpt/interface.py+++ b/memgpt/interface.py@@ -203,7 +203,6 @@ class CLIInterface(AgentInterface):except Exception as e:printd(str(e))printd(msg_dict)- passelif function_name in ["conversation_search", "conversation_search_date"]:print_function_message("🧠", f"searching memory with {function_name}")try:@@ -216,7 +215,6 @@ class CLIInterface(AgentInterface):except Exception as e:printd(str(e))printd(msg_dict)- passelse:printd(f"{CLI_WARNING_PREFIX}did not recognize function message")printd_function_message("", msg)diff --git a/memgpt/llm_api_tools.py b/memgpt/llm_api_tools.pyindex 3fa8d7ff1..d5a53aa82 100644--- a/memgpt/llm_api_tools.py+++ b/memgpt/llm_api_tools.py@@ -2,7 +2,7 @@ import randomimport timeimport requestsimport time-from typing import Callable, TypeVar, Union+from typing import Unionimport urllibfrom memgpt.credentials import MemGPTCredentialsdiff --git a/memgpt/local_llm/grammars/gbnf_grammar_generator.py b/memgpt/local_llm/grammars/gbnf_grammar_generator.pyindex 58b73f3f5..a1d2f937f 100644--- a/memgpt/local_llm/grammars/gbnf_grammar_generator.py+++ b/memgpt/local_llm/grammars/gbnf_grammar_generator.py@@ -8,7 +8,7 @@ from docstring_parser import parsefrom pydantic import BaseModel, create_model, Fieldfrom typing import Any, Type, List, get_args, get_origin, Tuple, Union, Optional, _GenericAliasfrom enum import Enum-from typing import get_type_hints, Callable+from typing import Callableimport rediff --git a/memgpt/local_llm/koboldcpp/api.py b/memgpt/local_llm/koboldcpp/api.pyindex 4b720d4d1..a6ac87e04 100644--- a/memgpt/local_llm/koboldcpp/api.py+++ b/memgpt/local_llm/koboldcpp/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/llamacpp/api.py b/memgpt/local_llm/llamacpp/api.pyindex 2e0bea6b5..438fe7d51 100644--- a/memgpt/local_llm/llamacpp/api.py+++ b/memgpt/local_llm/llamacpp/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py b/memgpt/local_llm/llm_chat_completion_wrappers/configurable_wrapper.pyindex 36543cddf..0c9be182e 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/configurable_wrapper.py@@ -1,5 +1,4 @@import json-from typing import Listimport yamldiff --git a/memgpt/local_llm/llm_chat_completion_wrappers/wrapper_base.py b/memgpt/local_llm/llm_chat_completion_wrappers/wrapper_base.pyindex 40b6ab705..a37f73a3b 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/wrapper_base.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/wrapper_base.py@@ -5,9 +5,7 @@ class LLMChatCompletionWrapper(ABC):@abstractmethoddef chat_completion_to_prompt(self, messages, functions, function_documentation=None):"""Go from ChatCompletion to a single prompt string"""- pass@abstractmethoddef output_to_chat_completion_response(self, raw_llm_output):"""Turn the LLM output string into a ChatCompletion response"""- passdiff --git a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.pyindex a003d50da..60cc6056e 100644--- a/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py+++ b/memgpt/local_llm/llm_chat_completion_wrappers/zephyr.py@@ -41,7 +41,6 @@ class ZephyrMistralWrapper(LLMChatCompletionWrapper):prompt = ""- IM_START_TOKEN = "<s>"IM_END_TOKEN = "</s>"# System instructions go first@@ -205,7 +204,6 @@ class ZephyrMistralInnerMonologueWrapper(ZephyrMistralWrapper):def chat_completion_to_prompt(self, messages, functions, function_documentation=None):prompt = ""- IM_START_TOKEN = "<s>"IM_END_TOKEN = "</s>"# System insturctions go firstdiff --git a/memgpt/local_llm/lmstudio/api.py b/memgpt/local_llm/lmstudio/api.pyindex 4aa3db13e..a82b827b4 100644--- a/memgpt/local_llm/lmstudio/api.py+++ b/memgpt/local_llm/lmstudio/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/ollama/api.py b/memgpt/local_llm/ollama/api.pyindex a73d4990d..b8471328e 100644--- a/memgpt/local_llm/ollama/api.py+++ b/memgpt/local_llm/ollama/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/vllm/api.py b/memgpt/local_llm/vllm/api.pyindex aa5fd6a6f..a22a1fb14 100644--- a/memgpt/local_llm/vllm/api.py+++ b/memgpt/local_llm/vllm/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/webui/api.py b/memgpt/local_llm/webui/api.pyindex 2b617462f..5751591d2 100644--- a/memgpt/local_llm/webui/api.py+++ b/memgpt/local_llm/webui/api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/local_llm/webui/legacy_api.py b/memgpt/local_llm/webui/legacy_api.pyindex 6f3d8b2e0..6fc99c38d 100644--- a/memgpt/local_llm/webui/legacy_api.py+++ b/memgpt/local_llm/webui/legacy_api.py@@ -1,4 +1,3 @@-import osfrom urllib.parse import urljoinimport requestsdiff --git a/memgpt/memory.py b/memgpt/memory.pyindex 5bc6c9280..38f22aa5f 100644--- a/memgpt/memory.py+++ b/memgpt/memory.py@@ -142,7 +142,6 @@ class ArchivalMemory(ABC)::param memory_string: Memory string to insert:type memory_string: str"""- pass@abstractmethoddef search(self, query_string, count=None, start=None) -> Tuple[List[str], int]:@@ -157,7 +156,6 @@ class ArchivalMemory(ABC)::return: Tuple of (list of results, total number of results)"""- pass@abstractmethoddef __repr__(self) -> str:@@ -168,12 +166,10 @@ class RecallMemory(ABC):@abstractmethoddef text_search(self, query_string, count=None, start=None):"""Search messages that match query_string in recall memory"""- pass@abstractmethoddef date_search(self, start_date, end_date, count=None, start=None):"""Search messages between start_date and end_date in recall memory"""- pass@abstractmethoddef __repr__(self) -> str:@@ -182,7 +178,6 @@ class RecallMemory(ABC):@abstractmethoddef insert(self, message: Message):"""Insert message into recall memory"""- passclass DummyRecallMemory(RecallMemory):diff --git a/memgpt/metadata.py b/memgpt/metadata.pyindex 1cf1d6930..36946be54 100644--- a/memgpt/metadata.py+++ b/memgpt/metadata.py@@ -3,8 +3,7 @@import osimport uuidimport secrets-from typing import Optional, List, Dict-from datetime import datetime+from typing import Optional, Listfrom memgpt.constants import DEFAULT_HUMAN, DEFAULT_MEMGPT_MODEL, DEFAULT_PERSONA, DEFAULT_PRESET, LLM_MAX_TOKENSfrom memgpt.utils import get_local_time, enforce_typesdiff --git a/memgpt/migrate.py b/memgpt/migrate.pyindex 55b54d10f..45efb513c 100644--- a/memgpt/migrate.py+++ b/memgpt/migrate.py@@ -248,7 +248,7 @@ def migrate_agent(agent_name: str, data_dir: str = MEMGPT_DIR, ms: Optional[Metatry:with open(persistence_filename, "rb") as f:data = pickle.load(f)- except ModuleNotFoundError as e:+ except ModuleNotFoundError:# Patch for stripped openai package# ModuleNotFoundError: No module named 'openai.openai_object'with open(persistence_filename, "rb") as f:@@ -474,7 +474,7 @@ def migrate_agent(agent_name: str, data_dir: str = MEMGPT_DIR, ms: Optional[Metainterface=None,)save_agent(agent, ms=ms)- except Exception as e:+ except Exception:# if "Agent with name" in str(e):# print(e)# return@@ -540,7 +540,7 @@ def migrate_agent(agent_name: str, data_dir: str = MEMGPT_DIR, ms: Optional[Metatry:new_agent_folder = os.path.join(data_dir, MIGRATION_BACKUP_FOLDER, "agents", agent_name)shutil.move(agent_folder, new_agent_folder)- except Exception as e:+ except Exception:print(f"Failed to move agent folder from {agent_folder} to {new_agent_folder}")raisediff --git a/memgpt/models/openai.py b/memgpt/models/openai.pyindex 60d599714..5d41c0915 100644--- a/memgpt/models/openai.py+++ b/memgpt/models/openai.py@@ -1,7 +1,6 @@-from typing import List, Union, Optional, Dict, Literal+from typing import List, Union, Optional, Dictfrom enum import Enumfrom pydantic import BaseModel, Field, Json-import uuidclass ImageFile(BaseModel):diff --git a/memgpt/models/pydantic_models.py b/memgpt/models/pydantic_models.pyindex 46bb16572..eb8fac97a 100644--- a/memgpt/models/pydantic_models.py+++ b/memgpt/models/pydantic_models.py@@ -1,5 +1,4 @@-from typing import List, Union, Optional, Dict, Literal-from enum import Enum+from typing import List, Optional, Dictfrom pydantic import BaseModel, Field, Jsonimport uuidfrom datetime import datetimediff --git a/memgpt/persistence_manager.py b/memgpt/persistence_manager.pyindex 8dd972c2b..4615970a0 100644--- a/memgpt/persistence_manager.py+++ b/memgpt/persistence_manager.py@@ -1,5 +1,4 @@from abc import ABC, abstractmethod-import picklefrom typing import Listfrom memgpt.memory import (diff --git a/memgpt/server/rest_api/agents/config.py b/memgpt/server/rest_api/agents/config.pyindex dc895a917..05c554664 100644--- a/memgpt/server/rest_api/agents/config.py+++ b/memgpt/server/rest_api/agents/config.py@@ -68,8 +68,8 @@ def setup_agents_config_router(server: SyncServer, interface: QueuingInterface,interface.clear()agent_state = server.get_agent_config(user_id=user_id, agent_id=agent_id)# return GetAgentResponse(agent_state=agent_state)- llm_config = LLMConfigModel(**vars(agent_state.llm_config))- embedding_config = EmbeddingConfigModel(**vars(agent_state.embedding_config))+ LLMConfigModel(**vars(agent_state.llm_config))+ EmbeddingConfigModel(**vars(agent_state.embedding_config))return GetAgentResponse(agent_state=AgentStateModel(diff --git a/memgpt/server/rest_api/interface.py b/memgpt/server/rest_api/interface.pyindex 1755c6874..c9abfa285 100644--- a/memgpt/server/rest_api/interface.py+++ b/memgpt/server/rest_api/interface.py@@ -53,7 +53,6 @@ class QueuingInterface(AgentInterface):def user_message(self, msg: str):"""Handle reception of a user message"""- passdef internal_monologue(self, msg: str) -> None:"""Handle the agent's internal monologue"""diff --git a/memgpt/server/rest_api/models/index.py b/memgpt/server/rest_api/models/index.pyindex 37d956d55..ad4a23a0d 100644--- a/memgpt/server/rest_api/models/index.py+++ b/memgpt/server/rest_api/models/index.py@@ -1,4 +1,3 @@-import uuidfrom functools import partialfrom typing import List@@ -19,7 +18,7 @@ class ListModelsResponse(BaseModel):def setup_models_index_router(server: SyncServer, interface: QueuingInterface, password: str):- get_current_user_with_server = partial(partial(get_current_user, server), password)+ partial(partial(get_current_user, server), password)@router.get("/models", tags=["models"], response_model=ListModelsResponse)async def list_models():diff --git a/memgpt/server/rest_api/openai_assistants/assistants.py b/memgpt/server/rest_api/openai_assistants/assistants.pyindex c82c1ce34..fd16e3f07 100644--- a/memgpt/server/rest_api/openai_assistants/assistants.py+++ b/memgpt/server/rest_api/openai_assistants/assistants.py@@ -1,10 +1,6 @@-import asynciofrom fastapi import FastAPI-from asyncio import AbstractEventLoop-from enum import Enum-import jsonimport uuid-from typing import List, Optional, Union+from typing import List, Optionalfrom datetime import datetimefrom fastapi import APIRouter, Depends, Body, HTTPException, Query, Pathdiff --git a/memgpt/server/server.py b/memgpt/server/server.pyindex f68e23d74..28f964ce1 100644--- a/memgpt/server/server.py+++ b/memgpt/server/server.py@@ -435,7 +435,7 @@ class SyncServer(LockingServer):while len(memgpt_agent.messages) > 0:if memgpt_agent.messages[-1].get("role") == "user":# we want to pop up to the last user message and send it again- user_message = memgpt_agent.messages[-1].get("content")+ memgpt_agent.messages[-1].get("content")memgpt_agent.messages.pop()breakmemgpt_agent.messages.pop()diff --git a/memgpt/server/ws_api/interface.py b/memgpt/server/ws_api/interface.pyindex eae6b3ca4..12fa70885 100644--- a/memgpt/server/ws_api/interface.py+++ b/memgpt/server/ws_api/interface.py@@ -30,7 +30,6 @@ class AsyncWebSocketInterface(BaseWebSocketInterface):async def user_message(self, msg):"""Handle reception of a user message"""# Logic to process the user message and possibly trigger agent's response- passasync def internal_monologue(self, msg):"""Handle the agent's internal monologue"""@@ -85,7 +84,6 @@ class SyncWebSocketInterface(BaseWebSocketInterface):def user_message(self, msg):"""Handle reception of a user message"""# Logic to process the user message and possibly trigger agent's response- passdef internal_monologue(self, msg):"""Handle the agent's internal monologue"""diff --git a/poetry.lock b/poetry.lockindex 0122b2fb8..faedde3e4 100644--- a/poetry.lock+++ b/poetry.lock@@ -218,6 +218,21 @@ tests = ["attrs[tests-no-zope]", "zope-interface"]tests-mypy = ["mypy (>=1.6)", "pytest-mypy-plugins"]tests-no-zope = ["attrs[tests-mypy]", "cloudpickle", "hypothesis", "pympler", "pytest (>=4.3.0)", "pytest-xdist[psutil]"]+[[package]]+name = "autoflake"+version = "2.3.0"+description = "Removes unused imports and unused variables"+optional = false+python-versions = ">=3.8"+files = [+ {file = "autoflake-2.3.0-py3-none-any.whl", hash = "sha256:79a51eb8c0744759d2efe052455ab20aa6a314763510c3fd897499a402126327"},+ {file = "autoflake-2.3.0.tar.gz", hash = "sha256:8c2011fa34701b9d7dcf05b9873bc4859d4fce4e62dfea90dffefd1576f5f01d"},+]++[package.dependencies]+pyflakes = ">=3.0.0"+tomli = {version = ">=2.0.1", markers = "python_version < \"3.11\""}+[[package]]name = "azure-core"version = "1.30.1"@@ -3779,6 +3794,17 @@ files = [[package.dependencies]typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0"+[[package]]+name = "pyflakes"+version = "3.2.0"+description = "passive checker of Python programs"+optional = false+python-versions = ">=3.8"+files = [+ {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"},+ {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"},+]+[[package]]name = "pygments"version = "2.17.2"@@ -5874,4 +5900,4 @@ server = ["fastapi", "uvicorn", "websockets"][metadata]lock-version = "2.0"python-versions = "<3.12,>=3.10"-content-hash = "44a3dd2672236f037f34c7859a943d86a8a02297190ac4f826fe41d21955c4ca"+content-hash = "4fe62729e4de4bdacedc6e969aafdecf5897f34762d2c7cdad61bc813de93651"diff --git a/pyproject.toml b/pyproject.tomlindex 0ef230ae1..ad76e52b4 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -56,10 +56,11 @@ python-box = "^7.1.1"pytest-order = {version = "^1.2.0", optional = true}sqlmodel = "^0.0.16"llama-index-embeddings-azure-openai = "^0.1.6"+autoflake = {version = "^2.3.0", optional = true}[tool.poetry.extras]postgres = ["pgvector", "pg8000"]-dev = ["pytest", "pytest-asyncio", "pexpect", "black", "pre-commit", "datasets", "pyright", "pytest-order"]+dev = ["pytest", "pytest-asyncio", "pexpect", "black", "pre-commit", "datasets", "pyright", "pytest-order", "autoflake"]server = ["websockets", "fastapi", "uvicorn"]autogen = ["pyautogen"]diff --git a/tests/test_autogen_integration.py b/tests/test_autogen_integration.pyindex 4bf0b0aab..1c1b37cdd 100644--- a/tests/test_autogen_integration.py+++ b/tests/test_autogen_integration.py@@ -1,5 +1,4 @@import os-import sysimport subprocessimport pytestdiff --git a/tests/test_openai_assistant_api.py b/tests/test_openai_assistant_api.pyindex 71d6d1a43..8f15e358c 100644--- a/tests/test_openai_assistant_api.py+++ b/tests/test_openai_assistant_api.py@@ -1,6 +1,5 @@from fastapi import FastAPIfrom fastapi.testclient import TestClient-import uuidfrom memgpt.server.server import SyncServerfrom memgpt.server.rest_api.server import appdiff --git a/tests/test_openai_client.py b/tests/test_openai_client.pyindex 15fc72f01..86ea5ebf7 100644--- a/tests/test_openai_client.py+++ b/tests/test_openai_client.py@@ -1,5 +1,4 @@from openai import OpenAI-import timeimport uvicorndiff --git a/tests/test_server.py b/tests/test_server.pyindex 5dc0da076..c14b075b3 100644--- a/tests/test_server.py+++ b/tests/test_server.py@@ -187,8 +187,8 @@ def test_get_recall_memory(server, user_id, agent_id):cursor1, messages_1 = server.get_agent_recall_cursor(user_id=user_id, agent_id=agent_id, reverse=True, limit=2)cursor2, messages_2 = server.get_agent_recall_cursor(user_id=user_id, agent_id=agent_id, reverse=True, after=cursor1, limit=1000)cursor3, messages_3 = server.get_agent_recall_cursor(user_id=user_id, agent_id=agent_id, reverse=True, limit=1000)- ids3 = [m["id"] for m in messages_3]- ids2 = [m["id"] for m in messages_2]+ [m["id"] for m in messages_3]+ [m["id"] for m in messages_2]timestamps = [m["created_at"] for m in messages_3]print("timestamps", timestamps)assert messages_3[-1]["created_at"] < messages_3[0]["created_at"]