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

chromaDB collection creation error in pdf embedding #1

Open
Aprilistic opened this issue Aug 13, 2024 · 0 comments
Open

chromaDB collection creation error in pdf embedding #1

Aprilistic opened this issue Aug 13, 2024 · 0 comments

Comments

@Aprilistic
Copy link

Aprilistic commented Aug 13, 2024

Hi, there!

Thank you for sharing the fastAPI tutorial.
Your code greatly helped our team in this hackathon.
However, there is a part of your code that needs improvement.

https://github.com/Ilevk/solar-backend-fastapi-advanced/blob/main/app/services/embedding.py

In app/services/embedding.py,

In lines 65-70, create_creation raises an error when you create with an existing collection name.

try:
   await client.create_collection(name=collection_name)
except Exception:
   logger.info(f"Collection {collection_name} already exists")

collection: Collection = await client.get_collection(collection_name)

Instead, we can fix the code like the following line.

collection: Collection = await client.get_or_create_collection(collection_name)
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

No branches or pull requests

1 participant