[ML] Move to the Cohere V2 API for new inference endpoints#129884
Merged
davidkyle merged 16 commits intoelastic:mainfrom Jun 24, 2025
Merged
[ML] Move to the Cohere V2 API for new inference endpoints#129884davidkyle merged 16 commits intoelastic:mainfrom
davidkyle merged 16 commits intoelastic:mainfrom
Conversation
Collaborator
|
Pinging @elastic/ml-core (Team:ML) |
Collaborator
|
Hi @davidkyle, I've created a changelog YAML for you. |
davidkyle
commented
Jun 23, 2025
...inference/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereService.java
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceSettings.java
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/inference/services/cohere/request/CohereRequest.java
Show resolved
Hide resolved
.../org/elasticsearch/xpack/inference/services/cohere/request/v1/CohereV1CompletionRequest.java
Show resolved
Hide resolved
.../org/elasticsearch/xpack/inference/services/cohere/request/v2/CohereV2CompletionRequest.java
Show resolved
Hide resolved
# Conflicts: # server/src/main/java/org/elasticsearch/TransportVersions.java
prwhelan
approved these changes
Jun 24, 2025
...e/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceSettings.java
Show resolved
Hide resolved
...e/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceSettings.java
Outdated
Show resolved
Hide resolved
…inference/services/cohere/CohereServiceSettings.java Co-authored-by: Pat Whelan <pat.whelan@elastic.co>
Member
Author
|
Test this please |
Collaborator
💔 Backport failed
You can use sqren/backport to manually backport by running |
mridula-s109
pushed a commit
to mridula-s109/elasticsearch
that referenced
this pull request
Jun 25, 2025
Member
Author
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The Cohere V2 API contains 2 changes that must be adapted for
modelparameter is no longer optionalinput_typeparameter is no longer optionalCreating an endpoint without a model now causes a validation exception.
input_typeis declared either in task_settings or in the inference call, if not set in either or these places input_type defaults to search_query.New inference endpoints will use the V2 API, existing endpoints will continue to use the V1 API. The user does not have the option of picking the V1 API in new endpoints. One possibly controversial aspect is that the API version is not surfaced to the user, the version is persisted with the model config but not included in the
GET _inferenceresponse. I implemented this behaviour because the user does not have the ability to pick the API, in retrospect hiding the version now seems confusing.The request classes have been moved to
org.elasticsearch.xpack.inference.services.cohere.request.v1and renamed. The new V2 request classes are inorg.elasticsearch.xpack.inference.services.cohere.request.v2(they are very similar).The upgrade test
CohereServiceUpgradeITtests that the old v1 endpoints still work after upgrading.