openai 0.27.1 → 0.28.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/README.md +1 -1
  4. data/lib/openai/internal/transport/pooled_net_requester.rb +7 -10
  5. data/lib/openai/internal/type/base_stream.rb +0 -17
  6. data/lib/openai/models/batch.rb +23 -1
  7. data/lib/openai/models/batch_usage.rb +84 -0
  8. data/lib/openai/models/conversations/conversation_item.rb +37 -1
  9. data/lib/openai/models/responses/response_custom_tool_call_output.rb +47 -4
  10. data/lib/openai/models/responses/response_function_call_arguments_done_event.rb +9 -1
  11. data/lib/openai/models/responses/response_function_call_output_item.rb +26 -0
  12. data/lib/openai/models/responses/response_function_call_output_item_list.rb +11 -0
  13. data/lib/openai/models/responses/response_function_tool_call_output_item.rb +47 -4
  14. data/lib/openai/models/responses/response_input_file_content.rb +52 -0
  15. data/lib/openai/models/responses/response_input_image_content.rb +65 -0
  16. data/lib/openai/models/responses/response_input_item.rb +56 -5
  17. data/lib/openai/models/responses/response_input_text_content.rb +28 -0
  18. data/lib/openai/models/responses/response_item.rb +37 -1
  19. data/lib/openai/models/responses/response_output_item.rb +37 -1
  20. data/lib/openai/models.rb +2 -0
  21. data/lib/openai/version.rb +1 -1
  22. data/lib/openai.rb +6 -0
  23. data/rbi/openai/internal/type/base_stream.rbi +0 -15
  24. data/rbi/openai/models/batch.rbi +35 -1
  25. data/rbi/openai/models/batch_usage.rbi +139 -0
  26. data/rbi/openai/models/conversations/conversation_item.rbi +90 -1
  27. data/rbi/openai/models/responses/response_custom_tool_call_output.rbi +77 -5
  28. data/rbi/openai/models/responses/response_function_call_arguments_done_event.rbi +8 -0
  29. data/rbi/openai/models/responses/response_function_call_output_item.rbi +31 -0
  30. data/rbi/openai/models/responses/response_function_call_output_item_list.rbi +15 -0
  31. data/rbi/openai/models/responses/response_function_tool_call_output_item.rbi +72 -5
  32. data/rbi/openai/models/responses/response_input_file_content.rbi +75 -0
  33. data/rbi/openai/models/responses/response_input_image_content.rbi +125 -0
  34. data/rbi/openai/models/responses/response_input_item.rbi +126 -6
  35. data/rbi/openai/models/responses/response_input_text_content.rbi +39 -0
  36. data/rbi/openai/models/responses/response_item.rbi +86 -1
  37. data/rbi/openai/models/responses/response_output_item.rbi +90 -1
  38. data/rbi/openai/models.rbi +2 -0
  39. data/sig/openai/internal/type/base_stream.rbs +0 -4
  40. data/sig/openai/models/batch.rbs +16 -2
  41. data/sig/openai/models/batch_usage.rbs +60 -0
  42. data/sig/openai/models/conversations/conversation_item.rbs +31 -2
  43. data/sig/openai/models/responses/response_custom_tool_call_output.rbs +27 -4
  44. data/sig/openai/models/responses/response_function_call_arguments_done_event.rbs +5 -0
  45. data/sig/openai/models/responses/response_function_call_output_item.rbs +16 -0
  46. data/sig/openai/models/responses/response_function_call_output_item_list.rbs +10 -0
  47. data/sig/openai/models/responses/response_function_tool_call_output_item.rbs +27 -4
  48. data/sig/openai/models/responses/response_input_file_content.rbs +42 -0
  49. data/sig/openai/models/responses/response_input_image_content.rbs +49 -0
  50. data/sig/openai/models/responses/response_input_item.rbs +45 -6
  51. data/sig/openai/models/responses/response_input_text_content.rbs +17 -0
  52. data/sig/openai/models/responses/response_item.rbs +31 -2
  53. data/sig/openai/models/responses/response_output_item.rbs +31 -2
  54. data/sig/openai/models.rbs +2 -0
  55. metadata +20 -2
@@ -508,8 +508,12 @@ module OpenAI
508
508
  sig { returns(String) }
509
509
  attr_accessor :call_id
510
510
 
