Skip to content

Using Bedrock on GCP and Langchain

0

Hi I wanted to use bedrock through Langchain on gcp. How to configure my aws settings for the same..!?

Thanks.

asked 2 years ago452 views

1 Answer
0

Here is an example

from langchain_aws import BedrockLLM

llm = BedrockLLM(
    credentials_profile_name="bedrock-admin", model_id="amazon.titan-text-express-v1"
)

from this source: https://python.langchain.com/v0.2/docs/integrations/llms/bedrock/

Note the credentials_profile_name parameter: Here it's definition.... param credentials_profile_name: Optional[str] = None The name of the profile in the ~/.aws/credentials or ~/.aws/config files, which has either access keys or role information specified. If not specified, the default credential profile or, if on an EC2 instance, credentials from IMDS will be used. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html

Basically just create ~/.aws/credentials on the machine that is running your application in this format:

[default]
aws_access_key_id=foo
aws_secret_access_key=bar
aws_session_token=baz
AWS

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.