Skip to main content
LibreChat is joining ClickHouse to power the open-source Agentic Data Stack 🎉 Learn more
LibreChat

AWS Bedrock オブジェクト構造

AWS BedrockをLibreChatと統合することで、AWS上でホストされている複数のAIモデルをシームレスに利用できるようになります。このセクションでは、ニーズに合わせてAWS Bedrockのendpointを設定する方法を詳しく説明します。

設定例

endpoints:
  bedrock:
    titleModel: 'anthropic.claude-3-haiku-20240307-v1:0'
    streamRate: 35
    availableRegions:
      - 'us-east-1'
      - 'us-west-2'
    guardrailConfig:
      guardrailIdentifier: 'your-guardrail-id'
      guardrailVersion: '1'
      trace: 'enabled'
      streamProcessingMode: 'sync'

注: AWS Bedrock endpoint は、streamRatetitleModeltitleMethodtitlePrompttitlePromptTemplatetitleEndpoint を含む、すべての Shared Endpoint Settings をサポートしています。以下に示す設定は Bedrock 固有のもの、または Bedrock 固有のデフォルト値を持つものです。

titleModel

キー:

KeyTypeDescriptionExample
titleModelString会話タイトルの生成に使用するモデルを指定します。Recommended: anthropic.claude-3-haiku-20240307-v1:0. Set to "current_model" to use the same model as the chat.

デフォルト: 指定なし

例:

titleModel: 'anthropic.claude-3-haiku-20240307-v1:0'

streamRate

キー:

KeyTypeDescriptionExample
streamRateNumber新しいトークンを処理する速度をミリ秒単位で設定します。This can help stabilize processing of concurrent requests and provide smoother frontend stream rendering.

デフォルト: 指定なし

例:

streamRate: 35

availableRegions

キー:

KeyTypeDescriptionExample
availableRegionsArrayBedrockで利用可能にするAWSリージョンを指定します。If provided, users will see a dropdown to select the region. If not selected, the default region is used.

デフォルト: 指定なし

例:

availableRegions:
  - 'us-east-1'
  - 'us-west-2'

models

キー:

KeyTypeDescriptionExample
modelsArray of StringsBedrock endpointで使用可能なカスタムモデルIDを指定します。When provided, these models appear in the model selector for Bedrock.

デフォルト: 指定なし (デフォルトの Bedrock モデルリストを使用)

例:

endpoints:
  bedrock:
    models:
      - 'anthropic.claude-sonnet-4-20250514-v1:0'
      - 'anthropic.claude-haiku-4-20250514-v1:0'
      - 'us.anthropic.claude-sonnet-4-20250514-v1:0'

inferenceProfiles

キー:

KeyTypeDescriptionExample
inferenceProfilesObject (Record)リージョン間推論のために、モデルIDを推論プロファイルARNにマッピングします。キーはモデルIDで、値は推論プロファイルARNまたは環境変数参照です。When a selected model matches a key, the corresponding ARN is used as the application inference profile.

デフォルト: 指定なし

例:

endpoints:
  bedrock:
    inferenceProfiles:
      'us.anthropic.claude-sonnet-4-20250514-v1:0': '${BEDROCK_INFERENCE_PROFILE_CLAUDE_SONNET}'
      'anthropic.claude-3-7-sonnet-20250219-v1:0': 'arn:aws:bedrock:us-west-2:123456789012:application-inference-profile/abc123'

注記:

  • Inference profilesにより、クロスリージョン推論が可能になり、異なるAWSリージョンのモデルへリクエストをルーティングできるようになります。
  • 値は ${ENV_VAR} 構文による環境変数の補間をサポートしています。
  • キー内のモデルIDは、UIでユーザーが選択したモデルと一致している必要があります。
  • models フィールドと併用することで、クロスリージョンモデルのIDをモデルセレクターで利用可能にします。
  • 推論プロファイルの作成および管理に関する完全なガイドについては、AWS Bedrock Inference Profiles を参照してください。

組み合わせの例:

endpoints:
  bedrock:
    models:
      - 'us.anthropic.claude-sonnet-4-20250514-v1:0'
      - 'us.anthropic.claude-haiku-4-20250514-v1:0'
    inferenceProfiles:
      'us.anthropic.claude-sonnet-4-20250514-v1:0': '${BEDROCK_CLAUDE_SONNET_PROFILE}'
      'us.anthropic.claude-haiku-4-20250514-v1:0': '${BEDROCK_CLAUDE_HAIKU_PROFILE}'

guardrailConfig

キー:

KeyTypeDescriptionExample
guardrailConfigObjectモデルの入力と出力をフィルタリングおよびモデレートするためのAWS Bedrock Guardrailsの設定。Optional. When configured, all Bedrock requests will be validated against the specified guardrail.

サブキー:

KeyTypeDescriptionExample
guardrailIdentifierString適用するガードレールの固有識別子。Required when using guardrails.
guardrailVersionString使用するガードレールのバージョン。Required when using guardrails.
traceStringデバッグ用のガードレールトレース出力を制御します。オプション: "enabled", "enabled_full", "disabled"Optional. Default: "disabled"
streamProcessingModeStringガードレールのストリーム処理モードを制御します。オプション: "sync" または "async"。Optional. Default: "sync"

例:

endpoints:
  bedrock:
    guardrailConfig:
      guardrailIdentifier: 'abc123xyz'
      guardrailVersion: '1'
      trace: 'enabled'
      streamProcessingMode: 'sync'

注記:

  • Guardrailsは、有害なコンテンツ、PII(個人識別情報)、その他の機密情報をフィルタリングすることで、責任あるAI利用を保証するのに役立ちます。
  • guardrailIdentifier は、AWS Bedrock コンソールの Guardrails から確認できます。
  • 開発中にどのガードレールポリシーがトリガーされたかを確認するには、trace"enabled" または "enabled_full" に設定してください。
  • streamProcessingMode"async" に設定すると、レスポンスのストリーミングが高速化されます(ただし、ガードレールによるスキャンが完了するまで不適切なコンテンツが通過する可能性があるというトレードオフがあります)。
  • 本番環境では、レスポンスのペイロードサイズを削減するために trace"disabled" に設定してください。

注記

  • AWS Bedrockの認証は環境変数を通じて設定されます。BEDROCK_AWS_PROFILE、AWS SDKのデフォルト認証情報プロバイダーチェーン、Bedrock APIキー用のBEDROCK_AWS_BEARER_TOKEN、またはBedrock固有の静的認証情報を使用できます。詳細はAWS Bedrockセットアップガイドを参照してください。

このガイドはいかがでしたか?