Skip to content

[Bug]: Property 'minimum' is not supported by Anthropic models #302

@aus70

Description

@aus70

Provider (if applicable)

anthropic

Model (if applicable)

No response

Bug Description

The demo code found in the documentation to generate type-validated objects using NimbleOptions schemas results in the error "For 'integer' type, property 'minimum' is not supported":

    {:error,
     %ReqLLM.Error.API.Request{
       reason: "Provider response error (400): Anthropic API error: output_format.schema: For 'integer' type, property 'minimum' is not supported",
       status: 400,
       response_body: %{
         "error" => %{
           "message" => "output_format.schema: For 'integer' type, property 'minimum' is not supported",
           "type" => "invalid_request_error"
         }...

Reproduction Code

schema = [
  name: [type: :string, required: true],
  age: [type: :pos_integer, required: true]
]
{:ok, response} = ReqLLM.generate_object("anthropic:claude-haiku-4-5", "Generate a person", schema)
object = ReqLLM.Response.object(response)

Expected Behavior

The schema should comply with Anthropic's specs by not using the property 'minimum'.

Actual Behavior

The schema uses the property 'minimum', which results in an error

Environment

  • ReqLLM: 1.2.0
  • Elixir: 1.19.4
  • Erlang: 28.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions