openai 0.11.0 → 0.13.0

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/README.md +5 -7
  4. data/lib/openai/helpers/streaming/events.rb +23 -0
  5. data/lib/openai/helpers/streaming/response_stream.rb +232 -0
  6. data/lib/openai/helpers/structured_output/parsed_json.rb +39 -0
  7. data/lib/openai/internal/stream.rb +2 -1
  8. data/lib/openai/internal/transport/base_client.rb +10 -2
  9. data/lib/openai/internal/type/base_stream.rb +3 -1
  10. data/lib/openai/models/audio/transcription.rb +4 -4
  11. data/lib/openai/models/audio/transcription_verbose.rb +4 -4
  12. data/lib/openai/models/chat/chat_completion_message.rb +1 -1
  13. data/lib/openai/models/chat/chat_completion_message_tool_call.rb +1 -1
  14. data/lib/openai/models/file_object.rb +5 -4
  15. data/lib/openai/models/responses/response_function_tool_call.rb +1 -1
  16. data/lib/openai/models/responses/response_input_file.rb +9 -1
  17. data/lib/openai/models/responses/response_mcp_call_arguments_delta_event.rb +5 -5
  18. data/lib/openai/models/responses/response_mcp_call_arguments_done_event.rb +5 -5
  19. data/lib/openai/models/responses/response_output_text.rb +1 -1
  20. data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +5 -5
  21. data/lib/openai/models/responses/response_stream_event.rb +3 -3
  22. data/lib/openai/models/responses/tool.rb +9 -1
  23. data/lib/openai/resources/chat/completions.rb +12 -4
  24. data/lib/openai/resources/responses.rb +248 -75
  25. data/lib/openai/streaming.rb +5 -0
  26. data/lib/openai/version.rb +1 -1
  27. data/lib/openai.rb +4 -0
  28. data/rbi/openai/helpers/streaming/events.rbi +31 -0
  29. data/rbi/openai/helpers/streaming/response_stream.rbi +104 -0
  30. data/rbi/openai/internal/type/base_stream.rbi +8 -1
  31. data/rbi/openai/models/audio/transcription.rbi +4 -4
  32. data/rbi/openai/models/audio/transcription_verbose.rbi +4 -6
  33. data/rbi/openai/models/file_object.rbi +7 -6
  34. data/rbi/openai/models/responses/response_input_file.rbi +11 -0
  35. data/rbi/openai/models/responses/response_mcp_call_arguments_delta_event.rbi +3 -3
  36. data/rbi/openai/models/responses/response_mcp_call_arguments_done_event.rbi +3 -3
  37. data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +3 -3
  38. data/rbi/openai/models/responses/tool.rbi +12 -1
  39. data/rbi/openai/resources/responses.rbi +126 -1
  40. data/rbi/openai/streaming.rbi +5 -0
  41. data/sig/openai/internal/type/base_stream.rbs +4 -0
  42. data/sig/openai/models/audio/transcription.rbs +4 -4
  43. data/sig/openai/models/audio/transcription_verbose.rbs +4 -4
  44. data/sig/openai/models/file_object.rbs +2 -0
  45. data/sig/openai/models/responses/response_input_file.rbs +7 -0
  46. data/sig/openai/models/responses/response_mcp_call_arguments_delta_event.rbs +4 -4
  47. data/sig/openai/models/responses/response_mcp_call_arguments_done_event.rbs +4 -4
  48. data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +4 -4
  49. data/sig/openai/models/responses/tool.rbs +9 -2
  50. metadata +9 -2
@@ -109,25 +109,23 @@ module OpenAI
109
109
 
110
110
  # Duration of the input audio in seconds.
111
111
  sig { returns(Float) }
112
- attr_accessor :duration
112
+ attr_accessor :seconds
113
113
 
114
114
  # The type of the usage object. Always `duration` for this variant.
115
115
  sig { returns(Symbol) }
116
116
  attr_accessor :type
117
117
 
118
118
  # Usage statistics for models billed by audio input duration.
119
- sig do
120
- params(duration: Float, type: Symbol).returns(T.attached_class)
121
- end
119
+ sig { params(seconds: Float, type: Symbol).returns(T.attached_class) }
122
120
  def self.new(
123
121
  # Duration of the input audio in seconds.
124
- duration:,
122
+ seconds:,
125
123
  # The type of the usage object. Always `duration` for this variant.
126
124
  type: :duration
127
125
  )
