-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ES|QL] Text embedding inference operator #135062
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
[ES|QL] Text embedding inference operator #135062
Conversation
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/inference/InputTextReader.java
Show resolved
Hide resolved
carlosdelest
left a comment
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.
Looks good, thanks for dividing the original PR!
Some questions about testing, the rest looks 👍
...org/elasticsearch/xpack/esql/inference/textembedding/TextEmbeddingOperatorOutputBuilder.java
Outdated
Show resolved
Hide resolved
...org/elasticsearch/xpack/esql/inference/textembedding/TextEmbeddingOperatorOutputBuilder.java
Outdated
Show resolved
Hide resolved
| * This iterator reads text inputs from a {@link BytesRefBlock} and converts them into individual {@link InferenceAction.Request} instances | ||
| * of type {@link TaskType#TEXT_EMBEDDING}. | ||
| */ | ||
| public class TextEmbeddingOperatorRequestIterator implements BulkInferenceRequestIterator { |
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.
These classes may be included in their Operator class as inner classes - I don't think we're going to use them outside of the operators, right?
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 did not want the main classes to become to big.
I made them package-private instead of nesting them.
|
|
||
| public class TextEmbeddingOperatorOutputBuilderTests extends ComputeTestCase { | ||
|
|
||
| public void testBuildSmallOutputWithFloatEmbeddings() throws Exception { |
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 my understanding, what is expected to change from small to large, that we need to test both?
| public class TextEmbeddingOperatorRequestIteratorTests extends ComputeTestCase { | ||
|
|
||
| public void testIterateSmallInput() throws Exception { | ||
| assertIterate(between(1, 100)); |
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.
Same question, what is expected to change between small and large?
| final BytesRefBlock inputBlock = createMultiValueBlock(); | ||
|
|
||
| try (TextEmbeddingOperatorRequestIterator requestIterator = new TextEmbeddingOperatorRequestIterator(inputBlock, inferenceId)) { | ||
| // First position: multi-value concatenated with newlines |
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'm not sure if we're testing what the comment says? I don't see a check for the multivalues 🤔
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.
Fixed the comment.
This PR implements an ES|QL inference operator that takes text input and return embeddings.
This work is part of #131079.