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

Conversation

bioshazard
Copy link

@bioshazard bioshazard commented Mar 10, 2025

Fixes #7809

Bedrock Chat Model did not have a way to invoke Application Inference Profiles. Solving this was complicated at first... how do you keep all that modelId-derived metadata parsing?

So I added a modelAlias field that simply overrides this.model to be used in the /invoke URL. It expects to be URL encoded. Worked great in my local testing. You can find me on Twitter @bios_hazard

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Mar 10, 2025
Copy link

vercel bot commented Mar 10, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-docs ✅ Ready (Inspect) Visit Preview Mar 10, 2025 5:21pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ⬜️ Ignored (Inspect) Mar 10, 2025 5:21pm

@dosubot dosubot bot added the auto:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs label Mar 10, 2025
@AllenFang
Copy link
Contributor

invoke approach is complicated indeed but this patch looks hacky and like a workaround. I will see what I can do when i have time unless langchain team is okay for this patch. 🙏

@bioshazard
Copy link
Author

bioshazard commented Mar 12, 2025

Thanks, I think it's actually pretty clean given the meta data is parsed from the model id. All that is unavailable in the inference id arn. Curious to hear how you could do it another way with that limitation. I expect you'd need to do an intermediate lookup or supply a second field as I have.

Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

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

Thanks! Small question

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants