-
Notifications
You must be signed in to change notification settings - Fork 138
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 input null for text docs input #1401
Conversation
Signed-off-by: Yaliang Wu <[email protected]>
@@ -114,7 +114,11 @@ public TextDocsMLInput(XContentParser parser, FunctionName functionName) throws | |||
case TEXT_DOCS_FIELD: | |||
ensureExpectedToken(XContentParser.Token.START_ARRAY, parser.currentToken(), parser); | |||
while (parser.nextToken() != XContentParser.Token.END_ARRAY) { | |||
docs.add(parser.text()); | |||
if (parser.currentToken() == null || parser.currentToken() == XContentParser.Token.VALUE_NULL) { |
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.
What happens if the input is [null, null]
?
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.
This depends on the model. If model can't accept, it will throw exception.
Codecov Report
@@ Coverage Diff @@
## main #1401 +/- ##
============================================
- Coverage 78.82% 77.56% -1.26%
- Complexity 2145 2178 +33
============================================
Files 168 173 +5
Lines 8755 8977 +222
Branches 878 889 +11
============================================
+ Hits 6901 6963 +62
- Misses 1455 1611 +156
- Partials 399 403 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
The backport to
To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-1401-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 f1dd56bb46554c6c0469c5c0222cf618ef1031b3
# Push it to GitHub
git push --set-upstream origin backport/backport-1401-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x Then, create a pull request where the |
Description
We need to support null value for some use case, for example multi-modal model needs text and image input. User who use TextDocsInputDataSet can use such format
[text, image]
, the first item is text and second is image, but they could be null, for example user may only input image, the input will be[null, image]
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.