128
126
  end
129
127
 
130
- sig { override.returns({ duration: Float, type: Symbol }) }
128
+ sig { override.returns({ seconds: Float, type: Symbol }) }
131
129
  def to_hash
132
130
  end
133
131
  end
@@ -27,8 +27,8 @@ module OpenAI
27
27
  attr_accessor :object
28
28
 
29
29
  # The intended purpose of the file. Supported values are `assistants`,
30
- # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
31
- # and `vision`.
30
+ # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
31
+ # `vision`, and `user_data`.
32
32
  sig { returns(OpenAI::FileObject::Purpose::TaggedSymbol) }
33
33
  attr_accessor :purpose
34
34
 
@@ -76,8 +76,8 @@ module OpenAI
76
76
  # The name of the file.
77
77
  filename:,
78
78
  # The intended purpose of the file. Supported values are `assistants`,
79
- # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
80
- # and `vision`.
79
+ # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
80
+ # `vision`, and `user_data`.
81
81
  purpose:,
82
82
  # Deprecated. The current status of the file, which can be either `uploaded`,
83
83
  # `processed`, or `error`.
@@ -111,8 +111,8 @@ module OpenAI
111
111
  end
112
112
 
113
113
  # The intended purpose of the file. Supported values are `assistants`,
114
- # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`
115
- # and `vision`.
114
+ # `assistants_output`, `batch`, `batch_output`, `fine-tune`, `fine-tune-results`,
115
+ # `vision`, and `user_data`.
116
116
  module Purpose
117
117
  extend OpenAI::Internal::Type::Enum
118
118
 
@@ -132,6 +132,7 @@ module OpenAI
132
132
  FINE_TUNE_RESULTS =
133
133
  T.let(:"fine-tune-results", OpenAI::FileObject::Purpose::TaggedSymbol)
134
134
  VISION = T.let(:vision, OpenAI::FileObject::Purpose::TaggedSymbol)
135
+ USER_DATA = T.let(:user_data, OpenAI::FileObject::Purpose::TaggedSymbol)
135
136
 
136
137
  sig do
137
138
  override.returns(T::Array[OpenAI::FileObject::Purpose::TaggedSymbol])
@@ -27,6 +27,13 @@ module OpenAI
27
27
  sig { returns(T.nilable(String)) }
28
28
  attr_accessor :file_id
29
29
 
30
+ # The URL of the file to be sent to the model.
31
+ sig { returns(T.nilable(String)) }
32
+ attr_reader :file_url
33
+
34
+ sig { params(file_url: String).void }
35
+ attr_writer :file_url
36
+
30
37
  # The name of the file to be sent to the model.
31
38
  sig { returns(T.nilable(String)) }
32
39
  attr_reader :filename
@@ -39,6 +46,7 @@ module OpenAI
39
46
  params(
40
47
  file_data: String,
41
48
  file_id: T.nilable(String),
49
+ file_url: String,
42
50
  filename: String,
43
51
  type: Symbol
44
52
  ).returns(T.attached_class)
@@ -48,6 +56,8 @@ module OpenAI
48
56
  file_data: nil,
49
57
  # The ID of the file to be sent to the model.
50
58
  file_id: nil,
59
+ # The URL of the file to be sent to the model.
60
+ file_url: nil,
51
61
  # The name of the file to be sent to the model.
52
62
  filename: nil,
53
63
  # The type of the input item. Always `input_file`.
@@ -61,6 +71,7 @@ module OpenAI
61
71
  type: Symbol,
62
72
  file_data: String,
63
73
  file_id: T.nilable(String),
74
+ file_url: String,
64
75
  filename: String
65
76
  }
66
77
  )
@@ -28,7 +28,7 @@ module OpenAI
28
28
  sig { returns(Integer) }
29
29
  attr_accessor :sequence_number
30
30
 
31
- # The type of the event. Always 'response.mcp_call.arguments_delta'.
31
+ # The type of the event. Always 'response.mcp_call_arguments.delta'.
32
32
  sig { returns(Symbol) }
33
33
  attr_accessor :type
34
34
 
@@ -52,8 +52,8 @@ module OpenAI
52
52
  output_index:,
53
53
  # The sequence number of this event.
54
54
  sequence_number:,
55
- # The type of the event. Always 'response.mcp_call.arguments_delta'.
56
- type: :"response.mcp_call.arguments_delta"
55
+ # The type of the event. Always 'response.mcp_call_arguments.delta'.
56
+ type: :"response.mcp_call_arguments.delta"
57
57
  )
58
58
  end
59
59
 
@@ -28,7 +28,7 @@ module OpenAI
28
28
  sig { returns(Integer) }
29
29
  attr_accessor :sequence_number
30
30
 
31
- # The type of the event. Always 'response.mcp_call.arguments_done'.
31
+ # The type of the event. Always 'response.mcp_call_arguments.done'.
32
32
  sig { returns(Symbol) }
33
33
  attr_accessor :type
34
34
 
@@ -51,8 +51,8 @@ module OpenAI
51
51
  output_index:,
52
52
  # The sequence number of this event.
53
53
  sequence_number:,
54
- # The type of the event. Always 'response.mcp_call.arguments_done'.
55
- type: :"response.mcp_call.arguments_done"
54
+ # The type of the event. Always 'response.mcp_call_arguments.done'.
55
+ type: :"response.mcp_call_arguments.done"
56
56
  )
57
57
  end
58
58
 
@@ -36,7 +36,7 @@ module OpenAI
36
36
  sig { returns(Integer) }
37
37
  attr_accessor :sequence_number
38
38
 
39
- # The type of the event. Always 'response.output_text_annotation.added'.
39
+ # The type of the event. Always 'response.output_text.annotation.added'.
40
40
  sig { returns(Symbol) }
41
41
  attr_accessor :type
42
42
 
@@ -65,8 +65,8 @@ module OpenAI
65
65
  output_index:,
66
66
  # The sequence number of this event.
67
67
  sequence_number:,
68
- # The type of the event. Always 'response.output_text_annotation.added'.
69
- type: :"response.output_text_annotation.added"
68
+ # The type of the event. Always 'response.output_text.annotation.added'.
69
+ type: :"response.output_text.annotation.added"
70
70
  )
71
71
  end
72
72
 
@@ -70,6 +70,13 @@ module OpenAI
70
70
  end
71
71
  attr_accessor :require_approval
72
72
 
73
+ # Optional description of the MCP server, used to provide more context.
74
+ sig { returns(T.nilable(String)) }
75
+ attr_reader :server_description
76
+
77
+ sig { params(server_description: String).void }
78
+ attr_writer :server_description
79
+
73
80
  # Give the model access to additional tools via remote Model Context Protocol
74
81
  # (MCP) servers.
75
82
  # [Learn more about MCP](https://platform.openai.com/docs/guides/tools-remote-mcp).
@@ -92,6 +99,7 @@ module OpenAI
92
99
  OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
93
100
  )
94
101
  ),
102
+ server_description: String,
95
103
  type: Symbol
96
104
  ).returns(T.attached_class)
97
105
  end
@@ -107,6 +115,8 @@ module OpenAI
107
115
  headers: nil,
108
116
  # Specify which of the MCP server's tools require approval.
109
117
  require_approval: nil,
118
+ # Optional description of the MCP server, used to provide more context.
119
+ server_description: nil,
110
120
  # The type of the MCP tool. Always `mcp`.
111
121
  type: :mcp
112
122
  )
@@ -132,7 +142,8 @@ module OpenAI
132
142
  OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalFilter,
133
143
  OpenAI::Responses::Tool::Mcp::RequireApproval::McpToolApprovalSetting::OrSymbol
134
144
  )
135
- )
145
+ ),
146
+ server_description: String
136
147
  }
137
148
  )
138
149
  end
@@ -275,7 +275,13 @@ module OpenAI
275
275
  ),
276
276
  store: T.nilable(T::Boolean),
277
277
  temperature: T.nilable(Float),
278
- text: OpenAI::Responses::ResponseTextConfig::OrHash,
278
+ text:
279
+ T.nilable(
280
+ T.any(
281
+ OpenAI::Responses::ResponseTextConfig::OrHash,
282
+ OpenAI::StructuredOutput::JsonSchemaConverter
283
+ )
284
+ ),
279
285
  tool_choice:
280
286
  T.any(
281
287
  OpenAI::Responses::ToolChoiceOptions::OrSymbol,
@@ -462,6 +468,125 @@ module OpenAI
462
468
  )
463
469
  end
464
470
 
