Method: Vellum::NormalizedLogProbs.validate_raw

Defined in:
lib/vellum_ai/types/normalized_log_probs.rb

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


49
50
51
52
# File 'lib/vellum_ai/types/normalized_log_probs.rb', line 49

def self.validate_raw(obj:)
  obj.tokens.is_a?(Array) != false || raise("Passed value for field obj.tokens is not the expected type, validation failed.")
  obj.likelihood&.is_a?(Float) != false || raise("Passed value for field obj.likelihood is not the expected type, validation failed.")
end