aws-signer-v4-dot-net icon indicating copy to clipboard operation
aws-signer-v4-dot-net copied to clipboard

Content Type not Tracking

Open taylorreinerfacteus opened this issue 1 year ago • 2 comments

Hey Y'all,

When I use the signer on the new Bedrock API, I get an error back about the content type being incorrect. It's expecting "application/json" and it works with this type in Postman, but for some reason it isn't working with the signer.

Below is the code where I'm setting the type in the request's Content, like your example. But with the below code I get back: "message": "The provided Content Type is invalid or not supported for this model", which is the behaviour received in Postman when I change the type from json to something else, like text.

This may be a Bedrock issue, but wondering if this issue has been tracked before.

Thanks!

var signer = new AWS4RequestSigner(_titanAccessKey, _titanSecretKey);
var request = new HttpRequestMessage
{
	Method = HttpMethod.Post,
	RequestUri = new Uri("https://bedrock.us-west-2.amazonaws.com/model/amazon.titan-tg1-large/invoke"),
	Content = new StringContent(promptJson, Encoding.UTF8, "application/json")
};

request = await signer.Sign(request, "bedrock", "us-west-2");

var client = new HttpClient();
var response = await client.SendAsync(request);
var resultString = await response.Content.ReadAsStringAsync();

taylorreinerfacteus avatar Aug 18 '23 05:08 taylorreinerfacteus

Sorry, I no longer actively maintain this project. I recommend switching to alternative packages.

tsibelman avatar Aug 30 '23 08:08 tsibelman

library works - thank you

BlockchainPunks avatar Nov 01 '23 21:11 BlockchainPunks