Class: Vellum::TokenOverlappingWindowChunking
- Inherits:
-
Object
- Object
- Vellum::TokenOverlappingWindowChunking
- Defined in:
- lib/vellum_ai/types/token_overlapping_window_chunking.rb
Overview
Token overlapping window chunking
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #chunker_config ⇒ Vellum::TokenOverlappingWindowChunkerConfig readonly
- #chunker_name ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(chunker_name:, chunker_config: OMIT, additional_properties: nil) ⇒ Vellum::TokenOverlappingWindowChunking constructor
- #to_json ⇒ String
Constructor Details
#initialize(chunker_name:, chunker_config: OMIT, additional_properties: nil) ⇒ Vellum::TokenOverlappingWindowChunking
25 26 27 28 29 30 31 32 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 25 def initialize(chunker_name:, chunker_config: OMIT, additional_properties: nil) @chunker_name = chunker_name @chunker_config = chunker_config if chunker_config != OMIT @additional_properties = additional_properties @_field_set = { "chunker_name": chunker_name, "chunker_config": chunker_config }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
14 15 16 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 14 def additional_properties @additional_properties end |
#chunker_config ⇒ Vellum::TokenOverlappingWindowChunkerConfig (readonly)
12 13 14 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 12 def chunker_config @chunker_config end |
#chunker_name ⇒ String (readonly)
10 11 12 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 10 def chunker_name @chunker_name end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::TokenOverlappingWindowChunking
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 37 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) chunker_name = parsed_json["chunker_name"] unless parsed_json["chunker_config"].nil? chunker_config = parsed_json["chunker_config"].to_json chunker_config = Vellum::TokenOverlappingWindowChunkerConfig.from_json(json_object: chunker_config) else chunker_config = nil end new( chunker_name: chunker_name, chunker_config: chunker_config, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
65 66 67 68 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 65 def self.validate_raw(obj:) obj.chunker_name.is_a?(String) != false || raise("Passed value for field obj.chunker_name is not the expected type, validation failed.") obj.chunker_config.nil? || Vellum::TokenOverlappingWindowChunkerConfig.validate_raw(obj: obj.chunker_config) end |
Instance Method Details
#to_json ⇒ String
56 57 58 |
# File 'lib/vellum_ai/types/token_overlapping_window_chunking.rb', line 56 def to_json @_field_set&.to_json end |