471
+ # See {OpenAI::Resources::Responses#create} for non-streaming counterpart.
472
+ #
473
+ # Creates a model response with a higher-level streaming interface that provides
474
+ # helper methods for processing events and aggregating stream outputs.
475
+ sig do
476
+ params(
477
+ input:
478
+ T.nilable(OpenAI::Responses::ResponseCreateParams::Input::Variants),
479
+ model:
480
+ T.nilable(
481
+ T.any(
482
+ String,
483
+ OpenAI::ChatModel::OrSymbol,
484
+ OpenAI::ResponsesModel::ResponsesOnlyModel::OrSymbol
485
+ )
486
+ ),
487
+ background: T.nilable(T::Boolean),
488
+ include:
489
+ T.nilable(
490
+ T::Array[OpenAI::Responses::ResponseIncludable::OrSymbol]
491
+ ),
492
+ instructions: T.nilable(String),
493
+ max_output_tokens: T.nilable(Integer),
494
+ metadata: T.nilable(T::Hash[Symbol, String]),
495
+ parallel_tool_calls: T.nilable(T::Boolean),
496
+ previous_response_id: T.nilable(String),
497
+ prompt: T.nilable(OpenAI::Responses::ResponsePrompt::OrHash),
498
+ reasoning: T.nilable(OpenAI::Reasoning::OrHash),
499
+ service_tier:
500
+ T.nilable(
501
+ OpenAI::Responses::ResponseCreateParams::ServiceTier::OrSymbol
502
+ ),
503
+ store: T.nilable(T::Boolean),
504
+ temperature: T.nilable(Float),
505
+ text:
506
+ T.any(
507
+ OpenAI::Responses::ResponseTextConfig::OrHash,
508
+ OpenAI::StructuredOutput::JsonSchemaConverter
509
+ ),
510
+ tool_choice:
511
+ T.any(
512
+ OpenAI::Responses::ToolChoiceOptions::OrSymbol,
513
+ OpenAI::Responses::ToolChoiceTypes::OrHash,
514
+ OpenAI::Responses::ToolChoiceFunction::OrHash
515
+ ),
516
+ tools:
517
+ T.nilable(
518
+ T::Array[
519
+ T.any(
520
+ OpenAI::Responses::FunctionTool::OrHash,
521
+ OpenAI::Responses::FileSearchTool::OrHash,
522
+ OpenAI::Responses::ComputerTool::OrHash,
523
+ OpenAI::Responses::Tool::Mcp::OrHash,
524
+ OpenAI::Responses::Tool::CodeInterpreter::OrHash,
525
+ OpenAI::Responses::Tool::ImageGeneration::OrHash,
526
+ OpenAI::Responses::Tool::LocalShell::OrHash,
527
+ OpenAI::Responses::WebSearchTool::OrHash,
528
+ OpenAI::StructuredOutput::JsonSchemaConverter
529
+ )
530
+ ]
531
+ ),
532
+ top_p: T.nilable(Float),
533
+ truncation:
534
+ T.nilable(
535
+ OpenAI::Responses::ResponseCreateParams::Truncation::OrSymbol
536
+ ),
537
+ user: T.nilable(String),
538
+ starting_after: T.nilable(Integer),
539
+ request_options: T.nilable(OpenAI::RequestOptions::OrHash)
540
+ ).returns(OpenAI::Streaming::ResponseStream)
541
+ end
542
+ def stream(
543
+ # Text, image, or file inputs to the model, used to generate a response.
544
+ input: nil,
545
+ # Model ID used to generate the response, like `gpt-4o` or `o3`.
546
+ model: nil,
547
+ # Whether to run the model response in the background.
548
+ background: nil,
549
+ # Specify additional output data to include in the model response.
550
+ include: nil,
551
+ # A system (or developer) message inserted into the model's context.
552
+ instructions: nil,
553
+ # An upper bound for the number of tokens that can be generated for a response.
554
+ max_output_tokens: nil,
555
+ # Set of 16 key-value pairs that can be attached to an object.
556
+ metadata: nil,
557
+ # Whether to allow the model to run tool calls in parallel.
558
+ parallel_tool_calls: nil,
559
+ # The unique ID of the previous response to the model. Use this to create
560
+ # multi-turn conversations.
561
+ previous_response_id: nil,
562
+ # Reference to a prompt template and its variables.
563
+ prompt: nil,
564
+ # Configuration options for reasoning models.
565
+ reasoning: nil,
566
+ # Specifies the latency tier to use for processing the request.
567
+ service_tier: nil,
568
+ # Whether to store the generated model response for later retrieval via API.
569
+ store: nil,
570
+ # What sampling temperature to use, between 0 and 2.
571
+ temperature: nil,
572
+ # Configuration options for a text response from the model.
573
+ text: nil,
574
+ # How the model should select which tool (or tools) to use when generating a response.
575
+ tool_choice: nil,
576
+ # An array of tools the model may call while generating a response.
577
+ tools: nil,
578
+ # An alternative to sampling with temperature, called nucleus sampling.
579
+ top_p: nil,
580
+ # The truncation strategy to use for the model response.
581
+ truncation: nil,
582
+ # A stable identifier for your end-users.
583
+ user: nil,
584
+ # The sequence number of the event after which to start streaming (for resuming streams).
585
+ starting_after: nil,
586
+ request_options: {}
587
+ )
588
+ end
589
+
465
590
  # See {OpenAI::Resources::Responses#retrieve_streaming} for streaming counterpart.
466
591
  #
467
592
  # Retrieves a model response with the given ID.
@@ -0,0 +1,5 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ Streaming = OpenAI::Helpers::Streaming
5
+ end
@@ -23,6 +23,10 @@ module OpenAI
23
23
  url: URI::Generic,
24
24
  status: Integer,
25
25
  response: top,
26
+ unwrap: Symbol
27
+ | Integer
28
+ | ::Array[Symbol | Integer]
29
+ | ^(top arg0) -> top,
26
30
  stream: Enumerable[Message]
27
31
  ) -> void
28
32
 
@@ -131,16 +131,16 @@ module OpenAI
131
131
  end
132
132
  end
133
133
 
134
- type duration = { duration: Float, type: :duration }
134
+ type duration = { seconds: Float, type: :duration }
135
135
 
136
136
  class Duration < OpenAI::Internal::Type::BaseModel
137
- attr_accessor duration: Float
137
+ attr_accessor seconds: Float
138
138
 
139
139
  attr_accessor type: :duration
140
140
 
141
- def initialize: (duration: Float, ?type: :duration) -> void
141
+ def initialize: (seconds: Float, ?type: :duration) -> void
142
142
 
143
- def to_hash: -> { duration: Float, type: :duration }
143
+ def to_hash: -> { seconds: Float, type: :duration }
144
144
  end
145
145
 
146
146
  def self?.variants: -> ::Array[OpenAI::Models::Audio::Transcription::usage]
@@ -54,16 +54,16 @@ module OpenAI
54
54
  words: ::Array[OpenAI::Audio::TranscriptionWord]
55
55
  }
56
56
 
57
- type usage = { duration: Float, type: :duration }
57
+ type usage = { seconds: Float, type: :duration }
58
58
 
59
59
  class Usage < OpenAI::Internal::Type::BaseModel
60
- attr_accessor duration: Float
60
+ attr_accessor seconds: Float
61
61
 
62
62
  attr_accessor type: :duration
63
63
 
64
- def initialize: (duration: Float, ?type: :duration) -> void
64
+ def initialize: (seconds: Float, ?type: :duration) -> void
65
65
 
66
- def to_hash: -> { duration: Float, type: :duration }
66
+ def to_hash: -> { seconds: Float, type: :duration }
67
67
  end
68
68
  end
69
69
  end
@@ -68,6 +68,7 @@ module OpenAI
68
68
  | :"fine-tune"
69
69
  | :"fine-tune-results"
70
70
  | :vision
71
+ | :user_data
71
72
 
72
73
  module Purpose
73
74
  extend OpenAI::Internal::Type::Enum
@@ -79,6 +80,7 @@ module OpenAI
79
80
  FINE_TUNE: :"fine-tune"
80
81
  FINE_TUNE_RESULTS: :"fine-tune-results"
81
82
  VISION: :vision
83
+ USER_DATA: :user_data
82
84
 
83
85
  def self?.values: -> ::Array[OpenAI::Models::FileObject::purpose]
84
86
  end
@@ -6,6 +6,7 @@ module OpenAI
6
6
  type: :input_file,
7
7
  file_data: String,
8
8
  file_id: String?,
9
+ file_url: String,
9
10
  filename: String
10
11
  }
11
12
 
@@ -18,6 +19,10 @@ module OpenAI
18
19
 
19
20
  attr_accessor file_id: String?
20
21
 
22
+ attr_reader file_url: String?
23
+
24
+ def file_url=: (String) -> String
25
+
21
26
  attr_reader filename: String?
