AWS Bedrock Configuration Error
I am trying to configure goose for AWS bedrock for anthropic.claude-3-5-sonnet-20240620-v1:0. Hit an issue during configuration stage.
The following variables are set. Shell is "csh" setenv AWS_SECRET_ACCESS_KEY "yyyKEYyyy" setenv AWS_ACCESS_KEY "yyyKEYyyy" setenv AWS_REGION "us-west-2" setenv AWS_ACCESS_KEY_ID "xxIDxx"
The configure loops in the below:
⢠Checking your configuration...
⢠Checking your configuration...
⢠Checking your configuration...
⢠Checking your configuration...
And gives the following error.
Server error: Failed to call Bedrock: Unhandled(Unhandled { source: DispatchFailure(DispatchFailure { source: ConnectorError { kind: Timeout, source: hyper::Error(Connect, HttpTimeoutError { kind: "HTTP connect", duration: 3.1s }), connection: Unknown } }), meta: ErrorMetadata { code: None, message: None, extras: None } }) | â Failed to configure provider: init chat completion request with tool did not succeed.
Is the AWS_REGION taken into account when the call is made?
I have checked the access via pyhon using the below script and it works:
# Use the native inference API to send a text message to Anthropic Claude.
import boto3
import json
from botocore.exceptions import ClientError
# Create a Bedrock Runtime client in the AWS Region of your choice.
client = boto3.client("bedrock-runtime", region_name="us-west-2")
model_id = "anthropic.claude-3-5-sonnet-20241022-v2:0"
# Define the prompt for the model.
prompt = "Describe the purpose of a 'hello world' program in one line."
model_param={
'maxTokens': 512,
'temperature': 0.5
}
conversation = [
{
"role": "user",
"content": [{"text": prompt}],
}
]
try:
response = client.converse(modelId=model_id, messages=conversation, inferenceConfig=model_param)
except (ClientError, Exception) as e:
print(f"ERROR: Can't invoke '{model_id}'. Reason: {e}")
exit(1)
response_text = response["output"]["message"]["content"][0]["text"]
print(response_text)
Response:
A "Hello World" program serves as the simplest possible introduction to a programming language by demonstrating basic syntax through outputting text.
based on this PR - https://github.com/block/goose/pull/1069, i think you'd have to set AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY, AWS_REGION as env vars
Yes, I have set these three as env variaables as below: setenv AWS_SECRET_ACCESS_KEY "yyyKEYyyy" setenv AWS_ACCESS_KEY "yyyKEYyyy" setenv AWS_REGION "us-west-2" setenv AWS_ACCESS_KEY_ID "xxIDxx" Additionally set the following too setenv AWS_PROFILE "default"
Is the goose expecting the AWS CLI to be installed? I am using AWS using the python boto3 library. Tried to give the aws cli path too. Still not able to connect. This is in redhat
Goose version I am using is : 1.0.5
You shouldn't need the AWS cli. Those are the correct env vars to set, any combination of AWS_REGION + AWS_PROFILE or AWS_REGION + AWS_ACCESS_KEY + AWS_ACCESS_KEY_ID should work.
Looks like your error is a network timeout one rather than an AWS authentication one based on the error HttpTimeoutError. Are you behind a proxy?
Yes, I am behind a proxy. Is there a switch i can use to get additional debug information that I can share here?
Got it, I suspect that's the issue. Unfortunately we don't have more debugging enabled on that config step.
Maybe you also need to set env vars HTTP_PROXY or HTTPS_PROXY? https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-proxy.html
This is where we're doing the auth if you're interested in investigating / opening a PR if needed: https://github.com/block/goose/blob/98aecbef239c78a9e2bd436dbc6264bb942ad1ea/crates/goose/src/providers/bedrock.rs#L36
ok, thanks. I have the HTTP_PROXY, HTTPS_PROXY set and am able to access the aws bedrock from python One issue I have is getting the SSL certificates for curl. For curl I use -k option. Can you check if this could be an issue?
Sorry can you explain more what's the issue you're getting now? You're able to configure fine via the cli?
Please feel free to reopen if this is still an outstanding error!