-
Notifications
You must be signed in to change notification settings - Fork 134
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: Chroma - defer the DB connection #1107
feat: Chroma - defer the DB connection #1107
Conversation
integrations/chroma/src/haystack_integrations/document_stores/chroma/document_store.py
Outdated
Show resolved
Hide resolved
self._chroma_client = self.chroma_client() | ||
self._collection = self.collection() | ||
self._initialized = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's inline these two function calls and remove the individual methods - I don't think they are used anywhere else.
if self._collection is None: | ||
msg = "Collection is not initialized" | ||
raise ValueError(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the collection and client variables should be initialized after the call to _ensure_initialized
, so there's no reason to raise. We can replace that with assert self._collection is not None
instead (same with the other variable wherever it needs to be directly accessed).
I made the changes as you pointed out. LMK your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anakin87 I'll leave the final approval to you (once the tests are fixed).
I've been looking into the test failures, but I'm having trouble interpreting them, as they seem to be open to different interpretations. I’d appreciate it if you could help clarify what might be causing the issue or what direction I should take to resolve this. |
I will take a look... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After fixing some small things, I'm going to merge this PR and release a new version of chroma-haystack
.
Thanks!
Related Issues
Proposed Changes:
How did you test it?
run unit & integration tests
Notes for the reviewer
Checklist
fix:
,feat:
,build:
,chore:
,ci:
,docs:
,style:
,refactor:
,perf:
,test:
.