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

Added db.py file template #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Added db.py file template #10

wants to merge 1 commit into from

Conversation

Anikkk
Copy link

@Anikkk Anikkk commented Sep 20, 2024

added the template db.py for chromaDB

Copy link
Owner

@UB-AICLUB UB-AICLUB left a comment

Choose a reason for hiding this comment

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

great work with the code, I'm trying to understand why cant we go ahead with a random ID

collection = client.get_or_create_collection(name=collection_name)

# Assuming each item needs a unique ID, we're using the text as the ID here
# In a real-world scenario, you might want to use a more robust ID generation method
Copy link
Owner

Choose a reason for hiding this comment

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

shouldn't we just go ahead with uuid.uuid4() to get a random id?

Copy link
Author

Choose a reason for hiding this comment

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

we can go with random id, i will make the changes

import chromadb
from chromadb.config import Settings

def get_connection():
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we create a class instead, with all the initialisations in the init function. This will eliminate need to call get_connection for creating the function. We can then create the CRUD operations inside the class.

@UB-AICLUB Thoughts?

Copy link
Owner

Choose a reason for hiding this comment

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

yeah we could go with a class but i guess lets not make him do this over again this works na so lets go ahead with it

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