Class: OpenAI::Resources::VectorStores::FileBatches

Inherits:
Object
  • Object
show all
Defined in:
lib/openai/resources/vector_stores/file_batches.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ FileBatches

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of FileBatches.

Parameters:



138
139
140
# File 'lib/openai/resources/vector_stores/file_batches.rb', line 138

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(batch_id, vector_store_id: , request_options: {}) ⇒ OpenAI::Models::VectorStores::VectorStoreFileBatch

Cancel a vector store file batch. This attempts to cancel the processing of files in this batch as soon as possible.

Parameters:

  • batch_id (String)

    The ID of the file batch to cancel.

  • vector_store_id (String)

    The ID of the vector store that the file batch belongs to.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/openai/resources/vector_stores/file_batches.rb', line 79

def cancel(batch_id, params)
  parsed, options = OpenAI::VectorStores::FileBatchCancelParams.dump_request(params)
  vector_store_id =
    parsed.delete(:vector_store_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["vector_stores/%1$s/file_batches/%2$s/cancel", vector_store_id, batch_id],
    model: OpenAI::VectorStores::VectorStoreFileBatch,
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#create(vector_store_id, file_ids: , attributes: nil, chunking_strategy: nil, request_options: {}) ⇒ OpenAI::Models::VectorStores::VectorStoreFileBatch

Some parameter documentations has been truncated, see Models::VectorStores::FileBatchCreateParams for more details.

Create a vector store file batch.

Parameters:

Returns:

See Also:



27
28
29
30
31
32
33
34
35
36
# File 'lib/openai/resources/vector_stores/file_batches.rb', line 27

def create(vector_store_id, params)
  parsed, options = OpenAI::VectorStores::FileBatchCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["vector_stores/%1$s/file_batches", vector_store_id],
    body: parsed,
    model: OpenAI::VectorStores::VectorStoreFileBatch,
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#list_files(batch_id, vector_store_id: , after: nil, before: nil, filter: nil, limit: nil, order: nil, request_options: {}) ⇒ OpenAI::Internal::CursorPage<OpenAI::Models::VectorStores::VectorStoreFile>

Some parameter documentations has been truncated, see Models::VectorStores::FileBatchListFilesParams for more details.

Returns a list of vector store files in a batch.

Parameters:

  • batch_id (String)

    Path param: The ID of the file batch that the files belong to.

  • vector_store_id (String)

    Path param: The ID of the vector store that the files belong to.

  • after (String)

    Query param: A cursor for use in pagination. ‘after` is an object ID that define

  • before (String)

    Query param: A cursor for use in pagination. ‘before` is an object ID that defin

  • filter (Symbol, OpenAI::Models::VectorStores::FileBatchListFilesParams::Filter)

    Query param: Filter by file status. One of ‘in_progress`, `completed`, `failed`,

  • limit (Integer)

    Query param: A limit on the number of objects to be returned. Limit can range be

  • order (Symbol, OpenAI::Models::VectorStores::FileBatchListFilesParams::Order)

    Query param: Sort order by the ‘created_at` timestamp of the objects. `asc` for

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/openai/resources/vector_stores/file_batches.rb', line 119

def list_files(batch_id, params)
  parsed, options = OpenAI::VectorStores::FileBatchListFilesParams.dump_request(params)
  vector_store_id =
    parsed.delete(:vector_store_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["vector_stores/%1$s/file_batches/%2$s/files", vector_store_id, batch_id],
    query: parsed,
    page: OpenAI::Internal::CursorPage,
    model: OpenAI::VectorStores::VectorStoreFile,
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end

#retrieve(batch_id, vector_store_id: , request_options: {}) ⇒ OpenAI::Models::VectorStores::VectorStoreFileBatch

Retrieves a vector store file batch.

Parameters:

  • batch_id (String)

    The ID of the file batch being retrieved.

  • vector_store_id (String)

    The ID of the vector store that the file batch belongs to.

  • request_options (OpenAI::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/openai/resources/vector_stores/file_batches.rb', line 51

def retrieve(batch_id, params)
  parsed, options = OpenAI::VectorStores::FileBatchRetrieveParams.dump_request(params)
  vector_store_id =
    parsed.delete(:vector_store_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["vector_stores/%1$s/file_batches/%2$s", vector_store_id, batch_id],
    model: OpenAI::VectorStores::VectorStoreFileBatch,
    options: {extra_headers: {"OpenAI-Beta" => "assistants=v2"}, **options}
  )
end