Class: Turbopuffer::Models::Columns

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/turbopuffer/models/columns.rb

Defined Under Namespace

Modules: Vector

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], coerce, #deconstruct_keys, #deep_to_h, dump, fields, hash, #hash, inherited, inspect, #inspect, known_fields, optional, recursively_to_h, required, #to_h, #to_json, #to_s, to_sorbet_type, #to_yaml

Methods included from Internal::Type::Converter

#coerce, coerce, #dump, dump, inspect, #inspect, meta_info, new_coerce_state, type_info

Methods included from Internal::Util::SorbetRuntimeSupport

#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type, to_sorbet_type

Constructor Details

#initialize(id:, vector: nil) ⇒ Object

A list of documents in columnar format. Each key is a column name, mapped to an array of values for that column.

Parameters:

  • id (Array<String, Integer>)

    The IDs of the documents.

  • vector (Array<Array<Float>, String>, Array<Float>, String) (defaults to: nil)

    The vector embeddings of the documents.



# File 'lib/turbopuffer/models/columns.rb', line 18


Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/turbopuffer/models/columns.rb', line 51

def method_missing(name, *args, &block)
  if @data.key?(name)
    @data[name]
  else
    super
  end
end

Instance Attribute Details

#idArray<String, Integer>

The IDs of the documents.

Returns:

  • (Array<String, Integer>)


10
# File 'lib/turbopuffer/models/columns.rb', line 10

required :id, -> { Turbopuffer::Internal::Type::ArrayOf[union: Turbopuffer::ID] }

#vectorArray<Array<Float>, String>, ...

The vector embeddings of the documents.

Returns:

  • (Array<Array<Float>, String>, Array<Float>, String, nil)


16
# File 'lib/turbopuffer/models/columns.rb', line 16

optional :vector, union: -> { Turbopuffer::Columns::Vector }

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
# File 'lib/turbopuffer/models/columns.rb', line 59

def respond_to_missing?(name, include_private = false)
  @data.key?(name) || super
end