You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First:
The functions that call query_text and query_date send the equivalent of "limit" and "offset" in different order and therefore they are mismatched.
In BaseRecallMemory, query_text is called as follows: results = self.storage.query_text(query_string, count, start)
in SQLStorageConnector, query_text definition is: def query_text(self, offset=0, limit=None):
count is equivalent to limit and start is equivalent to offset, but they are listed in different order and therefore they get swapped. So, if the intent was to get the first 5 results from page 0, you end up getting all the results (because limit=0) after message 5 (because offset=5). Easy fix.
Second:
The query will search all messages, including the system prompt and any tool messages. If you get a system message in the return, you have a high chance of exceeding the context size and summarize will fail because it never summarizes the last message. I don't see the value in searching the system prompt since it's already being returned anyway. I suspect tool messages aren't relevant either and would think these search functions are intended to focus on what the user said and what the llm said. So I propose to include two additional filters to those functions:
Third:
Issue #1343
This should be fixed in db.py as well. I'm just not sure yet if it will break sqllite to make the fix in SQLStorageConnector or implement an override in PostgresStorageConnector
I've tested and used both of these changes and its returning what's expected.
Please describe your setup
How did you install memgpt?
pip install pymemgpt
The text was updated successfully, but these errors were encountered:
Describe the bug
MemGPT/memgpt/memory.py
Line 329 in f1f912d
First:
The functions that call query_text and query_date send the equivalent of "limit" and "offset" in different order and therefore they are mismatched.
In
BaseRecallMemory
, query_text is called as follows:results = self.storage.query_text(query_string, count, start)
in
SQLStorageConnector
, query_text definition is:def query_text(self, offset=0, limit=None):
count is equivalent to limit and start is equivalent to offset, but they are listed in different order and therefore they get swapped. So, if the intent was to get the first 5 results from page 0, you end up getting all the results (because limit=0) after message 5 (because offset=5). Easy fix.
Second:
The query will search all messages, including the system prompt and any tool messages. If you get a system message in the return, you have a high chance of exceeding the context size and summarize will fail because it never summarizes the last message. I don't see the value in searching the system prompt since it's already being returned anyway. I suspect tool messages aren't relevant either and would think these search functions are intended to focus on what the user said and what the llm said. So I propose to include two additional filters to those functions:
Third:
Issue #1343
This should be fixed in db.py as well. I'm just not sure yet if it will break sqllite to make the fix in
SQLStorageConnector
or implement an override inPostgresStorageConnector
I've tested and used both of these changes and its returning what's expected.
Please describe your setup
pip install pymemgpt
The text was updated successfully, but these errors were encountered: