How to install a dependency (AWS SDK) for bots on ...
# support
a
Hi everyone, I’m trying to call AWS Bedrock from my Medplum bots while running Medplum locally, but I’m not sure how to do this correctly. I’m not on AWS yet. I’m using the full-stack Docker Compose file to stand up Medplum locally, and I’ve connected to it using Foo Medical. I enabled bots through the super admin account. However, when I try to import Bedrock’s InvokeModelCommand and the Bedrock Runtime client in a bot, I get an error indicating that the aws-sdk dependency cannot be found. Has anyone run into this before, or can clarify the correct way to call AWS Bedrock from Medplum bots in a local setup?
Also, what would be the way to set this up on AWS? The docs talk about lambda layers, but can someone please walk me through them? How do I set this out?
r
So Medplum bots have a limited set of dependencies available to them, and Medplum bots cannot access AWS resources directly. This is for security reasons. To be honest, AWS doesn't make it easy to access Bedrock via an endpoint without needing AWS permissions to their cluster. Lambda layers are an advanced feature for adding dependencies to AWS Lambda when running on a self-hosted cluster. If you follow the install on AWS instructions, the last step discusses how you can deploy the bot layer to your cluster, and you can edit the package.json in the bot layer to add custom dependencies. https://www.medplum.com/docs/self-hosting/install-on-aws#bot-lambda-layer
a
Yeah thats what I did. Added in the bedrock dependency to the bot layer and deployed it to lambda. Works now. Thanks!
r
Great! Glad you were made it work and thanks for confirming
35 Views