Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#7809: Permit bedrock application inference profiles #7822

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/langchain-community/src/chat_models/bedrock/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,10 @@ export class BedrockChat
this.guardrailIdentifier =
fields?.guardrailIdentifier ?? this.guardrailIdentifier;
this.guardrailConfig = fields?.guardrailConfig;
// Permit Application Inference Profile override (expects to be url-encoded)
if (fields?.modelAlias) {
this.model = fields?.modelAlias;
}
}

override invocationParams(options?: this["ParsedCallOptions"]) {
Expand Down
6 changes: 6 additions & 0 deletions libs/langchain-community/src/utils/bedrock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,12 @@ export interface BaseBedrockInput {
*/
model: string;

/** Optional URL Encoded model alias to use. Necessary for invoking an Application Inference Profile
For example, "arn%3Aaws%3Abedrock%3Aus-east-1%3A1234567890%3Aapplication-inference-profile%2Fabcdefghi", will override this.model in final /invoke URL call.
Must still provide `model` as normal modelId to benefit from all the metadata.
*/
modelAlias?: string;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call this applicationInferenceProfile?


/** The AWS region e.g. `us-west-2`.
Fallback to AWS_DEFAULT_REGION env variable or region specified in ~/.aws/config in case it is not provided here.
*/
Expand Down