Skip to content

Commit 97c8508

Browse files
committed
feat(openai.rb): add support for vector store file batches to handle vector store file batch operations
feat(client.rb): add vector_store_file_batches method to OpenAI::Client to access vector store file batch operations feat(vector_store_file_batches.rb): create VectorStoreFileBatches class to handle vector store file batch operations
1 parent 395bf3e commit 97c8508

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

lib/openai.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
require_relative "openai/run_steps"
1515
require_relative "openai/vector_stores"
1616
require_relative "openai/vector_store_files"
17+
require_relative "openai/vector_store_file_batches"
1718
require_relative "openai/audio"
1819
require_relative "openai/version"
1920
require_relative "openai/batches"

lib/openai/client.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ def vector_store_files
8686
@vector_store_files ||= OpenAI::VectorStoreFiles.new(client: self)
8787
end
8888

89+
def vector_store_file_batches
90+
@vector_store_file_batches ||= OpenAI::VectorStoreFileBatches.new(client: self)
91+
end
92+
8993
def batches
9094
@batches ||= OpenAI::Batches.new(client: self)
9195
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module OpenAI
2+
class VectorStoreFileBatches
3+
def initialize(client:)
4+
@client = client.beta(assistants: OpenAI::Assistants::BETA_VERSION)
5+
end
6+
7+
def list(vector_store_id:, id:, parameters: {})
8+
@client.get(path: "/vector_stores/#{vector_store_id}/file_batches/#{id}/files", parameters: parameters)
9+
end
10+
11+
def retrieve(vector_store_id:, id:)
12+
@client.get(path: "/vector_stores/#{vector_store_id}/file_batches/#{id}")
13+
end
14+
15+
def create(vector_store_id:, parameters: {})
16+
@client.json_post(path: "/vector_stores/#{vector_store_id}/file_batches", parameters: parameters)
17+
end
18+
19+
def cancel(vector_store_id:, id:)
20+
@client.post(path: "/vector_stores/#{vector_store_id}/file_batches/#{id}/cancel")
21+
end
22+
end
23+
end

0 commit comments

Comments
 (0)