Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ public void testGetDefaultEndpoints() throws IOException {
var allModels = getAllModels();
var chatCompletionModels = getModels("_all", TaskType.CHAT_COMPLETION);

assertThat(allModels, hasSize(7));
assertThat(chatCompletionModels, hasSize(1));
assertThat(allModels, hasSize(8));
assertThat(chatCompletionModels, hasSize(2));

for (var model : chatCompletionModels) {
assertEquals("chat_completion", model.get("task_type"));
}

assertInferenceIdTaskType(allModels, ".rainbow-sprinkles-elastic", TaskType.CHAT_COMPLETION);
assertInferenceIdTaskType(allModels, ".gp-llm-v2", TaskType.CHAT_COMPLETION);
assertInferenceIdTaskType(allModels, ".elser-2-elastic", TaskType.SPARSE_EMBEDDING);
assertInferenceIdTaskType(allModels, ".jina-embeddings-v3", TaskType.TEXT_EMBEDDING);
assertInferenceIdTaskType(allModels, ".elastic-rerank-v1", TaskType.RERANK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public void enqueueAuthorizeAllModelsResponse() {
"model_name": "rainbow-sprinkles",
"task_types": ["chat"]
},
{
"model_name": "gp-llm-v2",
"task_types": ["chat"]
},
{
"model_name": "elser_model_2",
"task_types": ["embed/text/sparse"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class AuthorizationTaskExecutorIT extends ESSingleNodeTestCase {
]
}
""";

// Should we add gp-llm-v2 to the response?
Copy link
Contributor

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.

public static final String AUTHORIZED_RAINBOW_SPRINKLES_RESPONSE = """
{
"models": [
Expand Down Expand Up @@ -203,20 +203,30 @@ public void testCreatesEisChatCompletion_DoesNotRemoveEndpointWhenNoLongerAuthor

private void assertChatCompletionEndpointExists() {
var eisEndpoints = getEisEndpoints();
assertThat(eisEndpoints.size(), is(1));
assertThat(eisEndpoints.size(), is(2));
Copy link
Contributor

Choose a reason for hiding this comment

The 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The 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));
Expand All @@ -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));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize the convention here is DEFAULT_..., I think that's going to get confusing now that we'll have multiple of them.

How about we change this to be:

Suggested change
public static final String DEFAULT_CHAT_COMPLETION_MODEL_ID_V2 = "gp-llm-v2";
public static final String GP_LLM_V2 = "gp-llm-v2";
public static final String GP_LLM_V2_ENDPOINT_ID = ".gp-llm-v2";

public static final String DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2 = ".gp-llm-v2";
Copy link
Contributor

Choose a reason for hiding this comment

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

Based on the naming doc I've seen, I believe we want .gp-llm-v2-chat_completion


// 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";
Expand All @@ -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 =
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Copy link
Contributor

Choose a reason for hiding this comment

The 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, """
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_MODEL_ID_V1;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_CHAT_COMPLETION_MODEL_ID_V2;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_ELSER_2_MODEL_ID;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_ELSER_ENDPOINT_ID_V2;
import static org.elasticsearch.xpack.inference.services.elastic.InternalPreconfiguredEndpoints.DEFAULT_MULTILINGUAL_EMBED_ENDPOINT_ID;
Expand All @@ -45,6 +47,8 @@ public class PreconfiguredEndpointModelAdapterTests extends ESTestCase {
new ElasticInferenceServiceSparseEmbeddingsServiceSettings(DEFAULT_ELSER_2_MODEL_ID, null);
private static final ElasticInferenceServiceCompletionServiceSettings COMPLETION_SETTINGS =
new ElasticInferenceServiceCompletionServiceSettings(DEFAULT_CHAT_COMPLETION_MODEL_ID_V1);
private static final ElasticInferenceServiceCompletionServiceSettings COMPLETION_SETTINGS_V2 =
new ElasticInferenceServiceCompletionServiceSettings(DEFAULT_CHAT_COMPLETION_MODEL_ID_V2);
private static final ElasticInferenceServiceDenseTextEmbeddingsServiceSettings DENSE_SETTINGS =
new ElasticInferenceServiceDenseTextEmbeddingsServiceSettings(
DEFAULT_MULTILINGUAL_EMBED_MODEL_ID,
Expand All @@ -60,6 +64,7 @@ public class PreconfiguredEndpointModelAdapterTests extends ESTestCase {
public void testGetModelsWithValidId() {
var endpointIds = Set.of(
DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V1,
DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2,
DEFAULT_ELSER_ENDPOINT_ID_V2,
DEFAULT_RERANK_ENDPOINT_ID_V1,
DEFAULT_MULTILINGUAL_EMBED_ENDPOINT_ID
Expand Down Expand Up @@ -94,6 +99,18 @@ public void testGetModelsWithValidId() {
COMPLETION_SETTINGS,
EIS_COMPONENTS
),
new ElasticInferenceServiceModel(
new ModelConfigurations(
DEFAULT_CHAT_COMPLETION_ENDPOINT_ID_V2,
TaskType.CHAT_COMPLETION,
ElasticInferenceService.NAME,
COMPLETION_SETTINGS_V2,
ChunkingSettingsBuilder.DEFAULT_SETTINGS
),
new ModelSecrets(EmptySecretSettings.INSTANCE),
COMPLETION_SETTINGS_V2,
EIS_COMPONENTS
),
new ElasticInferenceServiceModel(
new ModelConfigurations(
DEFAULT_MULTILINGUAL_EMBED_ENDPOINT_ID,
Expand Down