22
27
 
23
28
  def filename=: (String) -> String
@@ -25,6 +30,7 @@ module OpenAI
25
30
  def initialize: (
26
31
  ?file_data: String,
27
32
  ?file_id: String?,
33
+ ?file_url: String,
28
34
  ?filename: String,
29
35
  ?type: :input_file
30
36
  ) -> void
@@ -33,6 +39,7 @@ module OpenAI
33
39
  type: :input_file,
34
40
  file_data: String,
35
41
  file_id: String?,
42
+ file_url: String,
36
43
  filename: String
37
44
  }
38
45
  end
@@ -7,7 +7,7 @@ module OpenAI
7
7
  item_id: String,
8
8
  output_index: Integer,
9
9
  sequence_number: Integer,
10
- type: :"response.mcp_call.arguments_delta"
10
+ type: :"response.mcp_call_arguments.delta"
11
11
  }
12
12
 
13
13
  class ResponseMcpCallArgumentsDeltaEvent < OpenAI::Internal::Type::BaseModel
@@ -19,14 +19,14 @@ module OpenAI
19
19
 
20
20
  attr_accessor sequence_number: Integer
21
21
 
22
- attr_accessor type: :"response.mcp_call.arguments_delta"
22
+ attr_accessor type: :"response.mcp_call_arguments.delta"
23
23
 
24
24
  def initialize: (
25
25
  delta: top,
26
26
  item_id: String,
27
27
  output_index: Integer,
28
28
  sequence_number: Integer,
29
- ?type: :"response.mcp_call.arguments_delta"
29
+ ?type: :"response.mcp_call_arguments.delta"
30
30
  ) -> void
31
31
 
32
32
  def to_hash: -> {
@@ -34,7 +34,7 @@ module OpenAI
34
34
  item_id: String,
35
35
  output_index: Integer,
36
36
  sequence_number: Integer,
37
- type: :"response.mcp_call.arguments_delta"
37
+ type: :"response.mcp_call_arguments.delta"
38
38
  }
39
39
  end
40
40
  end
@@ -7,7 +7,7 @@ module OpenAI
7
7
  item_id: String,
8
8
  output_index: Integer,
9
9
  sequence_number: Integer,
10
- type: :"response.mcp_call.arguments_done"
10
+ type: :"response.mcp_call_arguments.done"
11
11
  }
12
12
 
13
13
  class ResponseMcpCallArgumentsDoneEvent < OpenAI::Internal::Type::BaseModel
@@ -19,14 +19,14 @@ module OpenAI
19
19
 
20
20
  attr_accessor sequence_number: Integer
21
21
 
22
- attr_accessor type: :"response.mcp_call.arguments_done"
22
+ attr_accessor type: :"response.mcp_call_arguments.done"
23
23
 
24
24
  def initialize: (
25
25
  arguments: top,
26
26
  item_id: String,
27
27
  output_index: Integer,
28
28
  sequence_number: Integer,
29
- ?type: :"response.mcp_call.arguments_done"
29
+ ?type: :"response.mcp_call_arguments.done"
30
30
  ) -> void
31
31
 
32
32
  def to_hash: -> {
@@ -34,7 +34,7 @@ module OpenAI
34
34
  item_id: String,
35
35
  output_index: Integer,
36
36
  sequence_number: Integer,
37
- type: :"response.mcp_call.arguments_done"
37
+ type: :"response.mcp_call_arguments.done"
38
38
  }
39
39
  end
40
40
  end
@@ -9,7 +9,7 @@ module OpenAI
9
9
  item_id: String,
10
10
  output_index: Integer,
11
11
  sequence_number: Integer,
12
- type: :"response.output_text_annotation.added"
12
+ type: :"response.output_text.annotation.added"
13
13
  }
14
14
 
15
15
  class ResponseOutputTextAnnotationAddedEvent < OpenAI::Internal::Type::BaseModel
@@ -25,7 +25,7 @@ module OpenAI
25
25
 
26
26
  attr_accessor sequence_number: Integer
27
27
 
28
- attr_accessor type: :"response.output_text_annotation.added"
28
+ attr_accessor type: :"response.output_text.annotation.added"
29
29
 
