mattw1
mattw1

Reputation: 1

Does structured output (JSON schema) work on R Plus via Bedrock?

I've tried every combination I can think of, but I can't seem to get structured outputs for Cohere Command R Plus to work on Bedrock. I can't imagine that the feature isn't supported. I did the obvious thing, basically.

model_id = "cohere.command-r-v1:0"
content_type = "application/json"
accept = "*/*"

request_body = {
    "max_tokens": 8000,
    "temperature": 0,
    "p": 0.75,
    "k": 0,
    "response_format": {
        "type": "json_object",
        "schema": {
            "type": "object",
            "properties": {
            "title": {"type": "string"},
                "author": {"type": "string"},
                "publication_year": {"type": "integer"},
            },
            "required": ["title", "author", "publication_year"],
        },
    },
}

And I get:

An error occurred (ValidationException) when calling the InvokeModel operation: Malformed input request: #: extraneous key [response_format] is not permitted, please reformat your input and try again.

Upvotes: 0

Views: 51

Answers (0)

Related Questions