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

Implement loading MemoryItems from file in JSONFileMemory #4703

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented Jun 15, 2023

Background

JSONFileMemory will write memories to a file, but can't yet load them back from a file. This PR fixes that.

Changes

  • Implement loading MemoryItems from JSON index file
  • Remove init param from get_memory(), replace usages by memory.clear()
  • Make token length calculation optional in MemoryItem.dump()

Documentation

x

Test Plan

I added a test for JSONFileMemory.load_index(), so if CI is green we're good

PR Quality Checklist

  • My pull request is atomic and focuses on a single change.
  • I have thoroughly tested my changes with multiple different prompts.
  • I have considered potential risks and mitigations for my changes.
  • I have documented my changes clearly and comprehensively.
  • I have not snuck in any "extra" small tweaks changes.
  • I have run the following commands against my code to ensure it passes our linters:
    black .
    isort .
    mypy
    autoflake --remove-all-unused-imports --recursive --ignore-init-module-imports --ignore-pass-after-docstring autogpt tests --in-place

Further changes:
* remove `init` param from `get_memory()`, replace usages by `memory.clear()`
* make token length calculation optional in `MemoryItem.dump()`
@netlify
Copy link

netlify bot commented Jun 15, 2023

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit f16d7ba
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/648b233856fa3b0008ad30da

@Pwuts Pwuts added this to the v0.4.2 Release milestone Jun 15, 2023
@Pwuts Pwuts merged commit f0a5250 into master Jun 15, 2023
@Pwuts Pwuts deleted the load-json-memory branch June 15, 2023 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants