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

AWS Bedrock Configuration Error #1158

Open
sudhakar2do opened this issue Feb 8, 2025 · 7 comments
Open

AWS Bedrock Configuration Error #1158

sudhakar2do opened this issue Feb 8, 2025 · 7 comments
Assignees
Labels
help wanted Great issue for non-Block contributors

Comments

@sudhakar2do
Copy link

sudhakar2do commented Feb 8, 2025

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.

@salman1993
Copy link
Collaborator

based on this PR - #1069, i think you'd have to set AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY, AWS_REGION as env vars

@salman1993 salman1993 added the help wanted Great issue for non-Block contributors label Feb 8, 2025
@sudhakar2do
Copy link
Author

sudhakar2do commented Feb 10, 2025

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

@ahau-square
Copy link
Collaborator

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?

@sudhakar2do
Copy link
Author

Yes, I am behind a proxy. Is there a switch i can use to get additional debug information that I can share here?

@ahau-square
Copy link
Collaborator

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:

let sdk_config = futures::executor::block_on(aws_config::load_from_env());

@sudhakar2do
Copy link
Author

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?

@alicehau
Copy link
Collaborator

Sorry can you explain more what's the issue you're getting now? You're able to configure fine via the cli?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Great issue for non-Block contributors
Projects
None yet
Development

No branches or pull requests

4 participants