ml-commons provides a set of common machine learning algorithms, e.g. k-means, or linear regression, to help developers build ML related features within OpenSearch.
Find a file
Isha Gupta 295eeb389f
Report empty model replies clearly in V2 agents, retrying once when it can help #5159 (#5187)
* Report empty model replies clearly in V2 agents

A reply with no text and no tool calls made conversational_v2 agents fail
with HTTP 500 "ModelProvider failed to parse message JSON", and a response
with a finish reason but no message failed with "failed to extract message
from response". Both now raise EmptyModelResponseException (HTTP 502) with
the provider's finish reason. A normal stop or no reason is retried once
without using a max_iteration step; any other reason fails at once, with a
hint for token limits, a full context window and blocked content. Adds
ModelProvider.extractFinishReason (non-abstract, default null), implemented
for OpenAI, Bedrock and Gemini (including promptFeedback.blockReason).

Resolves #5159

Signed-off-by: Isha Gupta <igupta24@apple.com>

* Say which empty replies are retried in isRetryable's Javadoc

A malformed reply is retried too, as the reason list above it says.

Signed-off-by: Isha Gupta <igupta24@apple.com>

---------

Signed-off-by: Isha Gupta <igupta24@apple.com>
2026-12-03 01:59:58 -08:00
.github Update ml-commons to use teams on maintainers access (#5237) 2026-11-13 14:19:57 -05:00
build-tools Update maven2 mirror repository url order (#4887) 2026-07-06 15:33:57 -07:00
client Add provisioned_by field to ML resources for adoption metrics attribution (#4754) 2026-05-26 14:24:33 -07:00
common Report empty model replies clearly in V2 agents, retrying once when it can help #5159 (#5187) 2026-12-03 01:59:58 -08:00
docs Add Amazon OpenSearch Serverless notes to Bedrock embedding blueprints (#5202) 2026-11-10 15:05:45 -08:00
gradle/wrapper Update Gradle to 9.4.1 and Jacoco to 0.8.14 (#4811) 2026-05-05 15:04:12 -07:00
grpc Add SPDX license header checker and missing headers (#4993) 2026-11-11 13:01:03 -08:00
memory Add SPDX license header checker and missing headers (#4993) 2026-11-11 13:01:03 -08:00
ml-algorithms Report empty model replies clearly in V2 agents, retrying once when it can help #5159 (#5187) 2026-12-03 01:59:58 -08:00
plugin test: wait for both registrations in MLModelAutoReDeployerIT (#5229) 2026-12-02 01:43:45 -08:00
release-notes Add release notes for 3.10.1 (#5275) (#5277) 2026-11-23 22:02:05 -05:00
scripts Update ml-commons build.sh to include publishPluginZipPublicationToMavenLocal for neural-search (#5004) 2026-09-08 18:47:49 -04:00
search-processors Add SPDX license header checker and missing headers (#4993) 2026-11-11 13:01:03 -08:00
spi Add ci.opensearch.org maven2 mirror to avoid throttling (ml-commons) (#4842) 2026-05-27 19:58:54 -04:00
.eclipseformat.xml Upgrade dependency version, apply spotless formatter, checkstyle and enable jacoco test coverage. (#39) 2021-11-15 19:16:40 -08:00
.gitignore [FEATURE] Semantic and Hybrid Search APIs for Long-Term Memory Retrieval (#4658) 2026-03-24 15:21:51 -07:00
.licenserc.json Add SPDX license header checker and missing headers (#4993) 2026-11-11 13:01:03 -08:00
.whitesource Add .whitesource configuration file (#611) 2022-12-05 16:09:08 -08:00
build.gradle Increment version to 3.11.0-SNAPSHOT (#5221) 2026-11-19 15:06:57 -08:00
CODE_OF_CONDUCT.md udpate the docs for opensearch project (#8) 2021-11-15 19:16:40 -08:00
CONTRIBUTING.md Update readme to add more information (#81) 2021-11-15 19:16:40 -08:00
DEVELOPER_GUIDE.md Add instructions to run OpenSearch from source code (#3512) 2025-02-24 12:18:35 -08:00
gradle.properties Add SPDX license header checker and missing headers (#4993) 2026-11-11 13:01:03 -08:00
gradlew Update JDK to 25 and Gradle to 9.2 (#4465) 2025-12-01 15:56:51 -08:00
gradlew.bat Update JDK to 25 and Gradle to 9.2 (#4465) 2025-12-01 15:56:51 -08:00
LICENSE Update readme to add more information (#81) 2021-11-15 19:16:40 -08:00
lombok.config Bumping gradle from 7.4 to 8.1 to unblock build pipeline (#892) 2023-05-16 18:09:50 -07:00
MAINTAINERS.md Add jiapingzeng as maintainer (#4910) 2026-07-20 18:12:18 -07:00
NOTICE.txt refactor NOTICE (#16) 2021-11-15 19:16:40 -08:00
README.md Replace the usage of elasticsearch with OpenSearch in README (#3876) 2025-05-27 14:57:42 -07:00
settings.gradle Add ci.opensearch.org/m2/ mirror for plugin resolution (ml-commons) (#4947) (#4949) 2026-07-31 17:42:18 -04:00
TRIAGING.md add triaging doc (#1250) 2023-09-01 14:15:53 -07:00

Test Workflow codecov Documentation Chat PRs welcome!

OpenSearch Machine Learning Commons

Machine Learning Commons for OpenSearch is a new solution that make it easy to develop new machine learning feature. It allows engineers to leverage existing opensource machine learning algorithms and reduce the efforts to build any new machine learning feature. It also removes the necessity from engineers to manage the machine learning tasks which will help to speed the feature developing process.

Problem Statement

Until today, the challenge is significant to build a new machine learning feature inside OpenSearch. The reasons include:

  • Disruption to OpenSearch Core features. Machine learning is very computationally intensive. But currently there is no way to add dedicated computation resources in OpenSearch for machine learning jobs, hence these jobs have to share same resources with Core features, such as: indexing and searching. That might cause the latency increasing on search request, and cause circuit breaker exception on memory usage. To address this, we have to carefully distribute models and limit the data size to run the AD job. When more and more ML features are added into OpenSearch, it will become much harder to manage.
  • Lack of support for machine learning algorithms. Customers need more algorithms within Opensearch, otherwise the data need be exported to outside of OpenSearch, such as s3 first to do the job, which will bring extra cost and latency.
  • Lack of resource management mechanism between multiple machine learning jobs. It's hard to coordinate the resources between multi features.

In the meanwhile, we observe more and more machine learning features required to be supported in OpenSearch to power end users’ business needs. For instance:

  • Forecasting: Forecasting is very popular in time series data analysis. Although the past data isn’t always an indicator for the future, it’s still very powerful tool used in some use cases, such as capacity planning to scale up/down the service hosts in IT operation.
  • Root Cause Analysis in DevOps: Today some customers use OpenSearch for IT operations. It becomes more and more complicated to identify the root cause of an outage or incident since it needs to gather all the information in the ecosystem, such as log, traces, metrics. Machine learning technique is a great fit to address this issue by building topology models of the system automatically, and understanding the similarity and casual relations between events, etc.
  • Machine Learning in SIEM: SIEM(Security Information and Event Management) is another domain in OpenSearch. Machine learning is also very useful in SIEM to help facilitate security analytics, and it can reduce the effort on sophisticated tasks, enable real time threat analysis and uncover anomalies.

Solution

The solution is to introduce a new Machine Learning library inside the OpenSearch cluster. The major functionalities in this solution include:

  • Unified Client Interfaces: clients can use common interfaces for training and inference tasks, and then follow the algorithm interface to give right input parameters, such as input data, hyperparameters. A client library will be built for easy use.
  • ML Plugin: ML plugin will help to initiate the ML nodes, and choose the right nodes and allocate the resources for each request, and manage machine learning tasks with monitoring and failure handing supports, and store the model results; it will be the bridge for the communication between OpenSearch process and ML engine.
  • ML Engine: This engine will be the host for ML algorithms. Java based machine learning algorithms will be supported in the first release.

This solution makes it easy to develop new machine learning features. It allows engineers to leverage existing open-source machine learning algorithms, and reduce the efforts to build any new machine learning feature. It also removes the necessity from engineers to manage the machine learning tasks which will help to speed up the feature developing process.

How to use it for new feature development

See How to add new function.

Contributing

See developer guide and how to contribute to this project.

Code of Conduct

This project has adopted the Amazon Open Source Code of Conduct. For more information see the Code of Conduct FAQ, or contact opensource-codeofconduct@amazon.com with any additional questions or comments.

Security

If you discover a potential security issue in this project we ask that you notify OpenSearch Security directly via email to security@opensearch.org. Please do not create a public GitHub issue.

License

This project is licensed under the Apache v2.0 License.

Copyright 2020-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.