Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

gpt35 adjustments

cpackerdff7a444aa7f
diff --git a/memgpt/agent.py b/memgpt/agent.py
index 593b5e75c..244934014 100644
--- a/memgpt/agent.py
+++ b/memgpt/agent.py
@@ -64,7 +64,8 @@ def initialize_message_sequence(
first_user_message = get_login_event() # event letting MemGPT know the user just logged in
if include_initial_boot_message:
- initial_boot_messages = get_initial_boot_messages('startup_with_send_message')
+ # initial_boot_messages = get_initial_boot_messages('startup_with_send_message')
+ initial_boot_messages = get_initial_boot_messages('startup_with_send_message_gpt35')
messages = [
{"role": "system", "content": full_system_message},
] + initial_boot_messages + [
@@ -445,7 +446,8 @@ class AgentAsync(object):
if contains_special_characters(monologue):
printd(f"First message internal monologue contained special characters: {response_message}")
return False
- if 'functions' in monologue or 'send_message' in monologue or 'inner thought' in monologue.lower():
+ # if 'functions' in monologue or 'send_message' in monologue or 'inner thought' in monologue.lower():
+ if 'functions' in monologue or 'send_message' in monologue:
# Sometimes the syntax won't be correct and internal syntax will leak into message.context
printd(f"First message internal monologue contained reserved words: {response_message}")
return False
diff --git a/memgpt/presets.py b/memgpt/presets.py
index 9a65725eb..a59edeae4 100644
--- a/memgpt/presets.py
+++ b/memgpt/presets.py
@@ -22,6 +22,13 @@ def use_preset(preset_name, model, persona, human, interface, persistence_manage
printd(f"Available functions:\n", [x['name'] for x in available_functions])
assert len(functions) == len(available_functions)
+ if 'gpt-4' not in model:
+ # use a simpler system message for gpt-3.5
+ # preset_name = 'memgpt_gpt35_chat'
+ # preset_name = 'memgpt_gpt35_literal'
+ preset_name = 'memgpt_gpt35_extralong'
+ # pass
+
return AgentAsync(
model=model,
system=gpt_system.get_system_text(preset_name),
diff --git a/memgpt/prompts/system/memgpt_base.txt b/memgpt/prompts/system/memgpt_base.txt
index ed70a4e95..47f5f93fd 100644
--- a/memgpt/prompts/system/memgpt_base.txt
+++ b/memgpt/prompts/system/memgpt_base.txt
@@ -29,7 +29,7 @@ Your core memory unit will be initialized with a <persona> chosen by the user, a
Recall memory (ie conversation history):
Even though you can only see recent messages in your immediate context, you can search over your entire message history from a database.
This 'recall memory' database allows your to search through past interactions, effectively allowing you to remember prior engagements with a user.
-You can search your recall memory using the 'recall_memory_search' function.
+You can search your recall memory using the 'conversation_search' function.
Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
diff --git a/memgpt/prompts/system/memgpt_chat.txt b/memgpt/prompts/system/memgpt_chat.txt
index ac10264db..56658a445 100644
--- a/memgpt/prompts/system/memgpt_chat.txt
+++ b/memgpt/prompts/system/memgpt_chat.txt
@@ -38,7 +38,7 @@ Your core memory unit will be initialized with a <persona> chosen by the user, a
Recall memory (ie conversation history):
Even though you can only see recent messages in your immediate context, you can search over your entire message history from a database.
This 'recall memory' database allows your to search through past interactions, effectively allowing you to remember prior engagements with a user.
-You can search your recall memory using the 'recall_memory_search' function.
+You can search your recall memory using the 'conversation_search' function.
Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
diff --git a/memgpt/prompts/system/memgpt_doc.txt b/memgpt/prompts/system/memgpt_doc.txt
index a33ad034a..237c4a356 100644
--- a/memgpt/prompts/system/memgpt_doc.txt
+++ b/memgpt/prompts/system/memgpt_doc.txt
@@ -30,7 +30,7 @@ Your core memory unit will be initialized with a <persona> chosen by the user, a
Recall memory (ie conversation history):
Even though you can only see recent messages in your immediate context, you can search over your entire message history from a database.
This 'recall memory' database allows your to search through past interactions, effectively allowing you to remember prior engagements with a user.
-You can search your recall memory using the 'recall_memory_search' function.
+You can search your recall memory using the 'conversation_search' function.
Core memory (limited size):
Your core memory unit is held inside the initial system instructions file, and is always available in-context (you will see it at all times).
diff --git a/memgpt/system.py b/memgpt/system.py
index 98d9988bf..2dc93a097 100644
--- a/memgpt/system.py
+++ b/memgpt/system.py
@@ -23,12 +23,46 @@ def get_initial_boot_messages(version='startup'):
"arguments": "{\n \"message\": \"" + f"{INITIAL_BOOT_MESSAGE_SEND_MESSAGE_FIRST_MSG}" + "\"\n}"
}
},
+ # obligatory function return message
{
"role": "function",
"name": "send_message",
"content": package_function_response(True, None)
}
+ ]
+
+ elif version == 'startup_with_send_message_gpt35':
+ messages = [
+ # first message includes both inner monologue and function call to send_message
+ # {
+ # "role": "assistant",
+ # "content": INITIAL_BOOT_MESSAGE_SEND_MESSAGE_THOUGHT,
+ # "function_call": {
+ # "name": "send_message",
+ # "arguments": "{\n \"message\": \"" + f"{INITIAL_BOOT_MESSAGE_SEND_MESSAGE_FIRST_MSG}" + "\"\n}"
+ # }
+ # },
+ # # obligatory function return message
+ # {
+ # "role": "function",
+ # "name": "send_message",
+ # "content": package_function_response(True, None)
+ # },
+ # first message includes both inner monologue and function call to send_message
+ {
+ "role": "assistant",
+ "content": "*inner thoughts* Still waiting on the user. Sending a message with function.",
+ "function_call": {
+ "name": "send_message",
+ "arguments": "{\n \"message\": \"" + f"Hi, is anyone there?" + "\"\n}"
+ }
+ },
# obligatory function return message
+ {
+ "role": "function",
+ "name": "send_message",
+ "content": package_function_response(True, None)
+ }
]
else: