Skip to content

[BUG] The titan embedding template has a hard-coded region in the Bedrock URL #1229

@Jon-AtAWS

Description

@Jon-AtAWS

What is the bug?

When I use the bedrock_titan_embedding_model_deploy template, I pass in create_connector.region as us-west-2. However the connector has a hard-coded us-east-1 in the Bedrock URL. This is the resulting connector

{
  "name": "Amazon Bedrock Connector: embedding",
  "version": "1",
  "description": "The connector to bedrock Titan embedding model",
  "protocol": "aws_sigv4",
  "parameters": {
    "service_name": "bedrock",
    "region": "us-west-2"
  },
  "actions": [
    {
      "action_type": "PREDICT",
      "method": "POST",
      "url": "https://bedrock-runtime.us-east-1.amazonaws.com/model/amazon.titan-embed-text-v1/invoke",
      "headers": {
        "x-amz-content-sha256": "required",
        "content-type": "application/json"
      },
      "request_body": "{ \"inputText\": \"${parameters.inputText}\" }",
      "pre_process_function": "\n    StringBuilder builder = new StringBuilder();\n    builder.append(\"\\\"\");\n    String first = params.text_docs[0];\n    builder.append(first);\n    builder.append(\"\\\"\");\n    def parameters = \"{\" +\"\\\"inputText\\\":\" + builder + \"}\";\n    return  \"{\" +\"\\\"parameters\\\":\" + parameters + \"}\";",
      "post_process_function": "\n      def name = \"sentence_embedding\";\n      def dataType = \"FLOAT32\";\n      if (params.embedding == null || params.embedding.length == 0) {\n        return params.message;\n      }\n      def shape = [params.embedding.length];\n      def json = \"{\" +\n                 \"\\\"name\\\":\\\"\" + name + \"\\\",\" +\n                 \"\\\"data_type\\\":\\\"\" + dataType + \"\\\",\" +\n                 \"\\\"shape\\\":\" + shape + \",\" +\n                 \"\\\"data\\\":\" + params.embedding +\n                 \"}\";\n      return json;\n    "
    }
  ],
  "created_time": 1757099051934,
  "last_updated_time": 1757099051934
}

### How can one reproduce the bug?
Run the workflow with a different region

### What is the expected behavior?
The Bedrock URL should have the correct region

### What is your host/environment?
MacOS
OpenSearch Service, v2.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions