Class: OpenAICompatibleErrors::Redaction::Limits

Inherits:
Struct
  • Object
show all
Defined in:
lib/openai_compatible_errors/redaction.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(max_depth: 4, max_nodes: 250, max_keys: 32, max_items: 32, max_chars: 8_192, max_replacements: 64) ⇒ Limits

Returns a new instance of Limits.

Raises:

  • (ArgumentError)


11
12
13
14
15
16
17
18
19
# File 'lib/openai_compatible_errors/redaction.rb', line 11

def initialize(max_depth: 4, max_nodes: 250, max_keys: 32, max_items: 32,
               max_chars: 8_192, max_replacements: 64)
  super
  raise ArgumentError, "limits must be positive" unless [max_depth, max_nodes,
    max_keys, max_items, max_chars, max_replacements].all? do |value|
    value.is_a?(Integer) && value.positive?
  end
  freeze
end

Instance Attribute Details

#max_charsObject

Returns the value of attribute max_chars

Returns:

  • (Object)

    the current value of max_chars



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_chars
  @max_chars
end

#max_depthObject

Returns the value of attribute max_depth

Returns:

  • (Object)

    the current value of max_depth



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_depth
  @max_depth
end

#max_itemsObject

Returns the value of attribute max_items

Returns:

  • (Object)

    the current value of max_items



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_items
  @max_items
end

#max_keysObject

Returns the value of attribute max_keys

Returns:

  • (Object)

    the current value of max_keys



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_keys
  @max_keys
end

#max_nodesObject

Returns the value of attribute max_nodes

Returns:

  • (Object)

    the current value of max_nodes



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_nodes
  @max_nodes
end

#max_replacementsObject

Returns the value of attribute max_replacements

Returns:

  • (Object)

    the current value of max_replacements



9
10
11
# File 'lib/openai_compatible_errors/redaction.rb', line 9

def max_replacements
  @max_replacements
end