Class: OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore

Inherits:
Internal::Type::BaseModel show all
Defined in:
lib/openai/models/beta/thread_create_params.rb,
sig/openai/models/beta/thread_create_params.rbs

Defined Under Namespace

Modules: ChunkingStrategy

Instance Attribute Summary collapse

Attributes inherited from Internal::Type::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Internal::Type::BaseModel

==, #==, #[], #_request_id, #_set_last_response, coerce, #deconstruct_keys, #deep_to_h, dump, #encode_with, 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, coerce_with_error, 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(chunking_strategy: nil, file_ids: nil, metadata: nil) ⇒ Object

Parameters:

  • chunking_strategy (defaults to: nil)

    The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.

  • file_ids (defaults to: nil)

    A list of file IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.

  • metadata (defaults to: nil)

    Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

    Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/openai/models/beta/thread_create_params.rb', line 291

class VectorStore < OpenAI::Internal::Type::BaseModel
  # @!attribute chunking_strategy
  #   The chunking strategy used to chunk the file(s). If not set, will use the `auto`
  #   strategy.
  #
  #   @return [OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto, OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static, nil]
  optional(
    :chunking_strategy,
    union: -> {
      OpenAI::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy
    }
  )

  # @!attribute file_ids
  #   A list of [file](https://developers.openai.com/api/reference/resources/files)
  #   IDs to add to the vector store. For vector stores created before Nov 2025, there
  #   can be a maximum of 10,000 files in a vector store. For vector stores created
  #   starting in Nov 2025, the limit is 100,000,000 files.
  #
  #   @return [Array<String>, nil]
  optional :file_ids, OpenAI::Internal::Type::ArrayOf[String]

  # @!attribute metadata
  #   Set of 16 key-value pairs that can be attached to an object. This can be useful
  #   for storing additional information about the object in a structured format, and
  #   querying for objects via API or the dashboard.
  #
  #   Keys are strings with a maximum length of 64 characters. Values are strings with
  #   a maximum length of 512 characters.
  #
  #   @return [Hash{Symbol=>String}, nil]
  optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true

  # @!method initialize(chunking_strategy: nil, file_ids: nil, metadata: nil)
  #   @param chunking_strategy [OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto, OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static]
  #     The chunking strategy used to chunk the file(s). If not set, will use the `auto`
  #     strategy.
  #
  #   @param file_ids [Array<String>]
  #     A list of [file](https://developers.openai.com/api/reference/resources/files)
  #     IDs to add to the vector store. For vector stores created before Nov 2025, there
  #     can be a maximum of 10,000 files in a vector store. For vector stores created
  #     starting in Nov 2025, the limit is 100,000,000 files.
  #
  #   @param metadata [Hash{Symbol=>String}, nil]
  #     Set of 16 key-value pairs that can be attached to an object. This can be useful
  #     for storing additional information about the object in a structured format, and
  #     querying for objects via API or the dashboard.
  #
  #     Keys are strings with a maximum length of 64 characters. Values are strings with
  #     a maximum length of 512 characters.

  # The chunking strategy used to chunk the file(s). If not set, will use the `auto`
  # strategy.
  #
  # @see OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore#chunking_strategy
  module ChunkingStrategy
    extend OpenAI::Internal::Type::Union

    discriminator :type

    # The default strategy. This strategy currently uses a `max_chunk_size_tokens` of `800` and `chunk_overlap_tokens` of `400`.
    variant(
      :auto,
      -> {
        OpenAI::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto
      }
    )

    variant(
      :static,
      -> {
        OpenAI::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static
      }
    )

    class Auto < OpenAI::Internal::Type::BaseModel
      # @!attribute type
      #   Always `auto`.
      #
      #   @return [Symbol, :auto]
      required :type, const: :auto

      # @!method initialize(type: :auto)
      #   The default strategy. This strategy currently uses a `max_chunk_size_tokens` of
      #   `800` and `chunk_overlap_tokens` of `400`.
      #
      #   @param type [Symbol, :auto]
      #     Always `auto`.
    end

    class Static < OpenAI::Internal::Type::BaseModel
      # @!attribute static
      #
      #   @return [OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static::Static]
      required(
        :static,
        -> {
          OpenAI::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static::Static
        }
      )

      # @!attribute type
      #   Always `static`.
      #
      #   @return [Symbol, :static]
      required :type, const: :static

      # @!method initialize(static:, type: :static)
      #   @param static [OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static::Static]
      #
      #   @param type [Symbol, :static]
      #     Always `static`.

      # @see OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static#static
      class Static < OpenAI::Internal::Type::BaseModel
        # @!attribute chunk_overlap_tokens
        #   The number of tokens that overlap between chunks. The default value is `400`.
        #
        #   Note that the overlap must not exceed half of `max_chunk_size_tokens`.
        #
        #   @return [Integer]
        required :chunk_overlap_tokens, Integer

        # @!attribute max_chunk_size_tokens
        #   The maximum number of tokens in each chunk. The default value is `800`. The
        #   minimum value is `100` and the maximum value is `4096`.
        #
        #   @return [Integer]
        required :max_chunk_size_tokens, Integer

        # @!method initialize(chunk_overlap_tokens:, max_chunk_size_tokens:)
        #   @param chunk_overlap_tokens [Integer]
        #     The number of tokens that overlap between chunks. The default value is `400`.
        #
        #     Note that the overlap must not exceed half of `max_chunk_size_tokens`.
        #
        #   @param max_chunk_size_tokens [Integer]
        #     The maximum number of tokens in each chunk. The default value is `800`. The
        #     minimum value is `100` and the maximum value is `4096`.
      end
    end

    # @!method self.variants
    #   @return [Array(OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto, OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static)]
  end
end

Instance Attribute Details

#chunking_strategyOpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::chunking_strategy?

The chunking strategy used to chunk the file(s). If not set, will use the auto strategy.

Returns:

  • (OpenAI::Models::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::chunking_strategy, nil)


297
298
299
300
301
302
# File 'lib/openai/models/beta/thread_create_params.rb', line 297

optional(
  :chunking_strategy,
  union: -> {
    OpenAI::Beta::ThreadCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy
  }
)

#file_ids::Array[String]?

A list of file IDs to add to the vector store. For vector stores created before Nov 2025, there can be a maximum of 10,000 files in a vector store. For vector stores created starting in Nov 2025, the limit is 100,000,000 files.

Returns:

  • (::Array[String], nil)


311
# File 'lib/openai/models/beta/thread_create_params.rb', line 311

optional :file_ids, OpenAI::Internal::Type::ArrayOf[String]

#metadataOpenAI::Models::metadata?

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

Returns:

  • (OpenAI::Models::metadata, nil)


322
# File 'lib/openai/models/beta/thread_create_params.rb', line 322

optional :metadata, OpenAI::Internal::Type::HashOf[String], nil?: true

Instance Method Details

#to_hash{

Returns:

  • ({)


381
# File 'sig/openai/models/beta/thread_create_params.rbs', line 381

def to_hash: -> {