30
30
  def initialize: (
31
31
  annotation: top,
@@ -34,7 +34,7 @@ module OpenAI
34
34
  item_id: String,
35
35
  output_index: Integer,
36
36
  sequence_number: Integer,
37
- ?type: :"response.output_text_annotation.added"
37
+ ?type: :"response.output_text.annotation.added"
38
38
  ) -> void
39
39
 
40
40
  def to_hash: -> {
@@ -44,7 +44,7 @@ module OpenAI
44
44
  item_id: String,
45
45
  output_index: Integer,
46
46
  sequence_number: Integer,
47
- type: :"response.output_text_annotation.added"
47
+ type: :"response.output_text.annotation.added"
48
48
  }
49
49
  end
50
50
  end
@@ -21,7 +21,8 @@ module OpenAI
21
21
  type: :mcp,
22
22
  allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
23
23
  headers: ::Hash[Symbol, String]?,
24
- require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?
24
+ require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
25
+ server_description: String
25
26
  }
26
27
 
27
28
  class Mcp < OpenAI::Internal::Type::BaseModel
@@ -37,12 +38,17 @@ module OpenAI
37
38
 
38
39
  attr_accessor require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?
39
40
 
41
+ attr_reader server_description: String?
42
+
43
+ def server_description=: (String) -> String
44
+
40
45
  def initialize: (
41
46
  server_label: String,
42
47
  server_url: String,
43
48
  ?allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
44
49
  ?headers: ::Hash[Symbol, String]?,
45
50
  ?require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
51
+ ?server_description: String,
46
52
  ?type: :mcp
47
53
  ) -> void
48
54
 
@@ -52,7 +58,8 @@ module OpenAI
52
58
  type: :mcp,
53
59
  allowed_tools: OpenAI::Models::Responses::Tool::Mcp::allowed_tools?,
54
60
  headers: ::Hash[Symbol, String]?,
55
- require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?
61
+ require_approval: OpenAI::Models::Responses::Tool::Mcp::require_approval?,
62
+ server_description: String
56
63
  }
57
64
 
58
65
  type allowed_tools =
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenAI
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-26 00:00:00.000000000 Z
11
+ date: 2025-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -39,12 +39,15 @@ files:
39
39
  - lib/openai/client.rb
40
40
  - lib/openai/errors.rb
41
41
  - lib/openai/file_part.rb
42
+ - lib/openai/helpers/streaming/events.rb
43
+ - lib/openai/helpers/streaming/response_stream.rb
42
44
  - lib/openai/helpers/structured_output.rb
43
45
  - lib/openai/helpers/structured_output/array_of.rb
44
46
  - lib/openai/helpers/structured_output/base_model.rb
45
47
  - lib/openai/helpers/structured_output/boolean.rb
46
48
  - lib/openai/helpers/structured_output/enum_of.rb
47
49
  - lib/openai/helpers/structured_output/json_schema_converter.rb
50
+ - lib/openai/helpers/structured_output/parsed_json.rb
48
51
  - lib/openai/helpers/structured_output/union_of.rb
49
52
  - lib/openai/internal.rb
50
53
  - lib/openai/internal/cursor_page.rb
@@ -547,12 +550,15 @@ files:
547
550
  - lib/openai/resources/vector_stores/file_batches.rb
548
551
  - lib/openai/resources/vector_stores/files.rb
549
552
  - lib/openai/resources/webhooks.rb
553
+ - lib/openai/streaming.rb
550
554
  - lib/openai/structured_output.rb
551
555
  - lib/openai/version.rb
552
556
  - manifest.yaml
553
557
  - rbi/openai/client.rbi
554
558
  - rbi/openai/errors.rbi
555
559
  - rbi/openai/file_part.rbi
560
+ - rbi/openai/helpers/streaming/events.rbi
561
+ - rbi/openai/helpers/streaming/response_stream.rbi
556
562
  - rbi/openai/helpers/structured_output.rbi
557
563
  - rbi/openai/helpers/structured_output/array_of.rbi
558
564
  - rbi/openai/helpers/structured_output/base_model.rbi
@@ -1061,6 +1067,7 @@ files:
1061
1067
  - rbi/openai/resources/vector_stores/file_batches.rbi
1062
1068
  - rbi/openai/resources/vector_stores/files.rbi
1063
1069
  - rbi/openai/resources/webhooks.rbi
1070
+ - rbi/openai/streaming.rbi
1064
1071
  - rbi/openai/structured_output.rbi
1065
1072
  - rbi/openai/version.rbi
1066
1073
  - sig/openai/client.rbs