Skip to content

Added db.py file template#10

Open
Anikkk wants to merge 1 commit intoUB-AICLUB:mainfrom
Anikkk:main
Open

Added db.py file template#10
Anikkk wants to merge 1 commit intoUB-AICLUB:mainfrom
Anikkk:main

Conversation

@Anikkk
Copy link
Copy Markdown

@Anikkk Anikkk commented Sep 20, 2024

added the template db.py for chromaDB

Copy link
Copy Markdown
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

Comment thread task_queue/db.py
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
Copy Markdown
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
Copy Markdown
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

Comment thread task_queue/db.py
import chromadb
from chromadb.config import Settings

def get_connection():
Copy link
Copy Markdown
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
Copy Markdown
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