511
- # A JSON string of the output of the function tool call.
512
- sig { returns(String) }
511
+ # Text, image, or file output of the function tool call.
512
+ sig do
513
+ returns(
514
+ OpenAI::Responses::ResponseInputItem::FunctionCallOutput::Output::Variants
515
+ )
516
+ end
513
517
  attr_accessor :output
514
518
 
515
519
  # The type of the function tool call output. Always `function_call_output`.
@@ -536,7 +540,8 @@ module OpenAI
536
540
  sig do
537
541
  params(
538
542
  call_id: String,
539
- output: String,
543
+ output:
544
+ OpenAI::Responses::ResponseInputItem::FunctionCallOutput::Output::Variants,
540
545
  id: T.nilable(String),
541
546
  status:
542
547
  T.nilable(
@@ -548,7 +553,7 @@ module OpenAI
548
553
  def self.new(
549
554
  # The unique ID of the function tool call generated by the model.
550
555
  call_id:,
551
- # A JSON string of the output of the function tool call.
556
+ # Text, image, or file output of the function tool call.
552
557
  output:,
553
558
  # The unique ID of the function tool call output. Populated when this item is
554
559
  # returned via API.
@@ -565,7 +570,8 @@ module OpenAI
565
570
  override.returns(
566
571
  {
567
572
  call_id: String,
568
- output: String,
573
+ output:
574
+ OpenAI::Responses::ResponseInputItem::FunctionCallOutput::Output::Variants,
569
575
  type: Symbol,
570
576
  id: T.nilable(String),
571
577
  status:
@@ -578,6 +584,31 @@ module OpenAI
578
584
  def to_hash
579
585
  end
580
586
 
587
+ # Text, image, or file output of the function tool call.
588
+ module Output
589
+ extend OpenAI::Internal::Type::Union
590
+
591
+ Variants =
592
+ T.type_alias do
593
+ T.any(
594
+ String,
595
+ T::Array[
596
+ OpenAI::Responses::ResponseFunctionCallOutputItem::Variants
597
+ ]
598
+ )
599
+ end
600
+
601
+ sig do
602
+ override.returns(
603
+ T::Array[
604
+ OpenAI::Responses::ResponseInputItem::FunctionCallOutput::Output::Variants
605
+ ]
606
+ )
607
+ end
608
+ def self.variants
609
+ end
610
+ end
611
+
581
612
  # The status of the item. One of `in_progress`, `completed`, or `incomplete`.
582
613
  # Populated when items are returned via API.
583
614
  module Status
@@ -1350,6 +1381,12 @@ module OpenAI
1350
1381
  sig { returns(Symbol) }
1351
1382
  attr_accessor :type
1352
1383
 
1384
+ # Unique identifier for the MCP tool call approval request. Include this value in
1385
+ # a subsequent `mcp_approval_response` input to approve or reject the
1386
+ # corresponding tool call.
1387
+ sig { returns(T.nilable(String)) }
1388
+ attr_accessor :approval_request_id
1389
+
1353
1390
  # The error from the tool call, if any.
1354
1391
  sig { returns(T.nilable(String)) }
1355
1392
  attr_accessor :error
@@ -1358,6 +1395,25 @@ module OpenAI
1358
1395
  sig { returns(T.nilable(String)) }
1359
1396
  attr_accessor :output
1360
1397
 
1398
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
1399
+ # `calling`, or `failed`.
1400
+ sig do
1401
+ returns(
1402
+ T.nilable(
1403
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::OrSymbol
1404
+ )
1405
+ )
1406
+ end
1407
+ attr_reader :status
1408
+
1409
+ sig do
1410
+ params(
1411
+ status:
1412
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::OrSymbol
1413
+ ).void
1414
+ end
1415
+ attr_writer :status
1416
+
1361
1417
  # An invocation of a tool on an MCP server.
1362
1418
  sig do
1363
1419
  params(
@@ -1365,8 +1421,11 @@ module OpenAI
1365
1421
  arguments: String,
1366
1422
  name: String,
1367
1423
  server_label: String,
1424
+ approval_request_id: T.nilable(String),
1368
1425
  error: T.nilable(String),
1369
1426
  output: T.nilable(String),
1427
+ status:
1428
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::OrSymbol,
1370
1429
  type: Symbol
1371
1430
  ).returns(T.attached_class)
1372
1431
  end
@@ -1379,10 +1438,17 @@ module OpenAI
1379
1438
  name:,
1380
1439
  # The label of the MCP server running the tool.
1381
1440
  server_label:,
1441
+ # Unique identifier for the MCP tool call approval request. Include this value in
1442
+ # a subsequent `mcp_approval_response` input to approve or reject the
1443
+ # corresponding tool call.
1444
+ approval_request_id: nil,
1382
1445
  # The error from the tool call, if any.
1383
1446
  error: nil,
1384
1447
  # The output from the tool call.
1385
1448
  output: nil,
1449
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
1450
+ # `calling`, or `failed`.
1451
+ status: nil,
1386
1452
  # The type of the item. Always `mcp_call`.
1387
1453
  type: :mcp_call
1388
1454
  )
@@ -1396,13 +1462,67 @@ module OpenAI
1396
1462
  name: String,
1397
1463
  server_label: String,
1398
1464
  type: Symbol,
1465
+ approval_request_id: T.nilable(String),
1399
1466
  error: T.nilable(String),
1400
- output: T.nilable(String)
1467
+ output: T.nilable(String),
1468
+ status:
1469
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::OrSymbol
1401
1470
  }
1402
1471
  )
1403
1472
  end
1404
1473
  def to_hash
1405
1474
  end
1475
+
1476
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
1477
+ # `calling`, or `failed`.
1478
+ module Status
1479
+ extend OpenAI::Internal::Type::Enum
1480
+
1481
+ TaggedSymbol =
1482
+ T.type_alias do
1483
+ T.all(
1484
+ Symbol,
1485
+ OpenAI::Responses::ResponseInputItem::McpCall::Status
1486
+ )
1487
+ end
1488
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
1489
+
1490
+ IN_PROGRESS =
1491
+ T.let(
1492
+ :in_progress,
1493
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1494
+ )
1495
+ COMPLETED =
1496
+ T.let(
1497
+ :completed,
1498
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1499
+ )
1500
+ INCOMPLETE =
1501
+ T.let(
1502
+ :incomplete,
1503
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1504
+ )
1505
+ CALLING =
1506
+ T.let(
1507
+ :calling,
1508
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1509
+ )
1510
+ FAILED =
1511
+ T.let(
1512
+ :failed,
1513
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1514
+ )
1515
+
1516
+ sig do
1517
+ override.returns(
1518
+ T::Array[
1519
+ OpenAI::Responses::ResponseInputItem::McpCall::Status::TaggedSymbol
1520
+ ]
1521
+ )
1522
+ end
1523
+ def self.values
1524
+ end
1525
+ end
1406
1526
  end
1407
1527
 
1408
1528
  class ItemReference < OpenAI::Internal::Type::BaseModel
@@ -0,0 +1,39 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ResponseInputTextContent < OpenAI::Internal::Type::BaseModel
7
+ OrHash =
8
+ T.type_alias do
9
+ T.any(
10
+ OpenAI::Responses::ResponseInputTextContent,
11
+ OpenAI::Internal::AnyHash
12
+ )
13
+ end
14
+
15
+ # The text input to the model.
16
+ sig { returns(String) }
17
+ attr_accessor :text
18
+
19
+ # The type of the input item. Always `input_text`.
20
+ sig { returns(Symbol) }
21
+ attr_accessor :type
22
+
23
+ # A text input to the model.
24
+ sig { params(text: String, type: Symbol).returns(T.attached_class) }
25
+ def self.new(
26
+ # The text input to the model.
27
+ text:,
28
+ # The type of the input item. Always `input_text`.
29
+ type: :input_text
30
+ )
31
+ end
32
+
33
+ sig { override.returns({ text: String, type: Symbol }) }
34
+ def to_hash
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -754,6 +754,12 @@ module OpenAI
754
754
  sig { returns(Symbol) }
755
755
  attr_accessor :type
756
756
 
757
+ # Unique identifier for the MCP tool call approval request. Include this value in
758
+ # a subsequent `mcp_approval_response` input to approve or reject the
759
+ # corresponding tool call.
760
+ sig { returns(T.nilable(String)) }
761
+ attr_accessor :approval_request_id
762
+
757
763
  # The error from the tool call, if any.
758
764
  sig { returns(T.nilable(String)) }
759
765
  attr_accessor :error
@@ -762,6 +768,24 @@ module OpenAI
762
768
  sig { returns(T.nilable(String)) }
763
769
  attr_accessor :output
764
770
 
771
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
772
+ # `calling`, or `failed`.
773
+ sig do
774
+ returns(
775
+ T.nilable(
776
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
777
+ )
778
+ )
779
+ end
780
+ attr_reader :status
781
+
782
+ sig do
783
+ params(
784
+ status: OpenAI::Responses::ResponseItem::McpCall::Status::OrSymbol
785
+ ).void
786
+ end
787
+ attr_writer :status
788
+
765
789
  # An invocation of a tool on an MCP server.
766
790
  sig do
767
791
  params(
@@ -769,8 +793,11 @@ module OpenAI
769
793
  arguments: String,
770
794
  name: String,
771
795
  server_label: String,
796
+ approval_request_id: T.nilable(String),
772
797
  error: T.nilable(String),
773
798
  output: T.nilable(String),
799
+ status:
800
+ OpenAI::Responses::ResponseItem::McpCall::Status::OrSymbol,
774
801
  type: Symbol
775
802
  ).returns(T.attached_class)
776
803
  end
@@ -783,10 +810,17 @@ module OpenAI
783
810
  name:,
784
811
  # The label of the MCP server running the tool.
785
812
  server_label:,
813
+ # Unique identifier for the MCP tool call approval request. Include this value in
814
+ # a subsequent `mcp_approval_response` input to approve or reject the
815
+ # corresponding tool call.
816
+ approval_request_id: nil,
786
817
  # The error from the tool call, if any.
787
818
  error: nil,
788
819
  # The output from the tool call.
789
820
  output: nil,
821
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
822
+ # `calling`, or `failed`.
823
+ status: nil,
790
824
  # The type of the item. Always `mcp_call`.
791
825
  type: :mcp_call
792
826
  )
@@ -800,13 +834,64 @@ module OpenAI
800
834
  name: String,
801
835
  server_label: String,
802
836
  type: Symbol,
837
+ approval_request_id: T.nilable(String),
803
838
  error: T.nilable(String),
804
- output: T.nilable(String)
839
+ output: T.nilable(String),
840
+ status:
841
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
805
842
  }
