Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
remove old function schema file
Sarah Wooderse24a48816c89
diff --git a/memgpt/prompts/gpt_functions.py b/memgpt/prompts/gpt_functions.pydeleted file mode 100644index 9c67f6b64..000000000--- a/memgpt/prompts/gpt_functions.py+++ /dev/null@@ -1,271 +0,0 @@-from ..constants import MAX_PAUSE_HEARTBEATS--request_heartbeat = {- "request_heartbeat": {- "type": "boolean",- "description": "Request an immediate heartbeat after function execution. Set to 'true' if you want to send a follow-up message or run a follow-up function.",- }-}--# FUNCTIONS_PROMPT_MULTISTEP_NO_HEARTBEATS = FUNCTIONS_PROMPT_MULTISTEP[:-1]-FUNCTIONS_CHAINING = {- "send_message": {- "name": "send_message",- "description": "Sends a message to the human user.",- "parameters": {- "type": "object",- "properties": {- # https://json-schema.org/understanding-json-schema/reference/array.html- "message": {- "type": "string",- "description": "Message contents. All unicode (including emojis) are supported.",- },- },- "required": ["message"],- },- },- "pause_heartbeats": {- "name": "pause_heartbeats",- "description": "Temporarily ignore timed heartbeats. You may still receive messages from manual heartbeats and other events.",- "parameters": {- "type": "object",- "properties": {- # https://json-schema.org/understanding-json-schema/reference/array.html- "minutes": {- "type": "integer",- "description": f"Number of minutes to ignore heartbeats for. Max value of {MAX_PAUSE_HEARTBEATS} minutes ({MAX_PAUSE_HEARTBEATS//60} hours).",- },- },- "required": ["minutes"],- },- },- "message_chatgpt": {- "name": "message_chatgpt",- "description": "Send a message to a more basic AI, ChatGPT. A useful resource for asking questions. ChatGPT does not retain memory of previous interactions.",- "parameters": {- "type": "object",- "properties": {- # https://json-schema.org/understanding-json-schema/reference/array.html- "message": {- "type": "string",- "description": "Message to send ChatGPT. Phrase your message as a full English sentence.",- }- }.update(request_heartbeat),- "required": ["message", "request_heartbeat"],- },- },- "core_memory_append": {- "name": "core_memory_append",- "description": "Append to the contents of core memory.",- "parameters": {- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "Section of the memory to be edited (persona or human).",- },- "content": {- "type": "string",- "description": "Content to write to the memory. All unicode (including emojis) are supported.",- },- }.update(request_heartbeat),- "required": ["name", "content", "request_heartbeat"],- },- },- "core_memory_replace": {- "name": "core_memory_replace",- "description": "Replace the contents of core memory. To delete memories, use an empty string for new_content.",- "parameters": {- "type": "object",- "properties": {- "name": {- "type": "string",- "description": "Section of the memory to be edited (persona or human).",- },- "old_content": {- "type": "string",- "description": "String to replace. Must be an exact match.",- },- "new_content": {- "type": "string",- "description": "Content to write to the memory. All unicode (including emojis) are supported.",- },- }.update(request_heartbeat),- "required": ["name", "old_content", "new_content", "request_heartbeat"],- },- },- "recall_memory_search": {- "name": "recall_memory_search",- "description": "Search prior conversation history using a string.",- "parameters": {- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "String to search for.",- },- "page": {- "type": "integer",- "description": "Allows you to page through results. Only use on a follow-up query. Defaults to 0 (first page).",- },- }.update(request_heartbeat),- "required": ["query", "page", "request_heartbeat"],- },- },- "conversation_search": {- "name": "conversation_search",- "description": "Search prior conversation history using case-insensitive string matching.",- "parameters": {- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "String to search for.",- },- "page": {- "type": "integer",- "description": "Allows you to page through results. Only use on a follow-up query. Defaults to 0 (first page).",- },- }.update(request_heartbeat),- "required": ["query", "request_heartbeat"],- },- },- "recall_memory_search_date": {- "name": "recall_memory_search_date",- "description": "Search prior conversation history using a date range.",- "parameters": {- "type": "object",- "properties": {- "start_date": {- "type": "string",- "description": "The start of the date range to search, in the format 'YYYY-MM-DD'.",- },- "end_date": {- "type": "string",- "description": "The end of the date range to search, in the format 'YYYY-MM-DD'.",- },- "page": {- "type": "integer",- "description": "Allows you to page through results. Only use on a follow-up query. Defaults to 0 (first page).",- },- }.update(request_heartbeat),- "required": ["start_date", "end_date", "page", "request_heartbeat"],- },- },- "conversation_search_date": {- "name": "conversation_search_date",- "description": "Search prior conversation history using a date range.",- "parameters": {- "type": "object",- "properties": {- "start_date": {- "type": "string",- "description": "The start of the date range to search, in the format 'YYYY-MM-DD'.",- },- "end_date": {- "type": "string",- "description": "The end of the date range to search, in the format 'YYYY-MM-DD'.",- },- "page": {- "type": "integer",- "description": "Allows you to page through results. Only use on a follow-up query. Defaults to 0 (first page).",- },- }.update(request_heartbeat),- "required": ["start_date", "end_date", "request_heartbeat"],- },- },- "archival_memory_insert": {- "name": "archival_memory_insert",- "description": "Add to archival memory. Make sure to phrase the memory contents such that it can be easily queried later.",- "parameters": {- "type": "object",- "properties": {- "content": {- "type": "string",- "description": "Content to write to the memory. All unicode (including emojis) are supported.",- },- }.update(request_heartbeat),- "required": ["content", "request_heartbeat"],- },- },- "archival_memory_search": {- "name": "archival_memory_search",- "description": "Search archival memory using semantic (embedding-based) search.",- "parameters": {- "type": "object",- "properties": {- "query": {- "type": "string",- "description": "String to search for.",- },- "page": {- "type": "integer",- "description": "Allows you to page through results. Only use on a follow-up query. Defaults to 0 (first page).",- },- }.update(request_heartbeat),- "required": ["query", "request_heartbeat"],- },- },- "read_from_text_file": {- "name": "read_from_text_file",- "description": "Read lines from a text file.",- "parameters": {- "type": "object",- "properties": {- "filename": {- "type": "string",- "description": "The name of the file to read.",- },- "line_start": {- "type": "integer",- "description": "Line to start reading from.",- },- "num_lines": {- "type": "integer",- "description": "How many lines to read (defaults to 1).",- },- }.update(request_heartbeat),- "required": ["filename", "line_start", "request_heartbeat"],- },- },- "append_to_text_file": {- "name": "append_to_text_file",- "description": "Append to a text file.",- "parameters": {- "type": "object",- "properties": {- "filename": {- "type": "string",- "description": "The name of the file to append to.",- },- "content": {- "type": "string",- "description": "Content to append to the file.",- },- }.update(request_heartbeat),- "required": ["filename", "content", "request_heartbeat"],- },- },- "http_request": {- "name": "http_request",- "description": "Generates an HTTP request and returns the response.",- "parameters": {- "type": "object",- "properties": {- "method": {- "type": "string",- "description": "The HTTP method (e.g., 'GET', 'POST').",- },- "url": {- "type": "string",- "description": "The URL for the request.",- },- "payload_json": {- "type": "string",- "description": "A JSON string representing the request payload.",- },- }.update(request_heartbeat),- "required": ["method", "url", "request_heartbeat"],- },- },-}diff --git a/tests/test_schema_generator.py b/tests/test_schema_generator.pyindex ac9322b03..e7861c30d 100644--- a/tests/test_schema_generator.py+++ b/tests/test_schema_generator.py@@ -1,9 +1,4 @@-import inspect--import memgpt.functions.function_sets.base as base_functions-import memgpt.functions.function_sets.extras as extras_functionsfrom memgpt.functions.schema_generator import generate_schema-from memgpt.prompts.gpt_functions import FUNCTIONS_CHAININGdef send_message(self, message: str):@@ -65,45 +60,3 @@ def test_schema_generator():assert Falseexcept:pass---def test_schema_generator_with_old_function_set():- # Try all the base functions first- for attr_name in dir(base_functions):- # Get the attribute- attr = getattr(base_functions, attr_name)-- # Check if it's a callable function and not a built-in or special method- if inspect.isfunction(attr):- # Here, 'func' is each function in base_functions- # You can now call the function or do something with it- print("Function name:", attr)- # Example function call (if the function takes no arguments)- # result = func()- function_name = str(attr_name)- real_schema = FUNCTIONS_CHAINING[function_name]- generated_schema = generate_schema(attr)- print(f"\n\nreference_schema={real_schema}")- print(f"\n\ngenerated_schema={generated_schema}")- assert real_schema == generated_schema-- # Then try all the extras functions- for attr_name in dir(extras_functions):- # Get the attribute- attr = getattr(extras_functions, attr_name)-- # Check if it's a callable function and not a built-in or special method- if inspect.isfunction(attr):- if attr_name == "create":- continue- # Here, 'func' is each function in base_functions- # You can now call the function or do something with it- print("Function name:", attr)- # Example function call (if the function takes no arguments)- # result = func()- function_name = str(attr_name)- real_schema = FUNCTIONS_CHAINING[function_name]- generated_schema = generate_schema(attr)- print(f"\n\nreference_schema={real_schema}")- print(f"\n\ngenerated_schema={generated_schema}")- assert real_schema == generated_schema