File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ def initialize(client:)
4
4
@client = client . beta ( assistants : OpenAI ::Assistants ::BETA_VERSION )
5
5
end
6
6
7
- def list
8
- @client . get ( path : "/batches" )
7
+ def list ( parameters : { } )
8
+ @client . get ( path : "/batches" , parameters : parameters )
9
9
end
10
10
11
11
def retrieve ( id :)
Original file line number Diff line number Diff line change 24
24
describe "#list" , :vcr do
25
25
let ( :input_cassette ) { "batches list input" }
26
26
let ( :cassette ) { "batches list" }
27
+ let ( :limit ) { 10 }
27
28
let ( :response ) { OpenAI ::Client . new . batches . list }
29
+ let ( :existing_batch ) do
30
+ OpenAI ::Client . new . batches . create (
31
+ parameters : {
32
+ input_file_id : input_file_id ,
33
+ endpoint : "/v1/chat/completions" ,
34
+ completion_window : "24h"
35
+ }
36
+ )
37
+ end
28
38
29
39
before { batch_id }
30
40
33
43
expect ( response . dig ( "data" , 0 , "object" ) ) . to eq ( "batch" )
34
44
end
35
45
end
46
+
47
+ it "supports after and limit parameters" do
48
+ VCR . use_cassette ( cassette ) do
49
+ response = OpenAI ::Client . new . batches . list ( parameters : {
50
+ after : existing_batch [ "id" ] ,
51
+ limit : limit
52
+ } )
53
+
54
+ expect ( response . dig ( "data" , 0 , "object" ) ) . to eq ( "batch" )
55
+ expect ( response [ "data" ] . length ) . to be <= limit
56
+ end
57
+ end
36
58
end
37
59
38
60
describe "#retrieve" do
You can’t perform that action at this time.
0 commit comments