forked from opensearch-project/flow-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding additional default use cases (opensearch-project#731)
* adding pretrained model templates Signed-off-by: Amit Galitzky <[email protected]> * adding reindex Signed-off-by: Amit Galitzky <[email protected]> * changing file structure for bwc Signed-off-by: Amit Galitzky <[email protected]> --------- Signed-off-by: Amit Galitzky <[email protected]>
- Loading branch information
1 parent
9e0fc98
commit 498581c
Showing
24 changed files
with
631 additions
and
45 deletions.
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
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
23 changes: 23 additions & 0 deletions
23
src/main/resources/defaults/hybrid-search-with-local-model-defaults.json
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 @@ | ||
{ | ||
"template.name": "hybrid-search", | ||
"template.description": "Setting up hybrid search, ingest pipeline and index", | ||
"register_local_pretrained_model.name": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", | ||
"register_local_pretrained_model.description": "This is a sentence transformer model", | ||
"register_local_pretrained_model.model_format": "TORCH_SCRIPT", | ||
"register_local_pretrained_model.deploy": "true", | ||
"register_local_pretrained_model.version": "1.0.1", | ||
"create_ingest_pipeline.pipeline_id": "nlp-ingest-pipeline", | ||
"create_ingest_pipeline.description": "A text embedding pipeline", | ||
"create_ingest_pipeline.model_id": "123", | ||
"text_embedding.field_map.input": "passage_text", | ||
"text_embedding.field_map.output": "passage_embedding", | ||
"create_index.name": "my-nlp-index", | ||
"create_index.settings.number_of_shards": "2", | ||
"create_index.mappings.method.engine": "lucene", | ||
"create_index.mappings.method.space_type": "l2", | ||
"create_index.mappings.method.name": "hnsw", | ||
"text_embedding.field_map.output.dimension": "768", | ||
"create_search_pipeline.pipeline_id": "nlp-search-pipeline", | ||
"normalization-processor.normalization.technique": "min_max", | ||
"normalization-processor.combination.technique": "arithmetic_mean" | ||
} |
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
20 changes: 20 additions & 0 deletions
20
src/main/resources/defaults/semantic-search-with-local-model-defaults.json
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,20 @@ | ||
{ | ||
"template.name": "semantic search with local pretrained model", | ||
"template.description": "Setting up semantic search, with a local pretrained embedding model", | ||
"register_local_pretrained_model.name": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", | ||
"register_local_pretrained_model.description": "This is a sentence transformer model", | ||
"register_local_pretrained_model.model_format": "TORCH_SCRIPT", | ||
"register_local_pretrained_model.deploy": "true", | ||
"register_local_pretrained_model.version": "1.0.1", | ||
"create_ingest_pipeline.pipeline_id": "nlp-ingest-pipeline", | ||
"create_ingest_pipeline.description": "A text embedding pipeline", | ||
"text_embedding.field_map.input": "passage_text", | ||
"text_embedding.field_map.output": "passage_embedding", | ||
"create_index.name": "my-nlp-index", | ||
"create_index.settings.number_of_shards": "2", | ||
"create_index.mappings.method.engine": "lucene", | ||
"create_index.mappings.method.space_type": "l2", | ||
"create_index.mappings.method.name": "hnsw", | ||
"text_embedding.field_map.output.dimension": "768", | ||
"create_search_pipeline.pipeline_id": "default_model_pipeline" | ||
} |
31 changes: 31 additions & 0 deletions
31
src/main/resources/defaults/semantic-search-with-reindex-defaults.json
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,31 @@ | ||
{ | ||
"template.name": "semantic search with cohere embedding", | ||
"template.description": "Setting up semantic search, with a Cohere embedding model", | ||
"create_connector.name": "cohere-embedding-connector", | ||
"create_connector.description": "The connector to Cohere's public embed API", | ||
"create_connector.protocol": "http", | ||
"create_connector.model": "embed-english-v3.0", | ||
"create_connector.input_type": "search_document", | ||
"create_connector.truncate": "end", | ||
"create_connector.credential.key": "123", | ||
"create_connector.actions.url": "https://api.cohere.ai/v1/embed", | ||
"create_connector.actions.request_body": "{ \"texts\": ${parameters.texts}, \"truncate\": \"${parameters.truncate}\", \"model\": \"${parameters.model}\", \"input_type\": \"${parameters.input_type}\" }", | ||
"create_connector.actions.pre_process_function": "connector.pre_process.cohere.embedding", | ||
"create_connector.actions.post_process_function": "connector.post_process.cohere.embedding", | ||
"register_remote_model.name": "Cohere english embed model", | ||
"register_remote_model.description": "cohere-embedding-model", | ||
"create_ingest_pipeline.pipeline_id": "nlp-ingest-pipeline", | ||
"create_ingest_pipeline.description": "A text embedding pipeline", | ||
"text_embedding.field_map.input": "passage_text", | ||
"text_embedding.field_map.output": "passage_embedding", | ||
"create_index.name": "my-nlp-index", | ||
"create_index.settings.number_of_shards": "2", | ||
"create_index.mappings.method.engine": "lucene", | ||
"create_index.mappings.method.space_type": "l2", | ||
"create_index.mappings.method.name": "hnsw", | ||
"text_embedding.field_map.output.dimension": "1024", | ||
"create_search_pipeline.pipeline_id": "default_model_pipeline", | ||
"reindex.source_index": "", | ||
"reindex.requests_per_second": "-1", | ||
"reindex.slices": "1" | ||
} |
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
109 changes: 109 additions & 0 deletions
109
src/main/resources/substitutionTemplates/hybrid-search-with-local-model-template.json
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,109 @@ | ||
{ | ||
"name": "${{template.name}}", | ||
"description": "${{template.description}}", | ||
"use_case": "HYBRID_SEARCH", | ||
"version": { | ||
"template": "1.0.0", | ||
"compatibility": [ | ||
"2.12.0", | ||
"3.0.0" | ||
] | ||
}, | ||
"workflows": { | ||
"provision": { | ||
"nodes": [ | ||
{ | ||
"id": "register_local_pretrained_model", | ||
"type": "register_local_pretrained_model", | ||
"user_inputs": { | ||
"name": "${{register_local_pretrained_model.name}}", | ||
"version": "${{register_local_pretrained_model.version}}", | ||
"description": "${{register_local_pretrained_model.description}}", | ||
"model_format": "${{register_local_pretrained_model.model_format}}", | ||
"deploy": true | ||
} | ||
}, | ||
{ | ||
"id": "create_ingest_pipeline", | ||
"type": "create_ingest_pipeline", | ||
"previous_node_inputs": { | ||
"register_local_pretrained_model": "model_id" | ||
}, | ||
"user_inputs": { | ||
"pipeline_id": "${{create_ingest_pipeline.pipeline_id}}", | ||
"configurations": { | ||
"description": "${{create_ingest_pipeline.description}}", | ||
"processors": [ | ||
{ | ||
"text_embedding": { | ||
"model_id": "${{register_local_pretrained_model.model_id}}", | ||
"field_map": { | ||
"${{text_embedding.field_map.input}}": "${{text_embedding.field_map.output}}" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "create_index", | ||
"type": "create_index", | ||
"previous_node_inputs": { | ||
"create_ingest_pipeline": "pipeline_id" | ||
}, | ||
"user_inputs": { | ||
"index_name": "${{create_index.name}}", | ||
"configurations": { | ||
"settings": { | ||
"index.knn": true, | ||
"default_pipeline": "${{create_ingest_pipeline.pipeline_id}}", | ||
"number_of_shards": "${{create_index.settings.number_of_shards}}", | ||
"index.search.default_pipeline": "${{create_search_pipeline.pipeline_id}}" | ||
}, | ||
"mappings": { | ||
"properties": { | ||
"${{text_embedding.field_map.output}}": { | ||
"type": "knn_vector", | ||
"dimension": "${{text_embedding.field_map.output.dimension}}", | ||
"method": { | ||
"engine": "${{create_index.mappings.method.engine}}", | ||
"space_type": "${{create_index.mappings.method.space_type}}", | ||
"name": "${{create_index.mappings.method.name}}", | ||
"parameters": {} | ||
} | ||
}, | ||
"${{text_embedding.field_map.input}}": { | ||
"type": "text" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
{ | ||
"id": "create_search_pipeline", | ||
"type": "create_search_pipeline", | ||
"user_inputs": { | ||
"pipeline_id": "${{create_search_pipeline.pipeline_id}}", | ||
"configurations": { | ||
"description": "Post processor for hybrid search", | ||
"phase_results_processors": [ | ||
{ | ||
"normalization-processor": { | ||
"normalization": { | ||
"technique": "${{normalization-processor.normalization.technique}}" | ||
}, | ||
"combination": { | ||
"technique": "${{normalization-processor.combination.technique}}" | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
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
Oops, something went wrong.