changes default AMZ_HOST to bedrock-runtime.region.amazonaws.com

This commit is contained in:
nai-degen 2023-10-12 15:39:06 -05:00
parent 725fd6e6f1
commit af4d8dae40
2 changed files with 4 additions and 2 deletions

View File

@ -7,7 +7,7 @@ import { RequestPreprocessor } from ".";
import { AnthropicV1CompleteSchema } from "./transform-outbound-payload"; import { AnthropicV1CompleteSchema } from "./transform-outbound-payload";
const AMZ_HOST = const AMZ_HOST =
process.env.AMZ_HOST || "invoke-bedrock.%REGION%.amazonaws.com"; process.env.AMZ_HOST || "bedrock-runtime.%REGION%.amazonaws.com";
/** /**
* Signs an outgoing AWS request with the appropriate headers modifies the * Signs an outgoing AWS request with the appropriate headers modifies the

View File

@ -8,11 +8,13 @@ import type { AwsBedrockKey, AwsBedrockKeyProvider } from "./provider";
const MIN_CHECK_INTERVAL = 3 * 1000; // 3 seconds const MIN_CHECK_INTERVAL = 3 * 1000; // 3 seconds
const KEY_CHECK_PERIOD = 3 * 60 * 1000; // 3 minutes const KEY_CHECK_PERIOD = 3 * 60 * 1000; // 3 minutes
const AMZ_HOST =
process.env.AMZ_HOST || "bedrock-runtime.%REGION%.amazonaws.com";
const GET_CALLER_IDENTITY_URL = `https://sts.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15`; const GET_CALLER_IDENTITY_URL = `https://sts.amazonaws.com/?Action=GetCallerIdentity&Version=2011-06-15`;
const GET_INVOCATION_LOGGING_CONFIG_URL = (region: string) => const GET_INVOCATION_LOGGING_CONFIG_URL = (region: string) =>
`https://bedrock.${region}.amazonaws.com/logging/modelinvocations`; `https://bedrock.${region}.amazonaws.com/logging/modelinvocations`;
const POST_INVOKE_MODEL_URL = (region: string, model: string) => const POST_INVOKE_MODEL_URL = (region: string, model: string) =>
`https://invoke-bedrock.${region}.amazonaws.com/model/${model}/invoke`; `https://${AMZ_HOST.replace("%REGION%", region)}/model/${model}/invoke`;
const TEST_PROMPT = "\n\nHuman:\n\nAssistant:"; const TEST_PROMPT = "\n\nHuman:\n\nAssistant:";
type AwsError = { error: {} }; type AwsError = { error: {} };