-
Notifications
You must be signed in to change notification settings - Fork 481
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
[Blogpost] Configurable Automation for OpenSearch ML Use Cases #2698
Merged
nateynateynate
merged 11 commits into
opensearch-project:main
from
owaiskazi19:flow-framework
Apr 8, 2024
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
43ddfae
Added blogpost for Flow Framework
owaiskazi19 830a1a1
Blog rewrites
kolchfa-aws 8c9810a
Added additional team members
owaiskazi19 ed4c93d
Added release link
owaiskazi19 f935dd9
Apply suggestions from code review
kolchfa-aws cae7323
Addressed PR comments
owaiskazi19 296bc92
Minor comments
owaiskazi19 5dad660
Final editorial comments
kolchfa-aws 939f428
Merge branch 'opensearch-project:main' into flow-framework
owaiskazi19 bcd469b
Change date
kolchfa-aws 0de3cff
Merge branch 'flow-framework' of https://github.com/owaiskazi19/proje…
kolchfa-aws 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 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 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 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,23 @@ | ||
--- | ||
name: Josh Palis | ||
short_name: jpalis | ||
photo: '/assets/media/community/members/jpalis.jpg' | ||
title: 'OpenSearch Community Member: Josh Palis' | ||
primary_title: Josh Palis | ||
breadcrumbs: | ||
icon: community | ||
items: | ||
- title: Community | ||
url: /community/index.html | ||
- title: Members | ||
url: /community/members/index.html | ||
- title: 'Josh Palis's Profile' | ||
url: '/community/members/josh-palis.html' | ||
github: joshpalis | ||
job_title_and_company: 'Software engineer at Amazon Web Services' | ||
personas: | ||
- author | ||
permalink: '/community/members/josh-palis.html' | ||
--- | ||
|
||
**Josh Palis** is a software engineer at Amazon Web Services focusing mostly on the OpenSearch Flow Framework plugin. | ||
Check failure on line 23 in _community_members/jpalis.md GitHub Actions / style-job
|
This file contains 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
127 changes: 127 additions & 0 deletions
127
_posts/2024-04-05-Configurable-Automation-for-OpenSearch-ML-Use-Cases.md
This file contains 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,127 @@ | ||
--- | ||
layout: post | ||
title: "Configurable automation for OpenSearch ML use cases" | ||
authors: | ||
- kazabdu | ||
- amitgalitz | ||
- dwiddis | ||
- jpalis | ||
- hnyng | ||
- ohltyler | ||
- minalsha | ||
date: 2024-04-08 | ||
categories: | ||
- technical-posts | ||
meta_keywords: Flow Framework, OpenSearch plugins, Machine Learning | ||
meta_description: Explore the simplicity of integrating Machine Learning capabilities within OpenSearch through an innovative and groundbreaking framework designed to simplify complex setup tasks. | ||
--- | ||
|
||
In OpenSearch, to use machine learning (ML) offerings, such as semantic, hybrid, and multimodal search, you often have to grapple with complex setup and preprocessing tasks. Additionally, you must write verbose queries, which can be a time-consuming and error-prone process. | ||
|
||
In this blog post, we introduce the OpenSearch Flow Framework plugin, [released in version 2.13](https://opensearch.org/blog/2.13-is-ready-for-download/) and designed to streamline this cumbersome process. By using this plugin, you can simplify complex setups with just one simple API call. We've provided automated templates, enabling you to create connectors, register models, deploy them, and register agents and tools through a single API call. This eliminates the complexity of calling multiple APIs and orchestrating setups based on the responses. | ||
|
||
## Before the Flow Framework plugin | ||
|
||
Previously, setting up semantic search involves *four separate API calls*, outlined in the [semantic search documentation](https://opensearch.org/docs/latest/search-plugins/semantic-search/): | ||
|
||
1. Create a connector for a remote model, specifying pre- and post-processing functions. | ||
2. Register an embedding model using the connector ID obtained in the previous step. | ||
3. Configure an ingest pipeline to generate vector embeddings using the model ID of the registered model. | ||
4. Create a k-NN index and add the pipeline created in the previous step. | ||
|
||
This complex setup required you to be familiar with the OpenSearch ML Commons APIs. However, we are simplifying this experience through the Flow Framework plugin. Let's demonstrate how the plugin simplifies this process using the preceding semantic search example. | ||
|
||
## With the Flow Framework plugin | ||
|
||
In this example, you will configure the `semantic_search_with_cohere_embedding_query_enricher` workflow template. The workflow created using this template performs the following configuration steps: | ||
|
||
* Deploys an externally hosted Cohere model | ||
* Creates an ingest pipeline using the model | ||
* Creates a sample k-NN index and configures a search pipeline to define the default model ID for that index | ||
|
||
### Step 1: Create and provision the workflow | ||
|
||
Using the `semantic_search_with_cohere_embedding_query_enricher` workflow template, you provision the workflow with just one required field---the API key for the Cohere Embed model: | ||
|
||
```json | ||
POST /_plugins/_flow_framework/workflow?use_case=semantic_search_with_cohere_embedding_query_enricher&provision=true | ||
{ | ||
"create_connector.credential.key" : "<YOUR API KEY>" | ||
} | ||
``` | ||
|
||
OpenSearch responds with a unique workflow ID, simplifying the tracking and management of the setup process: | ||
|
||
```json | ||
{ | ||
"workflow_id" : "8xL8bowB8y25Tqfenm50" | ||
} | ||
``` | ||
|
||
Note: The workflow in the previous step creates a default k-NN index. The default index name is `my-nlp-index`. | ||
|
||
You can customize the template default values by providing the new values in the request body. For a comprehensive list of default parameter values for this workflow template, see [Cohere Embed semantic search defaults](https://github.com/opensearch-project/flow-framework/blob/2.13/src/main/resources/defaults/cohere-embedding-semantic-search-defaults.json). | ||
|
||
### Step 2: Ingest documents into the index | ||
|
||
Once the workflow is provisioned, you can ingest documents into the index created by the workflow: | ||
|
||
```json | ||
POST /my-nlp-index/_doc | ||
{ | ||
"passage_text": "Hello world", | ||
"id": "s1" | ||
} | ||
``` | ||
|
||
### Step 3: Perform vector search | ||
|
||
Performing a vector search on the index is equally straightforward. Using a neural query clause, you can easily retrieve relevant results: | ||
|
||
```json | ||
GET /my-nlp-index/_search | ||
{ | ||
"_source": { | ||
"excludes": [ | ||
"passage_embedding" | ||
] | ||
}, | ||
"query": { | ||
"neural": { | ||
"passage_embedding": { | ||
"query_text": "Hi world", | ||
"k": 10 | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
With the Flow Framework plugin, we've simplified this complex setup process, enabling you to focus on your tasks without the burden of navigating complex APIs. Our goal is for you to use OpenSearch seamlessly, uncovering new possibilities in your projects. | ||
|
||
## Viewing workflow resources | ||
|
||
The workflow you created provisioned all the necessary resources for semantic search. To view the provisioned resources, call the Get Workflow Status API and provide the `workflowID` for your workflow: | ||
|
||
``` | ||
GET /_plugins/_flow_framework/workflow/8xL8bowB8y25Tqfenm50/_status | ||
``` | ||
|
||
## Additional default use cases | ||
|
||
You can explore more default use cases by viewing [substitution templates](https://github.com/opensearch-project/flow-framework/tree/2.13/src/main/resources/substitutionTemplates) and their corresponding [defaults](https://github.com/opensearch-project/flow-framework/tree/2.13/src/main/resources/defaults). | ||
|
||
## Creating custom use cases | ||
|
||
You can tailor templates according to your requirements. For more information, see [these sample templates](https://github.com/opensearch-project/flow-framework/tree/main/sample-templates) and the [Automating configurations](https://opensearch.org/docs/latest/automating-configurations/index/) documentation. | ||
|
||
## Next steps | ||
|
||
In our ongoing efforts to enhance the user experience and streamline the process of provisioning OpenSearch ML offerings, we have some exciting plans on our roadmap. We aim to develop a user-friendly drag-and-drop frontend interface. This interface will simplify the complex steps involved in provisioning ML features, thereby allowing you to seamlessly configure and deploy your workflows. Stay tuned for updates on this exciting development! | ||
|
||
If you have any comments or suggestions, you can comment on the following RFCs: | ||
|
||
- [Backend RFC](https://github.com/opensearch-project/OpenSearch/issues/9213) | ||
- [Frontend RFC](https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4755) | ||
- [Flow Framework GitHub repository](https://github.com/opensearch-project/flow-framework) | ||
- [Flow Framework Dashboards GitHub repository](https://github.com/opensearch-project/dashboards-flow-framework) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
This sentence has a lot of commas. I tried to rewrite it to make it better but couldn't really do much better. So I guess it's fine as is! :|
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.
@kolchfa-aws any inputs here?