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: factory reset endpoint #916

Conversation

alfredotoselli
Copy link

Description

Hello! Happy to learn about the project and start contributing on technical stuff :)
Let's check if the endpoint makes sense as is and if any corner case comes to your minds.
If ok I'll add a couple of tests before merging.

The situation will be:

  • Possibility to wipe out the collections also from admin panel button
  • Inactive reset buttons for llm and embedder on the settings panel
    • As mentioned in the issue we should decide if restore the last setting present on DB or the setting on the first installation
  • This new /settings/factory-reset endpoint (currently without button) that wipes out all the collections, deletes metadata.json and performs a "soft restart"

Related to issue #797

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@@ -40,19 +41,14 @@ async def wipe_collections(
"""Delete and create all collections"""

vector_memory: VectorMemory = stray.memory.vectors
collections = list(vector_memory.collections.keys())
deleted_memories = utils.delete_collections(vector_memory)

Choose a reason for hiding this comment

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

if you move the delete_collection in the vector_memory_collection.py like

    def wipe(self) -> bool:
        try:
            self.client.delete(collection_name=self.collection_name)
            return True
        except Exception as e:
            log.error(f"Error deleting collection {self.collection_name}: {e}")
            return False

you could use

to_return = {str(c): ccat.memory.vectors.collections[str(c)].wipe() for c in MemoryCollection}

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion! I made slightly different thing because there is direct access to the memory from the stray

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants