-
Notifications
You must be signed in to change notification settings - Fork 17
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
allow passing an empty docs [] to from_documents #205
allow passing an empty docs [] to from_documents #205
Conversation
Thanks for your contribution! What will happen now if a user passed an empty list? Seems odd to call What's the use case for such a call? |
Hi! The idea is to have consistent behavior. if you pass [] as However, it was failing for Cohere (and probably other embedders). If you have for example a pipeline and for some reason you don't have I have seen some users in our forums having issues on understanding how to instantiate a vectorstore without passing With this PR, having docs or just [] will always return a instantiated vectorstore :) Let me know if this makes sense. Thanks! |
If it worked for OpenAI but fail for Cohere (and probably other embeddeders), it sounds like there's a bug in either the open ai embedder or the other embedders. @efriis what are your thoughts on this?
Users can call the This is also discussed elsewhere in the langchain docs. By the way, the link you shared directed to the main page of the forum. Would you happen to recall the questions about this issue? I'd like to understand the context more. |
Oh... I am not sure where I got this from (pretty sure it was from a user code), but it seems I may be the one spreading this pattern around 😬 It goes back to here, where you and I even interacted at some point to help a user: I replicated this pattern also in one of our recipes: I will go around changing that code where I find so we keep to the expected pattern, Thanks! |
Good catch - we can start testing embedding In the meantime, if this is a common pattern for weaviate (not sure this should be an encouraged pattern - why not instantiate |
@efriis this means vector store implementors don't need to test for an empty list getting passed to |
if you want to support from_documents([]), you should test it this will be a slow change because it doesn't really make sense to call |
Closing since we will tell users to instantiate the vector store directly if they don't want to pass a list of documents. |
passing an empty list as docs was failing for some embedders:
this will prevent embedding empty texts.
it was raising this error: