-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Draft: Add new pre-configured model #138045
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,7 +54,7 @@ public class AuthorizationTaskExecutorIT extends ESSingleNodeTestCase { | |
| ] | ||
| } | ||
| """; | ||
|
|
||
| // Should we add gp-llm-v2 to the response? | ||
| public static final String AUTHORIZED_RAINBOW_SPRINKLES_RESPONSE = """ | ||
| { | ||
| "models": [ | ||
|
|
@@ -203,20 +203,30 @@ public void testCreatesEisChatCompletion_DoesNotRemoveEndpointWhenNoLongerAuthor | |
|
|
||
| private void assertChatCompletionEndpointExists() { | ||
| var eisEndpoints = getEisEndpoints(); | ||
| assertThat(eisEndpoints.size(), is(1)); | ||
| assertThat(eisEndpoints.size(), is(2)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's leave this file unchanged, the logic here is just to make sure an endpoint gets created. I think it's fine if we stick with rainbow-sprinkles. |
||
|
|
||
| var rainbowSprinklesModel = eisEndpoints.get(0); | ||
| assertChatCompletionUnparsedModel(rainbowSprinklesModel); | ||
| assertTrue( | ||
| modelRegistry.containsPreconfiguredInferenceEndpointId(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1) | ||
| ); | ||
| var gpLlmV2Model = eisEndpoints.get(1); | ||
| assertChatCompletionUnparsedModel(gpLlmV2Model); | ||
| assertTrue( | ||
| modelRegistry.containsPreconfiguredInferenceEndpointId(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2) | ||
| ); | ||
| } | ||
|
|
||
| private void assertChatCompletionUnparsedModel(UnparsedModel rainbowSprinklesModel) { | ||
| assertThat(rainbowSprinklesModel.taskType(), is(TaskType.CHAT_COMPLETION)); | ||
| assertThat(rainbowSprinklesModel.service(), is(ElasticInferenceService.NAME)); | ||
| assertThat(rainbowSprinklesModel.inferenceEntityId(), is(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1)); | ||
| } | ||
| private void assertChatCompletionUnparsedModel(UnparsedModel gpLlmV2Model) { | ||
| assertThat(gpLlmV2Model.taskType(), is(TaskType.CHAT_COMPLETION)); | ||
| assertThat(gpLlmV2Model.service(), is(ElasticInferenceService.NAME)); | ||
| assertThat(gpLlmV2Model.inferenceEntityId(), is(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2)); | ||
| } | ||
|
|
||
| public void testCreatesChatCompletion_AndThenCreatesTextEmbedding() throws Exception { | ||
| assertNoAuthorizedEisEndpoints(); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -123,7 +123,7 @@ public void testAuthorizationTaskGetsRelocatedToAnotherNode_WhenTheNodeThatIsRun | |
| .stream() | ||
| .filter(endpoint -> endpoint.getService().equals(ElasticInferenceService.NAME)) | ||
| .toList(); | ||
| assertThat(eisEndpoints.size(), is(1)); | ||
| assertThat(eisEndpoints.size(), is(2)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above, let's remove these changes. |
||
|
|
||
| var rainbowSprinklesEndpoint = eisEndpoints.get(0); | ||
| assertThat(rainbowSprinklesEndpoint.getService(), is(ElasticInferenceService.NAME)); | ||
|
|
@@ -132,6 +132,14 @@ public void testAuthorizationTaskGetsRelocatedToAnotherNode_WhenTheNodeThatIsRun | |
| is(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1) | ||
| ); | ||
| assertThat(rainbowSprinklesEndpoint.getTaskType(), is(TaskType.CHAT_COMPLETION)); | ||
|
|
||
| var gpLlmV2Endpoint = eisEndpoints.get(1); | ||
| assertThat(gpLlmV2Endpoint.getService(), is(ElasticInferenceService.NAME)); | ||
| assertThat( | ||
| gpLlmV2Endpoint.getInferenceEntityId(), | ||
| is(InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2) | ||
| ); | ||
| assertThat(gpLlmV2Endpoint.getTaskType(), is(TaskType.CHAT_COMPLETION)); | ||
| }); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,6 +31,10 @@ public class InternalPreconfiguredEndpoints { | |||||||
| public static final String DEFAULT_CHAT_COMPLETION_MODEL_ID_V1 = "rainbow-sprinkles"; | ||||||||
| public static final String DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1 = ".rainbow-sprinkles-elastic"; | ||||||||
|
|
||||||||
| // gp-llm-v2 | ||||||||
| public static final String DEFAULT_CHAT_COMPLETION_MODEL_ID_V2 = "gp-llm-v2"; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I realize the convention here is How about we change this to be:
Suggested change
|
||||||||
| public static final String DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2 = ".gp-llm-v2"; | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the naming doc I've seen, I believe we want |
||||||||
|
|
||||||||
| // elser-2 | ||||||||
| public static final String DEFAULT_ELSER_2_MODEL_ID = "elser_model_2"; | ||||||||
| public static final String DEFAULT_ELSER_ENDPOINT_ID_V2 = ".elser-2-elastic"; | ||||||||
|
|
@@ -51,6 +55,8 @@ public record MinimalModel( | |||||||
|
|
||||||||
| private static final ElasticInferenceServiceCompletionServiceSettings COMPLETION_SERVICE_SETTINGS = | ||||||||
| new ElasticInferenceServiceCompletionServiceSettings(DEFAULT_CHAT_COMPLETION_MODEL_ID_V1); | ||||||||
| private static final ElasticInferenceServiceCompletionServiceSettings COMPLETION_SERVICE_SETTINGS_V2 = | ||||||||
| new ElasticInferenceServiceCompletionServiceSettings(DEFAULT_CHAT_COMPLETION_MODEL_ID_V2); | ||||||||
| private static final ElasticInferenceServiceSparseEmbeddingsServiceSettings SPARSE_EMBEDDINGS_SERVICE_SETTINGS = | ||||||||
| new ElasticInferenceServiceSparseEmbeddingsServiceSettings(DEFAULT_ELSER_2_MODEL_ID, null); | ||||||||
| private static final ElasticInferenceServiceDenseTextEmbeddingsServiceSettings DENSE_TEXT_EMBEDDINGS_SERVICE_SETTINGS = | ||||||||
|
|
@@ -75,6 +81,17 @@ public record MinimalModel( | |||||||
| ), | ||||||||
| COMPLETION_SERVICE_SETTINGS | ||||||||
| ), | ||||||||
| DEFAULT_CHAT_COMPLETION_MODEL_ID_V2, | ||||||||
| new MinimalModel( | ||||||||
| new ModelConfigurations( | ||||||||
| DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2, | ||||||||
| TaskType.CHAT_COMPLETION, | ||||||||
| ElasticInferenceService.NAME, | ||||||||
| COMPLETION_SERVICE_SETTINGS_V2, | ||||||||
| ChunkingSettingsBuilder.DEFAULT_SETTINGS | ||||||||
| ), | ||||||||
| COMPLETION_SERVICE_SETTINGS_V2 | ||||||||
| ), | ||||||||
| DEFAULT_ELSER_2_MODEL_ID, | ||||||||
| new MinimalModel( | ||||||||
| new ModelConfigurations( | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1064,7 +1064,7 @@ public void testSupportedTaskTypes_Returns_Unsupported() throws Exception { | |
| expectThrows(UnsupportedOperationException.class, service::supportedTaskTypes); | ||
| } | ||
| } | ||
|
|
||
| // Should we add another test for gp-llm-v2? | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Naa let's leave this as is. |
||
| public void testUnifiedCompletionError() { | ||
| var e = assertThrows(UnifiedChatCompletionException.class, () -> testUnifiedStream(404, """ | ||
| { | ||
|
|
||
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.
Naa, you can leave this as is.