806
843
  )
807
844
  end
808
845
  def to_hash
809
846
  end
847
+
848
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
849
+ # `calling`, or `failed`.
850
+ module Status
851
+ extend OpenAI::Internal::Type::Enum
852
+
853
+ TaggedSymbol =
854
+ T.type_alias do
855
+ T.all(Symbol, OpenAI::Responses::ResponseItem::McpCall::Status)
856
+ end
857
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
858
+
859
+ IN_PROGRESS =
860
+ T.let(
861
+ :in_progress,
862
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
863
+ )
864
+ COMPLETED =
865
+ T.let(
866
+ :completed,
867
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
868
+ )
869
+ INCOMPLETE =
870
+ T.let(
871
+ :incomplete,
872
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
873
+ )
874
+ CALLING =
875
+ T.let(
876
+ :calling,
877
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
878
+ )
879
+ FAILED =
880
+ T.let(
881
+ :failed,
882
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
883
+ )
884
+
885
+ sig do
886
+ override.returns(
887
+ T::Array[
888
+ OpenAI::Responses::ResponseItem::McpCall::Status::TaggedSymbol
889
+ ]
890
+ )
891
+ end
892
+ def self.values
893
+ end
894
+ end
810
895
  end
811
896
 
812
897
  sig do
@@ -370,6 +370,12 @@ module OpenAI
370
370
  sig { returns(Symbol) }
