I'm trying to invoke Bedrock via curl, using this command:
curl --location --request POST 'https://bedrock-runtime.us-east-1.amazonaws.com/model/cohere.command-text-v14/invoke' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'X-Amz-Content-Sha256: op' \
--header 'X-Amz-Date: 20231104T081154Z' \
--header 'Authorization: 0-HMAC-SHA256 Credential=/20231104/us-east-1/bedrock/aws4_request, SignedHeaders=accept;content-type;host;x-amz-content-sha256;x-amz-date, Signature=' \
--data-raw '{
"inputText": "Hi",
"textGenerationConfig": {
"maxTokenCount": 4096,
"stopSequences": [],
"temperature": 0,
"topP": 0.9
}
}'
I get the below error:
Malformed input request: 3 schema violations found, please reformat your input and try again.
What is the issue?
You can't use Amazon Titan Model's input for the Cohere Command Model, hence the schema error.
Your request
body
is for Titan. You can tell this by theinputText
field which is unique to this model's inference input. However, you've specifiedcohere.command-text-v14
as your model ID i.e. Cohere.Referring to the official docs, the below will work for the Cohere model, with the equivalent parameters set from your Titan input.
Output: