Skip to content

Conversation

@afoucret
Copy link
Contributor

This PR implements an ES|QL inference operator that takes text input and return embeddings.

This work is part of #131079.

@afoucret afoucret requested review from a team, carlosdelest and ioanatia September 19, 2025 08:59
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Sep 19, 2025
@afoucret afoucret changed the title [ES|QL] text embedding inference operator [ES|QL] Text embedding inference operator Sep 19, 2025
Copy link
Member

@carlosdelest carlosdelest left a 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 👍

* 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 {
Copy link
Member

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?

Copy link
Contributor Author

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 {
Copy link
Member

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));
Copy link
Member

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
Copy link
Member

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 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the comment.

@afoucret afoucret enabled auto-merge (squash) September 24, 2025 09:26
@afoucret afoucret merged commit 433ab3a into elastic:main Sep 24, 2025
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>non-issue :Search Relevance/ES|QL Search functionality in ES|QL Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants