Skip to content

[Inference API] Do not write "task" field in Jina embedding request if unsupported#142181

Merged
DonalEvans merged 5 commits intoelastic:mainfrom
DonalEvans:fix-jina-clip-v2-integration
Feb 10, 2026
Merged

[Inference API] Do not write "task" field in Jina embedding request if unsupported#142181
DonalEvans merged 5 commits intoelastic:mainfrom
DonalEvans:fix-jina-clip-v2-integration

Conversation

@DonalEvans
Copy link
Contributor

If the model being used does not support the specified InputType, do not write the "task" field when sending a request to JinaAI. More specifically, for jina-clip-v2, do not write the "task" field for InputType values other than SEARCH and INTERNAL_SEARCH.

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.
@DonalEvans DonalEvans added >bug Feature:GenAI Features around GenAI :SearchOrg/Inference Label for the Search Inference team Team:Search - Inference labels Feb 9, 2026
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/search-inference-team (Team:Search - Inference)

@elasticsearchmachine
Copy link
Collaborator

Hi @DonalEvans, I've created a changelog YAML for you.

// Do not specify the "task" field if the provided input type is not supported by the model
JinaAIEmbeddingsTaskSettings taskSettings = model.getTaskSettings();
if (InputType.isSpecified(inputType)) {
if (InputType.isSpecified(inputType) && modelSupportsInputType(model, inputType)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this might be a bit easier to read if we separated the if blocks. Something like this:

        InputType inputTypeToUse;
        if (InputType.isSpecified(inputType)) {
            inputTypeToUse = inputType;
        } else {
            inputTypeToUse = taskSettings.getInputType();
        }

        if (inputTypeToUse != null && modelSupportsInputType(model, inputTypeToUse)) {
            builder.field(TASK_TYPE_FIELD, convertInputType(inputTypeToUse));
        }

Or maybe have the null check within modelSupportsInputType().

@DonalEvans DonalEvans added auto-backport Automatically create backport pull requests when merged branch:9.2 branch:8.19 branch:9.3 labels Feb 10, 2026
@DonalEvans DonalEvans merged commit d08631b into elastic:main Feb 10, 2026
35 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
9.3 Commit could not be cherrypicked due to conflicts
8.19 Commit could not be cherrypicked due to conflicts
9.2 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 142181

DonalEvans added a commit to DonalEvans/elasticsearch that referenced this pull request Feb 10, 2026
…f unsupported (elastic#142181)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.

(cherry picked from commit d08631b)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIServiceTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntityTests.java
DonalEvans added a commit to DonalEvans/elasticsearch that referenced this pull request Feb 10, 2026
…f unsupported (elastic#142181)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.

(cherry picked from commit d08631b)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIServiceTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntityTests.java
@DonalEvans
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
9.3
9.2
8.19

Questions ?

Please refer to the Backport tool documentation

elasticsearchmachine pushed a commit that referenced this pull request Feb 10, 2026
…f unsupported (#142181) (#142264)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.

(cherry picked from commit d08631b)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIServiceTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntityTests.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 10, 2026
…f unsupported (#142181) (#142265)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.

(cherry picked from commit d08631b)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIServiceTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntityTests.java
elasticsearchmachine pushed a commit that referenced this pull request Feb 10, 2026
…f unsupported (#142181) (#142263)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.

(cherry picked from commit d08631b)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntity.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/JinaAIServiceTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/jinaai/request/JinaAIEmbeddingsRequestEntityTests.java
@DonalEvans DonalEvans deleted the fix-jina-clip-v2-integration branch February 10, 2026 23:41
costin pushed a commit to costin/elasticsearch that referenced this pull request Feb 16, 2026
…f unsupported (elastic#142181)

If the model being used does not support the specified InputType, do not
write the "task" field when sending a request to JinaAI. More
specifically, for jina-clip-v2, do not write the "task" field for
InputType values other than SEARCH and INTERNAL_SEARCH.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auto-backport Automatically create backport pull requests when merged backport pending >bug Feature:GenAI Features around GenAI :SearchOrg/Inference Label for the Search Inference team Team:Search - Inference v8.19.12 v9.2.6 v9.3.1 v9.4.0

3 participants