-
Notifications
You must be signed in to change notification settings - Fork 89
Remove validation on text and image field for text_image_embedding processor #1230
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
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
we should not remove this method entirely, but pass in
true
forallowEmpty
field hereThere 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.
This method simply validates the values in
field_map
, however thisfield_map
contains:It's correct to validate it during processor creation, but not document ingestion. We can accept whatever value
text
orimage
field has in a document, so there's no point to keep the validation methodThere 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.
we have the same validation for text chunking processor here
I would propose to enable
allowEmpty
totrue
and avoid removing this methodThere 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.
The text chunking processor is different, in the processor, the field map is:
where
input_field
is The name of the field from which to obtain text for generating chunked passages. source, so it's correct to have that validation method (this is also the only one validation for this processor).While in the text_image_embedding processor, the field map is
where
input_text_field
andinput_image_field
is the field to obtain values for embeddingwe should validate the
input_text_field
andinput_image_field
instead oftext
andimage
(which is what that validation method does). Since we accept all values fortext
andimage
field, there's no validations needed.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 we are using this function wrongly here for the TextImageEmbeddingProcessor. But I think we still want to validate:
The actual field map we should validate is
{
"input_text_field": "vector_field",
"input_image_field": "vector_field"
}
And we should unflatten it before the validation to handle the "." properly.
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.
For unmapped field
text
andimage
, why do we want to restrict the data type? the value can be anything including string and any other object.If you are talking about mapped fields
input_text_field
andinput_image_field
, we do need to validating the data type. But it's already handled here inbuildMapWithKnnKeyAndOriginalValue
methodThere 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.
@weijia-aws for 1, you're correct it's already defined to Map<String, String>, we don't need to add any additional validation for this.
for 2,
we do allow ingest document with mapped fields with empty strings
, in fact theallowEmpty
is introduced forTextChunkingProcessor
because the chunking field might be empty during ingestion, but this value is defaulted to false inInferenceProcessor
which is been extended by TextEmbeddingProcessor, SparseEmbeddingProcessor. The reason why we don't allow the field to be empty is because passing empty string to generate dense/sparse embedding doesn't make any sense.For now TextImageEmbeddingProcessor's validation is not working because it's validating the
reserved keywords
instead of actual keys, so I'm open to either merge this PR(as this indeed can fix the bug) or change it to add actual validation.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.
For now, I will merge as is. We can add the validation in future
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.
@weijia-aws Could you create a github issue for those two cases above?
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.
Create one Github issue for the second case #1239, there's no issue with the first one