From 5e983d50f722404b775ed4a23d6f48f09ca73ea8 Mon Sep 17 00:00:00 2001 From: b4sjoo Date: Mon, 22 Jul 2024 06:33:56 +0000 Subject: [PATCH] Fix remote inference blueprints Signed-off-by: b4sjoo --- .../amazon_comprehend_connector_blueprint.md | 12 ++++-------- .../amazon_textract_connector_blueprint.md | 12 ++++++++---- .../bedrock_connector_ai21labs_jurassic_blueprint.md | 9 +++++---- .../bedrock_connector_anthropic_claude3_blueprint.md | 5 +++-- .../bedrock_connector_anthropic_claude_blueprint.md | 5 +++-- .../bedrock_connector_titan_embedding_blueprint.md | 2 +- ...connector_titan_multimodal_embedding_blueprint.md | 3 ++- 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/docs/remote_inference_blueprints/amazon_comprehend_connector_blueprint.md b/docs/remote_inference_blueprints/amazon_comprehend_connector_blueprint.md index 2ddfd7cfd2..95f38959d8 100644 --- a/docs/remote_inference_blueprints/amazon_comprehend_connector_blueprint.md +++ b/docs/remote_inference_blueprints/amazon_comprehend_connector_blueprint.md @@ -47,7 +47,6 @@ POST /_plugins/_ml/connectors/_create "parameters": { "service_name": "comprehend", "region": "us-east-1", - "endpoint": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "api_version": "20171127", "api_name": "DetectDominantLanguage", "api": "Comprehend_${parameters.api_version}.${parameters.api_name}", @@ -57,7 +56,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "${parameters.endpoint}", + "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "headers": { "X-Amz-Target": "${parameters.api}", "content-type": "application/x-amz-json-1.1" @@ -87,7 +86,6 @@ POST /_plugins/_ml/connectors/_create "parameters": { "service_name": "comprehend", "region": "us-east-1", - "endpoint": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "api_version": "20171127", "api_name": "DetectDominantLanguage", "api": "Comprehend_${parameters.api_version}.${parameters.api_name}", @@ -97,7 +95,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "${parameters.endpoint}", + "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "headers": { "X-Amz-Target": "${parameters.api}", "content-type": "application/x-amz-json-1.1" @@ -400,7 +398,6 @@ POST /_plugins/_ml/connectors/_create "parameters": { "service_name": "comprehend", "region": "us-east-1", - "endpoint": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "api_version": "20171127", "api_name": "DetectEntities", "api": "Comprehend_${parameters.api_version}.${parameters.api_name}", @@ -410,7 +407,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "${parameters.endpoint}", + "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "headers": { "X-Amz-Target": "${parameters.api}", "content-type": "application/x-amz-json-1.1" @@ -440,7 +437,6 @@ POST /_plugins/_ml/connectors/_create "parameters": { "service_name": "comprehend", "region": "us-east-1", - "endpoint": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "api_version": "20171127", "api_name": "DetectEntities", "api": "Comprehend_${parameters.api_version}.${parameters.api_name}", @@ -450,7 +446,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "${parameters.endpoint}", + "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "headers": { "X-Amz-Target": "${parameters.api}", "content-type": "application/x-amz-json-1.1" diff --git a/docs/remote_inference_blueprints/amazon_textract_connector_blueprint.md b/docs/remote_inference_blueprints/amazon_textract_connector_blueprint.md index ebc1e347e4..c3af123486 100644 --- a/docs/remote_inference_blueprints/amazon_textract_connector_blueprint.md +++ b/docs/remote_inference_blueprints/amazon_textract_connector_blueprint.md @@ -42,7 +42,9 @@ POST /_plugins/_ml/connectors/_create }, "parameters": { "region": "", - "service_name": "textract" + "service_name": "textract", + "api_name": "DetectDocumentText", + "api": "Textract.${parameters.api_name}" }, "actions": [ { @@ -50,7 +52,7 @@ POST /_plugins/_ml/connectors/_create "method": "POST", "headers": { "content-type": "application/x-amz-json-1.1", - "X-Amz-Target": "Textract.DetectDocumentText" + "X-Amz-Target": "${parameters.api}" }, "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "request_body": "{ \"Document\": { \"Bytes\": \"${parameters.bytes}\" } } " @@ -77,7 +79,9 @@ POST /_plugins/_ml/connectors/_create }, "parameters": { "region": "", - "service_name": "textract" + "service_name": "textract", + "api_name": "DetectDocumentText", + "api": "Textract.${parameters.api_name}" }, "actions": [ { @@ -85,7 +89,7 @@ POST /_plugins/_ml/connectors/_create "method": "POST", "headers": { "content-type": "application/x-amz-json-1.1", - "X-Amz-Target": "Textract.DetectDocumentText" + "X-Amz-Target": "${parameters.api}" }, "url": "https://${parameters.service_name}.${parameters.region}.amazonaws.com", "request_body": "{ \"Document\": { \"Bytes\": \"${parameters.bytes}\" } } " diff --git a/docs/remote_inference_blueprints/bedrock_connector_ai21labs_jurassic_blueprint.md b/docs/remote_inference_blueprints/bedrock_connector_ai21labs_jurassic_blueprint.md index f160cba98c..f956fcaa47 100644 --- a/docs/remote_inference_blueprints/bedrock_connector_ai21labs_jurassic_blueprint.md +++ b/docs/remote_inference_blueprints/bedrock_connector_ai21labs_jurassic_blueprint.md @@ -28,7 +28,8 @@ POST /_plugins/_ml/connectors/_create "protocol": "aws_sigv4", "credential": { "access_key": "", - "secret_key": "" + "secret_key": "", + "session_token": "" }, "parameters": { "region": "", @@ -42,7 +43,7 @@ POST /_plugins/_ml/connectors/_create "headers": { "content-type": "application/json" }, - "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model_name}/invoke", + "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/invoke", "request_body": "{\"prompt\":\"${parameters.inputs}\",\"maxTokens\":200,\"temperature\":0.7,\"topP\":1,\"stopSequences\":[],\"countPenalty\":{\"scale\":0},\"presencePenalty\":{\"scale\":0},\"frequencyPenalty\":{\"scale\":0}}", "post_process_function": "\n return params['completions'][0].data.text; \n" } @@ -66,7 +67,7 @@ POST /_plugins/_ml/connectors/_create "parameters": { "region": "", "service_name": "bedrock", - "model_name": "ai21.j2-mid-v1" + "model": "ai21.j2-mid-v1" }, "actions": [ { @@ -75,7 +76,7 @@ POST /_plugins/_ml/connectors/_create "headers": { "content-type": "application/json" }, - "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model_name}/invoke", + "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/invoke", "request_body": "{\"prompt\":\"${parameters.inputs}\",\"maxTokens\":200,\"temperature\":0.7,\"topP\":1,\"stopSequences\":[],\"countPenalty\":{\"scale\":0},\"presencePenalty\":{\"scale\":0},\"frequencyPenalty\":{\"scale\":0}}", "post_process_function": "\n return params['completions'][0].data.text; \n" } diff --git a/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude3_blueprint.md b/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude3_blueprint.md index bad60a89dd..33f26e080e 100644 --- a/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude3_blueprint.md +++ b/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude3_blueprint.md @@ -73,7 +73,8 @@ POST /_plugins/_ml/connectors/_create "auth": "Sig_V4", "response_filter": "$.content[0].text", "max_tokens_to_sample": "8000", - "anthropic_version": "bedrock-2023-05-31" + "anthropic_version": "bedrock-2023-05-31", + "model": "anthropic.claude-3-sonnet-20240229-v1:0" }, "actions": [ { @@ -82,7 +83,7 @@ POST /_plugins/_ml/connectors/_create "headers": { "content-type": "application/json" }, - "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-sonnet-20240229-v1:0/invoke", + "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/${parameters.model}/invoke", "request_body": "{\"messages\":[{\"role\":\"user\",\"content\":[{\"type\":\"text\",\"text\":\"${parameters.prompt}\"}]}],\"anthropic_version\":\"${parameters.anthropic_version}\",\"max_tokens\":${parameters.max_tokens_to_sample}}" } ] diff --git a/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude_blueprint.md b/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude_blueprint.md index 9e3e4037a3..83fd6c5b29 100644 --- a/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude_blueprint.md +++ b/docs/remote_inference_blueprints/bedrock_connector_anthropic_claude_blueprint.md @@ -65,7 +65,8 @@ POST /_plugins/_ml/connectors/_create }, "parameters": { "region": "", - "service_name": "bedrock" + "service_name": "bedrock", + "model": "anthropic.claude-v2" }, "actions": [ { @@ -74,7 +75,7 @@ POST /_plugins/_ml/connectors/_create "headers": { "content-type": "application/json" }, - "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/anthropic.claude-v2/invoke", + "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/invoke", "request_body": "{\"prompt\":\"\\n\\nHuman: ${parameters.inputs}\\n\\nAssistant:\",\"max_tokens_to_sample\":300,\"temperature\":0.5,\"top_k\":250,\"top_p\":1,\"stop_sequences\":[\"\\\\n\\\\nHuman:\"]}" } ] diff --git a/docs/remote_inference_blueprints/bedrock_connector_titan_embedding_blueprint.md b/docs/remote_inference_blueprints/bedrock_connector_titan_embedding_blueprint.md index 73bcb1dfab..a3b2edbf97 100644 --- a/docs/remote_inference_blueprints/bedrock_connector_titan_embedding_blueprint.md +++ b/docs/remote_inference_blueprints/bedrock_connector_titan_embedding_blueprint.md @@ -76,7 +76,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/amazon.titan-embed-text-v1/invoke", + "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/invoke", "headers": { "content-type": "application/json", "x-amz-content-sha256": "required" diff --git a/docs/remote_inference_blueprints/bedrock_connector_titan_multimodal_embedding_blueprint.md b/docs/remote_inference_blueprints/bedrock_connector_titan_multimodal_embedding_blueprint.md index ed0e1be2e2..928b226cc0 100644 --- a/docs/remote_inference_blueprints/bedrock_connector_titan_multimodal_embedding_blueprint.md +++ b/docs/remote_inference_blueprints/bedrock_connector_titan_multimodal_embedding_blueprint.md @@ -67,6 +67,7 @@ POST /_plugins/_ml/connectors/_create "parameters": { "region": "", "service_name": "bedrock", + "model": "amazon.titan-embed-image-v1", "input_docs_processed_step_size": 2 }, "credential": { @@ -76,7 +77,7 @@ POST /_plugins/_ml/connectors/_create { "action_type": "predict", "method": "POST", - "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/amazon.titan-embed-image-v1/invoke", + "url": "https://bedrock-runtime.${parameters.region}.amazonaws.com/model/${parameters.model}/invoke", "headers": { "content-type": "application/json", "x-amz-content-sha256": "required"