-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Custom id hashing on documentstore level #1910
Changes from 1 commit
bf91c19
d8739de
0829f42
a619fae
dafa6a3
66d0950
1169525
1c103ac
6e11cb7
7bed279
9665d77
4302dba
1f162ad
99b4f57
7b51cfb
b616347
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -92,11 +92,12 @@ def __init__( | |
self.content_type = content_type | ||
self.score = score | ||
self.meta = meta or {} | ||
self.id_hash_keys = id_hash_keys | ||
|
||
allowed_hash_key_attributes = ["content", "content_type", "score", "meta", "embedding" ] | ||
if not set(self.id_hash_keys) <= set(allowed_hash_key_attributes): | ||
raise ValueError(f"You passed custom strings {id_hash_keys} to id_hash_keys which is deprecated. Supply instead a list of Document's attribute names that the id should be based on (e.g. {allowed_hash_key_attributes}). See /~https://github.com/deepset-ai/haystack/pull/1910 for details)") | ||
self.id_hash_keys = id_hash_keys | ||
if self.id_hash_keys != None: | ||
if not set(self.id_hash_keys) <= set(allowed_hash_key_attributes): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this line is still failing with mypy I'd say we put a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 I added a comment at that line :) |
||
raise ValueError(f"You passed custom strings {self.id_hash_keys} to id_hash_keys which is deprecated. Supply instead a list of Document's attribute names that the id should be based on (e.g. {allowed_hash_key_attributes}). See /~https://github.com/deepset-ai/haystack/pull/1910 for details)") | ||
|
||
|
||
if embedding is not None: | ||
|
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.
I think
is not
is preferred over!=
when comparing toNone
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.
Here is a brief explanation of the reasons: https://stackoverflow.com/a/2209781
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.
Thanks!