-
Notifications
You must be signed in to change notification settings - Fork 25.8k
[Inference API] Parse endpoint metadata from persisted endpoints #143081
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
Merged
dimitris-athanasiou
merged 12 commits into
elastic:main
from
dimitris-athanasiou:parse-inference-endpoint-metadata
Mar 2, 2026
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f457b5c
[Inference API] Parse endpoint metadata from persisted endpoints
dimitris-athanasiou 977b372
Update docs/changelog/143081.yaml
dimitris-athanasiou a43569c
Ensure UnparsedModel secrets is null when empty
dimitris-athanasiou 8904690
Fix ModelRegistryIT
dimitris-athanasiou d80e4c1
Merge branch 'main' into parse-inference-endpoint-metadata
dimitris-athanasiou 5272656
Remove unused import
dimitris-athanasiou b0d295f
Fix tests
dimitris-athanasiou f57c954
Remove duplication by moving parsePersistedConfig to SenderService
dimitris-athanasiou 9ee93eb
Merge branch 'main' into parse-inference-endpoint-metadata
dimitris-athanasiou ef1b0ea
reinstate modified DeepSeekServiceTests
dimitris-athanasiou ff50ab7
Merge branch 'main' into parse-inference-endpoint-metadata
dimitris-athanasiou 4bd7d27
Use UnparsedModel without copy in update action
dimitris-athanasiou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| area: Inference | ||
| issues: [] | ||
| pr: 143081 | ||
| summary: "[Inference API] Parse endpoint metadata from persisted endpoints" | ||
| type: enhancement |
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
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
42 changes: 42 additions & 0 deletions
42
server/src/test/java/org/elasticsearch/inference/UnparsedModelTests.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the "Elastic License | ||
| * 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side | ||
| * Public License v 1"; you may not use this file except in compliance with, at | ||
| * your election, the "Elastic License 2.0", the "GNU Affero General Public | ||
| * License v3.0 only", or the "Server Side Public License, v 1". | ||
| */ | ||
|
|
||
| package org.elasticsearch.inference; | ||
|
|
||
| import org.elasticsearch.test.ESTestCase; | ||
|
|
||
| import java.util.Map; | ||
|
|
||
| import static org.hamcrest.Matchers.is; | ||
| import static org.hamcrest.Matchers.nullValue; | ||
|
|
||
| public class UnparsedModelTests extends ESTestCase { | ||
|
|
||
| public void testNullSecrets() { | ||
| UnparsedModel model = new UnparsedModel("id", randomFrom(TaskType.values()), "test_service", Map.of(), null); | ||
| assertThat(model.secrets(), is(nullValue())); | ||
| } | ||
|
|
||
| public void testEmptySecrets_SetToNull() { | ||
| UnparsedModel model = new UnparsedModel("id", randomFrom(TaskType.values()), "test_service", Map.of(), Map.of()); | ||
| assertThat(model.secrets(), is(nullValue())); | ||
| } | ||
|
|
||
| public void testSettingsIsModifiable_GivenUnmodifiableMap() { | ||
| UnparsedModel model = new UnparsedModel("id", randomFrom(TaskType.values()), "test_service", Map.of("key", "value"), Map.of()); | ||
| model.settings().remove("key"); | ||
| assertThat(model.settings().isEmpty(), is(true)); | ||
| } | ||
|
|
||
| public void testSecretsIsModifiable_GivenUnmodifiableMap() { | ||
| UnparsedModel model = new UnparsedModel("id", randomFrom(TaskType.values()), "test_service", Map.of(), Map.of("key", "value")); | ||
| model.secrets().remove("key"); | ||
| assertThat(model.secrets().isEmpty(), is(true)); | ||
| } | ||
| } |
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
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
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
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
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
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
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
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
Oops, something went wrong.
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.
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.
Can you talk a little more about the advantage of using null here? It was possible to get null before right? We're just changing empty to also be 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.
If
secretshere ends being an empty map, validations will fail complaining for missing fields. In my understanding, we should never have validations failing when parsing a persisted config. They should only apply when we parse from the request. Thus, here, I'm taking care of this potential issue in a single place.Previously this was not an issue because there was the variant for parsing without secrets which resulted in
null. As now we have a single parse method, it is good defense I think to handle this here. Happy to revise though if you think otherwise.