diff --git a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java index ba9f9f499..28ca9e0b8 100644 --- a/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java +++ b/src/test/java/org/opensearch/flowframework/rest/FlowFrameworkRestApiIT.java @@ -365,7 +365,7 @@ public void testCreateAndProvisionAgentFrameworkWorkflow() throws Exception { public void testReprovisionWorkflow() throws Exception { // Begin with a template to register a local pretrained model - Template template = TestHelpers.createTemplateFromFile("registerlocalmodel.json"); + Template template = TestHelpers.createTemplateFromFile("registerremotemodel.json"); // Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter Response response; @@ -387,23 +387,26 @@ public void testReprovisionWorkflow() throws Exception { // Wait until provisioning has completed successfully before attempting to retrieve created resources List resourcesCreated = getResourcesCreated(client(), workflowId, 30); - assertEquals(2, resourcesCreated.size()); - assertEquals("register_local_pretrained_model", resourcesCreated.get(0).workflowStepName()); + assertEquals(3, resourcesCreated.size()); + List resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); + assertTrue(resourceIds.contains("create_connector")); + assertTrue(resourceIds.contains("register_remote_model")); // Reprovision template to add ingest pipeline which uses the model ID - template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline.json"); + template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline.json"); response = reprovisionWorkflow(client(), workflowId, template); assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 10); - assertEquals(3, resourcesCreated.size()); - List resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); - assertTrue(resourceIds.contains("register_local_pretrained_model")); + assertEquals(4, resourcesCreated.size()); + resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); + assertTrue(resourceIds.contains("create_connector")); + assertTrue(resourceIds.contains("register_remote_model")); assertTrue(resourceIds.contains("create_ingest_pipeline")); // Retrieve pipeline by ID to ensure model ID is set correctly String modelId = resourcesCreated.stream() - .filter(x -> x.workflowStepName().equals("register_local_pretrained_model")) + .filter(x -> x.workflowStepName().equals("register_remote_model")) .findFirst() .get() .resourceId(); @@ -417,14 +420,15 @@ public void testReprovisionWorkflow() throws Exception { assertTrue(getPipelineResponse.pipelines().get(0).getConfigAsMap().toString().contains(modelId)); // Reprovision template to add index which uses default ingest pipeline - template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline-createindex.json"); + template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); response = reprovisionWorkflow(client(), workflowId, template); assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 10); - assertEquals(4, resourcesCreated.size()); + assertEquals(5, resourcesCreated.size()); resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); - assertTrue(resourceIds.contains("register_local_pretrained_model")); + assertTrue(resourceIds.contains("create_connector")); + assertTrue(resourceIds.contains("register_remote_model")); assertTrue(resourceIds.contains("create_ingest_pipeline")); assertTrue(resourceIds.contains("create_index")); @@ -438,13 +442,13 @@ public void testReprovisionWorkflow() throws Exception { assertEquals(pipelineId, indexSettings.get("index.default_pipeline")); // Reprovision template to remove default ingest pipeline - template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline-updateindex.json"); + template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-updateindex.json"); response = reprovisionWorkflow(client(), workflowId, template); assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 10); // resource count should remain unchanged when updating an existing node - assertEquals(4, resourcesCreated.size()); + assertEquals(5, resourcesCreated.size()); // Retrieve index settings to ensure default pipeline has been updated correctly indexSettings = getIndexSettingsAsMap(indexName); @@ -466,7 +470,7 @@ public void testReprovisionWorkflow() throws Exception { public void testReprovisionWorkflowMidNodeAddition() throws Exception { // Begin with a template to register a local pretrained model and create an index, no edges - Template template = TestHelpers.createTemplateFromFile("registerlocalmodel-createindex.json"); + Template template = TestHelpers.createTemplateFromFile("registerremotemodel-createindex.json"); // Hit Create Workflow API to create agent-framework template, with template validation check and provision parameter Response response; @@ -488,26 +492,28 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception { // Wait until provisioning has completed successfully before attempting to retrieve created resources List resourcesCreated = getResourcesCreated(client(), workflowId, 30); - assertEquals(3, resourcesCreated.size()); + assertEquals(4, resourcesCreated.size()); List resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); - assertTrue(resourceIds.contains("register_local_pretrained_model")); + assertTrue(resourceIds.contains("create_connector")); + assertTrue(resourceIds.contains("register_remote_model")); assertTrue(resourceIds.contains("create_index")); // Reprovision template to add ingest pipeline which uses the model ID - template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline-createindex.json"); + template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); response = reprovisionWorkflow(client(), workflowId, template); assertEquals(RestStatus.CREATED, TestHelpers.restStatus(response)); resourcesCreated = getResourcesCreated(client(), workflowId, 10); - assertEquals(4, resourcesCreated.size()); + assertEquals(5, resourcesCreated.size()); resourceIds = resourcesCreated.stream().map(x -> x.workflowStepName()).collect(Collectors.toList()); - assertTrue(resourceIds.contains("register_local_pretrained_model")); + assertTrue(resourceIds.contains("create_connector")); + assertTrue(resourceIds.contains("register_remote_model")); assertTrue(resourceIds.contains("create_ingest_pipeline")); assertTrue(resourceIds.contains("create_index")); // Ensure ingest pipeline configuration contains the model id and index settings have the ingest pipeline as default String modelId = resourcesCreated.stream() - .filter(x -> x.workflowStepName().equals("register_local_pretrained_model")) + .filter(x -> x.workflowStepName().equals("register_remote_model")) .findFirst() .get() .resourceId(); @@ -543,7 +549,7 @@ public void testReprovisionWorkflowMidNodeAddition() throws Exception { } public void testReprovisionWithNoChange() throws Exception { - Template template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline-createindex.json"); + Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); Response response; if (!indexExistsWithAdminClient(".plugins-ml-config")) { @@ -586,7 +592,7 @@ public void testReprovisionWithNoChange() throws Exception { } public void testReprovisionWithDeletion() throws Exception { - Template template = TestHelpers.createTemplateFromFile("registerlocalmodel-ingestpipeline-createindex.json"); + Template template = TestHelpers.createTemplateFromFile("registerremotemodel-ingestpipeline-createindex.json"); Response response; if (!indexExistsWithAdminClient(".plugins-ml-config")) { @@ -606,7 +612,7 @@ public void testReprovisionWithDeletion() throws Exception { ); // Attempt to reprovision template without ingest pipeline node - Template templateWithoutIngestPipeline = TestHelpers.createTemplateFromFile("registerlocalmodel-createindex.json"); + Template templateWithoutIngestPipeline = TestHelpers.createTemplateFromFile("registerremotemodel-createindex.json"); ResponseException exception = expectThrows( ResponseException.class, () -> reprovisionWorkflow(client(), workflowId, templateWithoutIngestPipeline) diff --git a/src/test/resources/template/registerlocalmodel-createindex.json b/src/test/resources/template/registerlocalmodel-createindex.json deleted file mode 100644 index 8dad29432..000000000 --- a/src/test/resources/template/registerlocalmodel-createindex.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "semantic search with local pretrained model", - "description": "Setting up semantic search, with a local pretrained embedding model", - "use_case": "SEMANTIC_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": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", - "version": "1.0.1", - "description": "This is a sentence transformer model", - "model_format": "TORCH_SCRIPT", - "deploy": true - } - }, - { - "id": "create_index", - "type": "create_index", - "user_inputs": { - "index_name": "my-nlp-index", - "configurations": { - "settings": { - "index.knn": true, - "index.number_of_shards": "2" - }, - "mappings": { - "properties": { - "passage_embedding": { - "type": "knn_vector", - "dimension": "768", - "method": { - "engine": "lucene", - "space_type": "l2", - "name": "hnsw", - "parameters": {} - } - }, - "passage_text": { - "type": "text" - } - } - } - } - } - } - ] - } - } - } diff --git a/src/test/resources/template/registerlocalmodel-ingestpipeline-createindex.json b/src/test/resources/template/registerlocalmodel-ingestpipeline-createindex.json deleted file mode 100644 index b60da54a2..000000000 --- a/src/test/resources/template/registerlocalmodel-ingestpipeline-createindex.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "semantic search with local pretrained model", - "description": "Setting up semantic search, with a local pretrained embedding model", - "use_case": "SEMANTIC_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": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", - "version": "1.0.1", - "description": "This is a sentence transformer model", - "model_format": "TORCH_SCRIPT", - "deploy": true - } - }, - { - "id": "create_ingest_pipeline", - "type": "create_ingest_pipeline", - "previous_node_inputs": { - "register_local_pretrained_model": "model_id" - }, - "user_inputs": { - "pipeline_id": "nlp-ingest-pipeline", - "configurations": { - "description": "A text embedding pipeline", - "processors": [ - { - "text_embedding": { - "model_id": "${{register_local_pretrained_model.model_id}}", - "field_map": { - "passage_text": "passage_embedding" - } - } - } - ] - } - } - }, - { - "id": "create_index", - "type": "create_index", - "previous_node_inputs": { - "create_ingest_pipeline": "pipeline_id" - }, - "user_inputs": { - "index_name": "my-nlp-index", - "configurations": { - "settings": { - "index.knn": true, - "default_pipeline": "${{create_ingest_pipeline.pipeline_id}}", - "index.number_of_shards": "2" - }, - "mappings": { - "properties": { - "passage_embedding": { - "type": "knn_vector", - "dimension": "768", - "method": { - "engine": "lucene", - "space_type": "l2", - "name": "hnsw", - "parameters": {} - } - }, - "passage_text": { - "type": "text" - } - } - } - } - } - } - ] - } - } - } diff --git a/src/test/resources/template/registerlocalmodel-ingestpipeline.json b/src/test/resources/template/registerlocalmodel-ingestpipeline.json deleted file mode 100644 index a4ceab116..000000000 --- a/src/test/resources/template/registerlocalmodel-ingestpipeline.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "semantic search with local pretrained model", - "description": "Setting up semantic search, with a local pretrained embedding model", - "use_case": "SEMANTIC_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": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", - "version": "1.0.1", - "description": "This is a sentence transformer model", - "model_format": "TORCH_SCRIPT", - "deploy": true - } - }, - { - "id": "create_ingest_pipeline", - "type": "create_ingest_pipeline", - "previous_node_inputs": { - "register_local_pretrained_model": "model_id" - }, - "user_inputs": { - "pipeline_id": "nlp-ingest-pipeline", - "configurations": { - "description": "A text embedding pipeline", - "processors": [ - { - "text_embedding": { - "model_id": "${{register_local_pretrained_model.model_id}}", - "field_map": { - "passage_text": "passage_embedding" - } - } - } - ] - } - } - } - ] - } - } - } diff --git a/src/test/resources/template/registerlocalmodel.json b/src/test/resources/template/registerlocalmodel.json deleted file mode 100644 index 8394f76ab..000000000 --- a/src/test/resources/template/registerlocalmodel.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "semantic search with local pretrained model", - "description": "Setting up semantic search, with a local pretrained embedding model", - "use_case": "SEMANTIC_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": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", - "version": "1.0.1", - "description": "This is a sentence transformer model", - "model_format": "TORCH_SCRIPT", - "deploy": true - } - } - ] - } - } - } diff --git a/src/test/resources/template/registerlocalmodel-ingestpipeline-updateindex.json b/src/test/resources/template/registerremotemodel-createindex.json similarity index 57% rename from src/test/resources/template/registerlocalmodel-ingestpipeline-updateindex.json rename to src/test/resources/template/registerremotemodel-createindex.json index 5303af938..3005eeed1 100644 --- a/src/test/resources/template/registerlocalmodel-ingestpipeline-updateindex.json +++ b/src/test/resources/template/registerremotemodel-createindex.json @@ -13,51 +13,49 @@ "provision": { "nodes": [ { - "id": "register_local_pretrained_model", - "type": "register_local_pretrained_model", + "id": "create_openai_connector", + "type": "create_connector", "user_inputs": { - "name": "huggingface/sentence-transformers/paraphrase-MiniLM-L3-v2", - "version": "1.0.1", - "description": "This is a sentence transformer model", - "model_format": "TORCH_SCRIPT", - "deploy": true + "name": "OpenAI Chat Connector", + "description": "The connector to public OpenAI model service for text embedding model", + "version": "1", + "protocol": "http", + "parameters": { + "endpoint": "api.openai.com", + "model": "gpt-3.5-turbo", + "response_filter": "$.choices[0].message.content" + }, + "credential": { + "openAI_key": "12345" + }, + "actions": [ + { + "action_type": "predict", + "method": "POST", + "url": "https://${parameters.endpoint}/v1/chat/completions" + } + ] } }, { - "id": "create_ingest_pipeline", - "type": "create_ingest_pipeline", + "id": "register_openai_model", + "type": "register_remote_model", "previous_node_inputs": { - "register_local_pretrained_model": "model_id" + "create_openai_connector": "connector_id" }, "user_inputs": { - "pipeline_id": "nlp-ingest-pipeline", - "configurations": { - "description": "A text embedding pipeline", - "processors": [ - { - "text_embedding": { - "model_id": "${{register_local_pretrained_model.model_id}}", - "field_map": { - "passage_text": "passage_embedding" - } - } - } - ] - } + "name": "openAI-gpt-3.5-turbo", + "deploy": true } }, { "id": "create_index", "type": "create_index", - "previous_node_inputs": { - "create_ingest_pipeline": "pipeline_id" - }, "user_inputs": { "index_name": "my-nlp-index", "configurations": { "settings": { "index.knn": true, - "default_pipeline": "_none", "index.number_of_shards": "2" }, "mappings": { diff --git a/src/test/resources/template/registerremotemodel-ingestpipeline-createindex.json b/src/test/resources/template/registerremotemodel-ingestpipeline-createindex.json new file mode 100644 index 000000000..767da07b6 --- /dev/null +++ b/src/test/resources/template/registerremotemodel-ingestpipeline-createindex.json @@ -0,0 +1,111 @@ +{ + "name": "semantic search with local pretrained model", + "description": "Setting up semantic search, with a local pretrained embedding model", + "use_case": "SEMANTIC_SEARCH", + "version": { + "template": "1.0.0", + "compatibility": [ + "2.12.0", + "3.0.0" + ] + }, + "workflows": { + "provision": { + "nodes": [ + { + "id": "create_openai_connector", + "type": "create_connector", + "user_inputs": { + "name": "OpenAI Chat Connector", + "description": "The connector to public OpenAI model service for text embedding model", + "version": "1", + "protocol": "http", + "parameters": { + "endpoint": "api.openai.com", + "model": "gpt-3.5-turbo", + "response_filter": "$.choices[0].message.content" + }, + "credential": { + "openAI_key": "12345" + }, + "actions": [ + { + "action_type": "predict", + "method": "POST", + "url": "https://${parameters.endpoint}/v1/chat/completions" + } + ] + } + }, + { + "id": "register_openai_model", + "type": "register_remote_model", + "previous_node_inputs": { + "create_openai_connector": "connector_id" + }, + "user_inputs": { + "name": "openAI-gpt-3.5-turbo", + "deploy": true + } + }, + { + "id": "create_ingest_pipeline", + "type": "create_ingest_pipeline", + "previous_node_inputs": { + "register_openai_model": "model_id" + }, + "user_inputs": { + "pipeline_id": "nlp-ingest-pipeline", + "configurations": { + "description": "A text embedding pipeline", + "processors": [ + { + "text_embedding": { + "model_id": "${{register_openai_model.model_id}}", + "field_map": { + "passage_text": "passage_embedding" + } + } + } + ] + } + } + }, + { + "id": "create_index", + "type": "create_index", + "previous_node_inputs": { + "create_ingest_pipeline": "pipeline_id" + }, + "user_inputs": { + "index_name": "my-nlp-index", + "configurations": { + "settings": { + "index.knn": true, + "default_pipeline": "${{create_ingest_pipeline.pipeline_id}}", + "index.number_of_shards": "2" + }, + "mappings": { + "properties": { + "passage_embedding": { + "type": "knn_vector", + "dimension": "768", + "method": { + "engine": "lucene", + "space_type": "l2", + "name": "hnsw", + "parameters": {} + } + }, + "passage_text": { + "type": "text" + } + } + } + } + } + } + ] + } + } +} diff --git a/src/test/resources/template/registerremotemodel-ingestpipeline-updateindex.json b/src/test/resources/template/registerremotemodel-ingestpipeline-updateindex.json new file mode 100644 index 000000000..fc873ae66 --- /dev/null +++ b/src/test/resources/template/registerremotemodel-ingestpipeline-updateindex.json @@ -0,0 +1,111 @@ +{ + "name": "semantic search with local pretrained model", + "description": "Setting up semantic search, with a local pretrained embedding model", + "use_case": "SEMANTIC_SEARCH", + "version": { + "template": "1.0.0", + "compatibility": [ + "2.12.0", + "3.0.0" + ] + }, + "workflows": { + "provision": { + "nodes": [ + { + "id": "create_openai_connector", + "type": "create_connector", + "user_inputs": { + "name": "OpenAI Chat Connector", + "description": "The connector to public OpenAI model service for text embedding model", + "version": "1", + "protocol": "http", + "parameters": { + "endpoint": "api.openai.com", + "model": "gpt-3.5-turbo", + "response_filter": "$.choices[0].message.content" + }, + "credential": { + "openAI_key": "12345" + }, + "actions": [ + { + "action_type": "predict", + "method": "POST", + "url": "https://${parameters.endpoint}/v1/chat/completions" + } + ] + } + }, + { + "id": "register_openai_model", + "type": "register_remote_model", + "previous_node_inputs": { + "create_openai_connector": "connector_id" + }, + "user_inputs": { + "name": "openAI-gpt-3.5-turbo", + "deploy": true + } + }, + { + "id": "create_ingest_pipeline", + "type": "create_ingest_pipeline", + "previous_node_inputs": { + "register_openai_model": "model_id" + }, + "user_inputs": { + "pipeline_id": "nlp-ingest-pipeline", + "configurations": { + "description": "A text embedding pipeline", + "processors": [ + { + "text_embedding": { + "model_id": "${{register_openai_model.model_id}}", + "field_map": { + "passage_text": "passage_embedding" + } + } + } + ] + } + } + }, + { + "id": "create_index", + "type": "create_index", + "previous_node_inputs": { + "create_ingest_pipeline": "pipeline_id" + }, + "user_inputs": { + "index_name": "my-nlp-index", + "configurations": { + "settings": { + "index.knn": true, + "default_pipeline": "_none", + "index.number_of_shards": "2" + }, + "mappings": { + "properties": { + "passage_embedding": { + "type": "knn_vector", + "dimension": "768", + "method": { + "engine": "lucene", + "space_type": "l2", + "name": "hnsw", + "parameters": {} + } + }, + "passage_text": { + "type": "text" + } + } + } + } + } + } + ] + } + } +} diff --git a/src/test/resources/template/registerremotemodel-ingestpipeline.json b/src/test/resources/template/registerremotemodel-ingestpipeline.json new file mode 100644 index 000000000..dede163c1 --- /dev/null +++ b/src/test/resources/template/registerremotemodel-ingestpipeline.json @@ -0,0 +1,77 @@ +{ + "name": "semantic search with local pretrained model", + "description": "Setting up semantic search, with a local pretrained embedding model", + "use_case": "SEMANTIC_SEARCH", + "version": { + "template": "1.0.0", + "compatibility": [ + "2.12.0", + "3.0.0" + ] + }, + "workflows": { + "provision": { + "nodes": [ + { + "id": "create_openai_connector", + "type": "create_connector", + "user_inputs": { + "name": "OpenAI Chat Connector", + "description": "The connector to public OpenAI model service for text embedding model", + "version": "1", + "protocol": "http", + "parameters": { + "endpoint": "api.openai.com", + "model": "gpt-3.5-turbo", + "response_filter": "$.choices[0].message.content" + }, + "credential": { + "openAI_key": "12345" + }, + "actions": [ + { + "action_type": "predict", + "method": "POST", + "url": "https://${parameters.endpoint}/v1/chat/completions" + } + ] + } + }, + { + "id": "register_openai_model", + "type": "register_remote_model", + "previous_node_inputs": { + "create_openai_connector": "connector_id" + }, + "user_inputs": { + "name": "openAI-gpt-3.5-turbo", + "deploy": true + } + }, + { + "id": "create_ingest_pipeline", + "type": "create_ingest_pipeline", + "previous_node_inputs": { + "register_openai_model": "model_id" + }, + "user_inputs": { + "pipeline_id": "nlp-ingest-pipeline", + "configurations": { + "description": "A text embedding pipeline", + "processors": [ + { + "text_embedding": { + "model_id": "${{register_openai_model.model_id}}", + "field_map": { + "passage_text": "passage_embedding" + } + } + } + ] + } + } + } + ] + } + } +} diff --git a/src/test/resources/template/registerremotemodel.json b/src/test/resources/template/registerremotemodel.json new file mode 100644 index 000000000..58c520af4 --- /dev/null +++ b/src/test/resources/template/registerremotemodel.json @@ -0,0 +1,54 @@ +{ + "name": "semantic search with local pretrained model", + "description": "Setting up semantic search, with a local pretrained embedding model", + "use_case": "SEMANTIC_SEARCH", + "version": { + "template": "1.0.0", + "compatibility": [ + "2.12.0", + "3.0.0" + ] + }, + "workflows": { + "provision": { + "nodes": [ + { + "id": "create_openai_connector", + "type": "create_connector", + "user_inputs": { + "name": "OpenAI Chat Connector", + "description": "The connector to public OpenAI model service for text embedding model", + "version": "1", + "protocol": "http", + "parameters": { + "endpoint": "api.openai.com", + "model": "gpt-3.5-turbo", + "response_filter": "$.choices[0].message.content" + }, + "credential": { + "openAI_key": "12345" + }, + "actions": [ + { + "action_type": "predict", + "method": "POST", + "url": "https://${parameters.endpoint}/v1/chat/completions" + } + ] + } + }, + { + "id": "register_openai_model", + "type": "register_remote_model", + "previous_node_inputs": { + "create_openai_connector": "connector_id" + }, + "user_inputs": { + "name": "openAI-gpt-3.5-turbo", + "deploy": true + } + } + ] + } + } + }