371
371
  attr_accessor :type
372
372
 
373
+ # Unique identifier for the MCP tool call approval request. Include this value in
374
+ # a subsequent `mcp_approval_response` input to approve or reject the
375
+ # corresponding tool call.
376
+ sig { returns(T.nilable(String)) }
377
+ attr_accessor :approval_request_id
378
+
373
379
  # The error from the tool call, if any.
374
380
  sig { returns(T.nilable(String)) }
375
381
  attr_accessor :error
@@ -378,6 +384,25 @@ module OpenAI
378
384
  sig { returns(T.nilable(String)) }
379
385
  attr_accessor :output
380
386
 
387
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
388
+ # `calling`, or `failed`.
389
+ sig do
390
+ returns(
391
+ T.nilable(
392
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
393
+ )
394
+ )
395
+ end
396
+ attr_reader :status
397
+
398
+ sig do
399
+ params(
400
+ status:
401
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::OrSymbol
402
+ ).void
403
+ end
404
+ attr_writer :status
405
+
381
406
  # An invocation of a tool on an MCP server.
382
407
  sig do
383
408
  params(
@@ -385,8 +410,11 @@ module OpenAI
385
410
  arguments: String,
386
411
  name: String,
387
412
  server_label: String,
413
+ approval_request_id: T.nilable(String),
388
414
  error: T.nilable(String),
389
415
  output: T.nilable(String),
416
+ status:
417
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::OrSymbol,
390
418
  type: Symbol
391
419
  ).returns(T.attached_class)
