Skip to content

Commit c7722c0

Browse files
authored
Merge branch 'feature/3.4-release-prep' into ag-ui-support
Signed-off-by: Jiaping Zeng <[email protected]>
2 parents 01cfec3 + f0c6e15 commit c7722c0

File tree

195 files changed

+18346
-2701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

195 files changed

+18346
-2701
lines changed

common/src/main/java/org/opensearch/ml/common/CommonValue.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public class CommonValue {
2828
public static final String CREATE_TIME_FIELD = "create_time";
2929
public static final String LAST_UPDATE_TIME_FIELD = "last_update_time";
3030

31+
public static final String AGENTIC_MEMORY_THREAD_POOL = "opensearch_ml_agentic_memory";
32+
3133
public static final String BOX_TYPE_KEY = "box_type";
3234
// hot node
3335
public static String HOT_BOX_TYPE = "hot";
@@ -54,6 +56,7 @@ public class CommonValue {
5456
public static final String TASK_POLLING_JOB_INDEX = ".ml_commons_task_polling_job";
5557
public static final String MCP_SESSION_MANAGEMENT_INDEX = ".plugins-ml-mcp-session-management";
5658
public static final String MCP_TOOLS_INDEX = ".plugins-ml-mcp-tools";
59+
public static final String ML_CONTEXT_MANAGEMENT_TEMPLATES_INDEX = ".plugins-ml-context-management-templates";
5760
// index created in 3.1 to track all ml jobs created via job scheduler
5861
public static final String ML_JOBS_INDEX = ".plugins-ml-jobs";
5962
public static final Set<String> stopWordsIndices = ImmutableSet.of(".plugins-ml-stop-words");
@@ -76,6 +79,7 @@ public class CommonValue {
7679
public static final String ML_LONG_MEMORY_HISTORY_INDEX_MAPPING_PATH = "index-mappings/ml_memory_long_term_history.json";
7780
public static final String ML_MCP_SESSION_MANAGEMENT_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_session_management.json";
7881
public static final String ML_MCP_TOOLS_INDEX_MAPPING_PATH = "index-mappings/ml_mcp_tools.json";
82+
public static final String ML_CONTEXT_MANAGEMENT_TEMPLATES_INDEX_MAPPING_PATH = "index-mappings/ml_context_management_templates.json";
7983
public static final String ML_JOBS_INDEX_MAPPING_PATH = "index-mappings/ml_jobs.json";
8084
public static final String ML_INDEX_INSIGHT_CONFIG_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_config.json";
8185
public static final String ML_INDEX_INSIGHT_STORAGE_INDEX_MAPPING_PATH = "index-mappings/ml_index_insight_storage.json";
@@ -97,6 +101,7 @@ public class CommonValue {
97101
public static final Version VERSION_3_1_0 = Version.fromString("3.1.0");
98102
public static final Version VERSION_3_2_0 = Version.fromString("3.2.0");
99103
public static final Version VERSION_3_3_0 = Version.fromString("3.3.0");
104+
public static final Version VERSION_3_4_0 = Version.fromString("3.4.0");
100105

101106
// Connector Constants
102107
public static final String NAME_FIELD = "name";
@@ -113,6 +118,7 @@ public class CommonValue {
113118
public static final String CLIENT_CONFIG_FIELD = "client_config";
114119
public static final String URL_FIELD = "url";
115120
public static final String HEADERS_FIELD = "headers";
121+
public static final String CONNECTOR_ACTION_FIELD = "connector_action";
116122

117123
// MCP Constants
118124
public static final String MCP_TOOL_NAME_FIELD = "name";

common/src/main/java/org/opensearch/ml/common/MLAgentType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public static MLAgentType from(String value) {
2121
try {
2222
return MLAgentType.valueOf(value.toUpperCase(Locale.ROOT));
2323
} catch (Exception e) {
24-
throw new IllegalArgumentException("Wrong Agent type");
24+
throw new IllegalArgumentException(value + " is not a valid Agent Type");
2525
}
2626
}
2727
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package org.opensearch.ml.common;
7+
8+
import java.util.Locale;
9+
10+
public enum MLMemoryType {
11+
CONVERSATION_INDEX,
12+
AGENTIC_MEMORY,
13+
REMOTE_AGENTIC_MEMORY;
14+
15+
public static MLMemoryType from(String value) {
16+
if (value != null) {
17+
try {
18+
return MLMemoryType.valueOf(value.toUpperCase(Locale.ROOT));
19+
} catch (Exception e) {
20+
throw new IllegalArgumentException("Wrong Memory type");
21+
}
22+
}
23+
return null;
24+
}
25+
}

common/src/main/java/org/opensearch/ml/common/MLModel.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -882,14 +882,14 @@ public Tags getTags(Connector connector) {
882882
* - The service provider (e.g., bedrock, sagemaker, azure, etc.)
883883
* - The specific model being used
884884
* - The model type (e.g., llm, embedding, image_generation, speech_audio)
885-
*
885+
*
886886
* The method attempts to extract this information in the following order:
887887
* 1. From the predict action URL (for service provider and some model identifiers)
888888
* 2. From the request body JSON (for model name)
889889
* 3. From the connector parameters (as a fallback for model name)
890-
*
890+
*
891891
* If any information cannot be determined, it will be marked as "unknown" in the tags.
892-
*
892+
*
893893
* @param connector The connector associated with the remote model, containing the predict action configuration
894894
* @return Tags object containing deployment type, service provider, algorithm, model name, and model type
895895
* @throws RuntimeException if there are issues parsing the connector configuration
@@ -958,10 +958,10 @@ Tags getRemoteModelTags(Connector connector) {
958958
* - textract
959959
* - mistral
960960
* - x.ai
961-
*
961+
*
962962
* If no matching provider keyword is found in the URL,
963963
* returns "unknown" as the service provider.
964-
*
964+
*
965965
* @param url The URL to analyze for service provider identification
966966
* @return The identified service provider name, or "unknown" if not found
967967
*/
@@ -981,10 +981,10 @@ String identifyServiceProvider(String url) {
981981
* 1. For Bedrock models: Extracts model name from the URL path after '/model/'
982982
* 2. From request body JSON: Checks for 'model' or 'ModelName' fields
983983
* 3. From connector parameters: Uses the 'model' parameter if available
984-
*
984+
*
985985
* If the model name cannot be determined through any of these methods,
986986
* returns "unknown".
987-
*
987+
*
988988
* @param provider The service provider (e.g., bedrock, sagemaker, azure)
989989
* @param url The predict action URL from the connector
990990
* @param requestBody The JSON request body from the predict action
@@ -1041,10 +1041,10 @@ private static boolean containsAny(String target, List<String> keywords) {
10411041
* - Embedding: checks for keywords like "embedding", "embed", "ada", etc.
10421042
* - Image Generation: checks for keywords like "diffusion", "dall-e", "imagen", etc.
10431043
* - Speech/Audio: checks for keywords like "whisper", "audio", "speech", etc.
1044-
*
1044+
*
10451045
* If no matching keywords are found or if the model name is null/unknown,
10461046
* returns "unknown" as the model type.
1047-
*
1047+
*
10481048
* @param model The name of the model to identify
10491049
* @return The identified model type (llm, embedding, image_generation, speech_audio, or unknown)
10501050
*/
@@ -1079,14 +1079,14 @@ String identifyModelType(String model) {
10791079
* Generates tags for a pre-trained ML model based on its name and configuration.
10801080
* This method is specifically designed for models that follow the naming convention
10811081
* "provider/algorithm/model" (e.g., "amazon/bert/model-name" or "huggingface/bert/model-name").
1082-
*
1082+
*
10831083
* The method extracts the following information:
10841084
* - Service provider from the first part of the model name
10851085
* - Algorithm from the model's algorithm field
10861086
* - Model name from the third part of the model name
10871087
* - Model type from the model configuration (if available)
10881088
* - Model format from the model's format field (if available)
1089-
*
1089+
*
10901090
* @return Tags object containing deployment type (pre-trained), service provider,
10911091
* algorithm, model name, model type, and model format (if available)
10921092
*/
@@ -1117,11 +1117,11 @@ Tags getPreTrainedModelTags() {
11171117
* Generates tags for a custom ML model based on its configuration.
11181118
* This method is used for models that do not follow the pre-trained naming convention
11191119
* (e.g., "model-name" or "model-name/model-name").
1120-
*
1120+
*
11211121
* The method extracts the following information:
11221122
* - Model type from the model configuration (if available)
11231123
* - Model format from the model's format field (if available)
1124-
*
1124+
*
11251125
* @return Tags object containing deployment type (custom), algorithm, and model type (if available)
11261126
*/
11271127
@VisibleForTesting

0 commit comments

Comments
 (0)