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

Opt-in memory collections' snapshopts #466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ CORE_PORT=1865

# Log levels
LOG_LEVEL=WARNING

# Turn on memory collections' snapshots on embedder change with SAVE_MEMORY_SNAPSHOTS=true
SAVE_MEMORY_SNAPSHOTS=false
9 changes: 6 additions & 3 deletions core/cat/memory/vector_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,12 @@ def check_embedding_size(self):
log.info(f'Collection "{self.collection_name}" has the same embedder')
else:
log.warning(f'Collection "{self.collection_name}" has different embedder')
# dump collection on disk before deleting
self.save_dump()
log.info(f'Dump "{self.collection_name}" completed')
# Memory snapshot saving can be turned off in the .env file with:
# SAVE_MEMORY_SNAPSHOTS=false
if os.getenv("SAVE_MEMORY_SNAPSHOTS") == "true":
# dump collection on disk before deleting
self.save_dump()
log.info(f'Dump "{self.collection_name}" completed')

self.client.delete_collection(self.collection_name)
log.warning(f'Collection "{self.collection_name}" deleted')
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ services:
- API_KEY=${API_KEY:-}
- LOG_LEVEL=${LOG_LEVEL:-WARNING}
- DEBUG=${DEBUG:-true}
- SAVE_MEMORY_SNAPSHOTS=${SAVE_MEMORY_SNAPSHOTS:-false}
ports:
- ${CORE_PORT:-1865}:80
volumes:
Expand Down
Loading