392
420
  end
@@ -399,10 +427,17 @@ module OpenAI
399
427
  name:,
400
428
  # The label of the MCP server running the tool.
401
429
  server_label:,
430
+ # Unique identifier for the MCP tool call approval request. Include this value in
431
+ # a subsequent `mcp_approval_response` input to approve or reject the
432
+ # corresponding tool call.
433
+ approval_request_id: nil,
402
434
  # The error from the tool call, if any.
403
435
  error: nil,
404
436
  # The output from the tool call.
405
437
  output: nil,
438
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
439
+ # `calling`, or `failed`.
440
+ status: nil,
406
441
  # The type of the item. Always `mcp_call`.
407
442
  type: :mcp_call
408
443
  )
@@ -416,13 +451,67 @@ module OpenAI
416
451
  name: String,
417
452
  server_label: String,
418
453
  type: Symbol,
454
+ approval_request_id: T.nilable(String),
419
455
  error: T.nilable(String),
420
- output: T.nilable(String)
456
+ output: T.nilable(String),
457
+ status:
458
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
421
459
  }
422
460
  )
423
461
  end
424
462
  def to_hash
425
463
  end
464
+
465
+ # The status of the tool call. One of `in_progress`, `completed`, `incomplete`,
466
+ # `calling`, or `failed`.
467
+ module Status
468
+ extend OpenAI::Internal::Type::Enum
469
+
470
+ TaggedSymbol =
471
+ T.type_alias do
472
+ T.all(
473
+ Symbol,
474
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status
475
+ )
476
+ end
477
+ OrSymbol = T.type_alias { T.any(Symbol, String) }
478
+
479
+ IN_PROGRESS =
480
+ T.let(
481
+ :in_progress,
482
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
483
+ )
484
+ COMPLETED =
485
+ T.let(
486
+ :completed,
487
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
488
+ )
489
+ INCOMPLETE =
490
+ T.let(
491
+ :incomplete,
492
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
493
+ )
494
+ CALLING =
495
+ T.let(
496
+ :calling,
497
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
498
+ )
499
+ FAILED =
500
+ T.let(
501
+ :failed,
502
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
503
+ )
504
+
505
+ sig do
506
+ override.returns(
507
+ T::Array[
508
+ OpenAI::Responses::ResponseOutputItem::McpCall::Status::TaggedSymbol
509
+ ]
510
+ )
511
+ end
512
+ def self.values
513
+ end
514
+ end
426
515
  end
427
516
 
428
517
  class McpListTools < OpenAI::Internal::Type::BaseModel
@@ -25,6 +25,8 @@ module OpenAI
25
25
 
26
26
  BatchRetrieveParams = OpenAI::Models::BatchRetrieveParams
27
27
 
28
+ BatchUsage = OpenAI::Models::BatchUsage
29
+
28
30
  Beta = OpenAI::Models::Beta
29
31
 
30
32
  Chat = OpenAI::Models::Chat
@@ -4,10 +4,6 @@ module OpenAI
4
4
  module BaseStream[Message, Elem]
5
5
  include Enumerable[Elem]
6
6
 
7
- def self.defer_closing: (
8
- Enumerable[top] stream
9
- ) -> (^(Integer arg0) -> void)
10
-
11
7
  attr_reader status: Integer
12
8
 
13
9
  attr_reader headers: ::Hash[String, String]
@@ -20,8 +20,10 @@ module OpenAI
20
20
  finalizing_at: Integer,
21
21
  in_progress_at: Integer,
22
22
  metadata: OpenAI::Models::metadata?,
23
+ model: String,
23
24
  output_file_id: String,
24
- request_counts: OpenAI::BatchRequestCounts
25
+ request_counts: OpenAI::BatchRequestCounts,
26
+ usage: OpenAI::BatchUsage
25
27
  }
