Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tests and bug fixes AgentState.state #1058

Merged
merged 14 commits into from
Mar 1, 2024
Merged

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Feb 26, 2024

Please describe the purpose of this pull request.

Another attempt to patch #966 (closes #966)

  • add tests for read/writes on AgentState.state
    • added to tests/test_metadata_store.py (maybe should be put elsewhere?)
  • in case of an empty agent_state.state, read from the preset instead
  • add tests for loading with empty agent_state.state (should no longer error)
  • remove create_agent_from_preset, instead modify Agent.__init__ to take optional preset arg

How to test

  • reproduce linked issue
  • confirm that this PR patches the issue

Have you tested this PR?

Repro issue (0.3.3)

Roll back to version 0.3.3:

git checkout 508679e
poetry install

Wipe existing home dir:

mv ~/.memgpt ~/.memgpt_backup

Try to repro based on #1070:

memgpt quickstart
📖 MemGPT configuration file updated!
🧠 model        -> ehartford/dolphin-2.5-mixtral-8x7b
🖥️  endpoint     -> https://api.memgpt.ai
⚡ Run "memgpt run" to create an agent with the new config.
memgpt run
  File "/Users/loaner/dev/MemGPT-2/memgpt/cli/cli.py", line 620, in run
    memgpt_agent = presets.create_agent_from_preset(
  File "/Users/loaner/dev/MemGPT-2/memgpt/presets/presets.py", line 82, in create_agent_from_preset
    assert preset_name == preset.name, f"AgentState preset '{preset_name}' does not match preset name '{preset.name}'"
AttributeError: 'NoneType' object has no attribute 'name'

Repro issue (main)

Roll back to version to main (pre-PR #1058):

git checkout main
poetry install

Wipe existing home dir:

mv ~/.memgpt ~/.memgpt_backup

Try to repro based on #1070:

memgpt quickstart
📖 MemGPT configuration file updated!
🧠 model        -> ehartford/dolphin-2.5-mixtral-8x7b
🖥️  endpoint     -> https://api.memgpt.ai
⚡ Run "memgpt run" to create an agent with the new config.
memgpt run
🧬 Creating new agent...
->  🤖 Using persona profile 'sam_pov'
->  🧑 Using human profile 'basic'
🎉 Created new agent 'BenevolentUnicorn' (id=8cf1de2c-6861-404b-abde-cc39f0269db2)

Hit enter to begin (will request first MemGPT message)

@sarahwooders bug reported in #1070 was fixed sometime past the 0.3.3 tag, but pre-this PR.

Confirm that PR patches the issue Ensuring that there was no regression in this PR

memgpt quickstart
📖 MemGPT configuration file updated!
🧠 model        -> ehartford/dolphin-2.5-mixtral-8x7b
🖥️  endpoint     -> https://api.memgpt.ai
⚡ Run "memgpt run" to create an agent with the new config.
memgpt run
🧬 Creating new agent...
->  🤖 Using persona profile 'sam_pov'
->  🧑 Using human profile 'basic'
🎉 Created new agent 'LovingNachos' (id=3633e9a0-ad69-4dd0-b0d7-2e53f3b1c000)

Hit enter to begin (will request first MemGPT message)

@cpacker cpacker self-assigned this Feb 26, 2024
@cpacker cpacker changed the title feat: add tests for read/writes on AgentState.state feat: tests and bug fixes AgentState.state Feb 26, 2024
@cpacker cpacker marked this pull request as ready for review March 1, 2024 02:35
memgpt/agent.py Show resolved Hide resolved
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@sarahwooders sarahwooders merged commit a2133fd into main Mar 1, 2024
4 checks passed
@cpacker cpacker deleted the agent-state-tests branch March 1, 2024 21:09
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment