From 4e05b01e90135dc625965af6fe51b83f73948318 Mon Sep 17 00:00:00 2001 From: nai-degen Date: Tue, 3 Oct 2023 20:29:42 -0500 Subject: [PATCH] improves AWS .env.example and config.ts docs --- .env.example | 1 + src/config.ts | 14 ++++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 4dc4c59..5186894 100644 --- a/.env.example +++ b/.env.example @@ -87,6 +87,7 @@ # For AWS credentials, separate the access key ID, secret key, and region with a colon. OPENAI_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ANTHROPIC_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +# See `config.ts` for details on setting up Amazon Bedrock credentials. AWS_CREDENTIALS=myaccesskeyid:mysecretkey:us-east-1,anotheraccesskeyid:anothersecretkey:us-west-2 # With proxy_key gatekeeper, the password users must provide to access the API. diff --git a/src/config.ts b/src/config.ts index 7936b96..0e5bf73 100644 --- a/src/config.ts +++ b/src/config.ts @@ -4,13 +4,9 @@ import pino from "pino"; import type { ModelFamily } from "./shared/models"; dotenv.config(); -// Can't import the usual logger here because it itself needs the config. const startupLogger = pino({ level: "debug" }).child({ module: "startup" }); - const isDev = process.env.NODE_ENV !== "production"; -type PromptLoggingBackend = "google_sheets"; - type Config = { /** The port the proxy server will listen on. */ port: number; @@ -23,7 +19,13 @@ type Config = { /** * Comma-delimited list of AWS credentials. Each credential item should be a * colon-delimited list of access key, secret key, and AWS region. - * Example: `AWS_CREDENTIALS=access_key_1:secret_key_1:us-east-1,access_key_2:secret_key_2:us-west-2` + * + * The credentials must have access to the actions `bedrock:InvokeModel` and + * `bedrock:InvokeModelWithResponseStream`. You must also have already + * provisioned the necessary models in your AWS account, on the specific + * regions specified for each credential. Models are region-specific. + * + * @example `AWS_CREDENTIALS=access_key_1:secret_key_1:us-east-1,access_key_2:secret_key_2:us-west-2` */ awsCredentials?: string; /** @@ -97,7 +99,7 @@ type Config = { /** Whether prompts and responses should be logged to persistent storage. */ promptLogging?: boolean; /** Which prompt logging backend to use. */ - promptLoggingBackend?: PromptLoggingBackend; + promptLoggingBackend?: "google_sheets"; /** Base64-encoded Google Sheets API key. */ googleSheetsKey?: string; /** Google Sheets spreadsheet ID. */