26
28
 
27
29
  class Batch < OpenAI::Internal::Type::BaseModel
@@ -81,6 +83,10 @@ module OpenAI
81
83
 
82
84
  attr_accessor metadata: OpenAI::Models::metadata?
83
85
 
86
+ attr_reader model: String?
87
+
88
+ def model=: (String) -> String
89
+
84
90
  attr_reader output_file_id: String?
85
91
 
86
92
  def output_file_id=: (String) -> String
@@ -91,6 +97,10 @@ module OpenAI
91
97
  OpenAI::BatchRequestCounts
92
98
  ) -> OpenAI::BatchRequestCounts
93
99
 
100
+ attr_reader usage: OpenAI::BatchUsage?
101
+
102
+ def usage=: (OpenAI::BatchUsage) -> OpenAI::BatchUsage
103
+
94
104
  def initialize: (
95
105
  id: String,
96
106
  completion_window: String,
@@ -109,8 +119,10 @@ module OpenAI
109
119
  ?finalizing_at: Integer,
110
120
  ?in_progress_at: Integer,
111
121
  ?metadata: OpenAI::Models::metadata?,
122
+ ?model: String,
112
123
  ?output_file_id: String,
113
124
  ?request_counts: OpenAI::BatchRequestCounts,
125
+ ?usage: OpenAI::BatchUsage,
114
126
  ?object: :batch
115
127
  ) -> void
116
128
 
@@ -133,8 +145,10 @@ module OpenAI
133
145
  finalizing_at: Integer,
134
146
  in_progress_at: Integer,
135
147
  metadata: OpenAI::Models::metadata?,
148
+ model: String,
136
149
  output_file_id: String,
137
- request_counts: OpenAI::BatchRequestCounts
150
+ request_counts: OpenAI::BatchRequestCounts,
151
+ usage: OpenAI::BatchUsage
138
152
  }
139
153
 
140
154
  type status =
@@ -0,0 +1,60 @@
1
+ module OpenAI
2
+ module Models
3
+ type batch_usage =
4
+ {
5
+ input_tokens: Integer,
6
+ input_tokens_details: OpenAI::BatchUsage::InputTokensDetails,
7
+ output_tokens: Integer,
8
+ output_tokens_details: OpenAI::BatchUsage::OutputTokensDetails,
9
+ total_tokens: Integer
10
+ }
11
+
12
+ class BatchUsage < OpenAI::Internal::Type::BaseModel
13
+ attr_accessor input_tokens: Integer
14
+
15
+ attr_accessor input_tokens_details: OpenAI::BatchUsage::InputTokensDetails
16
+
17
+ attr_accessor output_tokens: Integer
18
+
19
+ attr_accessor output_tokens_details: OpenAI::BatchUsage::OutputTokensDetails
20
+
21
+ attr_accessor total_tokens: Integer
22
+
23
+ def initialize: (
24
+ input_tokens: Integer,
25
+ input_tokens_details: OpenAI::BatchUsage::InputTokensDetails,
26
+ output_tokens: Integer,
27
+ output_tokens_details: OpenAI::BatchUsage::OutputTokensDetails,
28
+ total_tokens: Integer
29
+ ) -> void
30
+
31
+ def to_hash: -> {
32
+ input_tokens: Integer,
33
+ input_tokens_details: OpenAI::BatchUsage::InputTokensDetails,
34
+ output_tokens: Integer,
35
+ output_tokens_details: OpenAI::BatchUsage::OutputTokensDetails,
36
+ total_tokens: Integer
37
+ }
38
+
39
+ type input_tokens_details = { cached_tokens: Integer }
40
+
41
+ class InputTokensDetails < OpenAI::Internal::Type::BaseModel
42
+ attr_accessor cached_tokens: Integer
43
+
44
+ def initialize: (cached_tokens: Integer) -> void
45
+
46
+ def to_hash: -> { cached_tokens: Integer }
47
+ end
48
+
49
+ type output_tokens_details = { reasoning_tokens: Integer }
50
+
51
+ class OutputTokensDetails < OpenAI::Internal::Type::BaseModel
52
+ attr_accessor reasoning_tokens: Integer
53
+
54
+ def initialize: (reasoning_tokens: Integer) -> void
55
+
56
+ def to_hash: -> { reasoning_tokens: Integer }
57
+ end
58
+ end
59
+ end
60
+ end