From adead661c71c8c5f6420bbafc5fa5b188758ddc5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 06:02:46 +0000 Subject: [PATCH 1/2] fix(api): fix nullability of logprobs Makes ResponseOutputText.logprobs nullable, matching with 2.6.1. While this is always present in the server response, this inadvertently affected params and some constructors --- .stats.yml | 4 +-- .../models/responses/response_output_text.rb | 16 +++++----- .../models/responses/response_output_text.rbi | 29 ++++++++++++------- .../models/responses/response_output_text.rbs | 18 +++++++----- 4 files changed, 40 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index 689bfb5c..d697cee1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 135 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-3c5d1593d7c6f2b38a7d78d7906041465ee9d6e9022f0651e1da194654488108.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-eeba8addf3a5f412e5ce8d22031e60c61650cee3f5d9e587a2533f6818a249ea.yml openapi_spec_hash: 0a4d8ad2469823ce24a3fd94f23f1c2b -config_hash: 032995825500a503a76da119f5354905 +config_hash: 0bb1941a78ece0b610a2fbba7d74a84c diff --git a/lib/openai/models/responses/response_output_text.rb b/lib/openai/models/responses/response_output_text.rb index acd7df97..aec78ec6 100644 --- a/lib/openai/models/responses/response_output_text.rb +++ b/lib/openai/models/responses/response_output_text.rb @@ -11,11 +11,6 @@ class ResponseOutputText < OpenAI::Internal::Type::BaseModel required :annotations, -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::ResponseOutputText::Annotation] } - # @!attribute logprobs - # - # @return [Array] - required :logprobs, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Responses::ResponseOutputText::Logprob] } - # @!attribute text # The text output from the model. # @@ -36,15 +31,20 @@ class ResponseOutputText < OpenAI::Internal::Type::BaseModel # @return [Symbol, :output_text] required :type, const: :output_text - # @!method initialize(annotations:, logprobs:, text:, type: :output_text) + # @!attribute logprobs + # + # @return [Array, nil] + optional :logprobs, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Responses::ResponseOutputText::Logprob] } + + # @!method initialize(annotations:, text:, logprobs: nil, type: :output_text) # A text output from the model. # # @param annotations [Array] The annotations of the text output. # - # @param logprobs [Array] - # # @param text [String] The text output from the model. # + # @param logprobs [Array] + # # @param type [Symbol, :output_text] The type of the output text. Always `output_text`. # A citation to a file. diff --git a/rbi/openai/models/responses/response_output_text.rbi b/rbi/openai/models/responses/response_output_text.rbi index 9369e30c..7b73351a 100644 --- a/rbi/openai/models/responses/response_output_text.rbi +++ b/rbi/openai/models/responses/response_output_text.rbi @@ -27,11 +27,6 @@ module OpenAI end attr_accessor :annotations - sig do - returns(T::Array[OpenAI::Responses::ResponseOutputText::Logprob]) - end - attr_accessor :logprobs - # The text output from the model. sig { returns(String) } attr_accessor :text @@ -44,6 +39,21 @@ module OpenAI sig { returns(Symbol) } attr_accessor :type + sig do + returns( + T.nilable(T::Array[OpenAI::Responses::ResponseOutputText::Logprob]) + ) + end + attr_reader :logprobs + + sig do + params( + logprobs: + T::Array[OpenAI::Responses::ResponseOutputText::Logprob::OrHash] + ).void + end + attr_writer :logprobs + # A text output from the model. sig do params( @@ -56,18 +66,18 @@ module OpenAI OpenAI::Responses::ResponseOutputText::Annotation::FilePath::OrHash ) ], + text: String, logprobs: T::Array[OpenAI::Responses::ResponseOutputText::Logprob::OrHash], - text: String, type: Symbol ).returns(T.attached_class) end def self.new( # The annotations of the text output. annotations:, - logprobs:, # The text output from the model. text:, + logprobs: nil, # The type of the output text. Always `output_text`. type: :output_text ) @@ -85,10 +95,9 @@ module OpenAI OpenAI::Responses::ResponseOutputText::Annotation::FilePath ) ], - logprobs: - T::Array[OpenAI::Responses::ResponseOutputText::Logprob], text: String, - type: Symbol + type: Symbol, + logprobs: T::Array[OpenAI::Responses::ResponseOutputText::Logprob] } ) end diff --git a/sig/openai/models/responses/response_output_text.rbs b/sig/openai/models/responses/response_output_text.rbs index d0e9a420..c1ad5888 100644 --- a/sig/openai/models/responses/response_output_text.rbs +++ b/sig/openai/models/responses/response_output_text.rbs @@ -4,32 +4,36 @@ module OpenAI type response_output_text = { annotations: ::Array[OpenAI::Models::Responses::ResponseOutputText::annotation], - logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob], text: String, - type: :output_text + type: :output_text, + logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob] } class ResponseOutputText < OpenAI::Internal::Type::BaseModel attr_accessor annotations: ::Array[OpenAI::Models::Responses::ResponseOutputText::annotation] - attr_accessor logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob] - attr_accessor text: String attr_accessor type: :output_text + attr_reader logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob]? + + def logprobs=: ( + ::Array[OpenAI::Responses::ResponseOutputText::Logprob] + ) -> ::Array[OpenAI::Responses::ResponseOutputText::Logprob] + def initialize: ( annotations: ::Array[OpenAI::Models::Responses::ResponseOutputText::annotation], - logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob], text: String, + ?logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob], ?type: :output_text ) -> void def to_hash: -> { annotations: ::Array[OpenAI::Models::Responses::ResponseOutputText::annotation], - logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob], text: String, - type: :output_text + type: :output_text, + logprobs: ::Array[OpenAI::Responses::ResponseOutputText::Logprob] } type annotation = From ac41ade5461d24ccc1faf1c8384560e23cdda0ee Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 4 Nov 2025 06:03:04 +0000 Subject: [PATCH 2/2] release: 0.35.1 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ Gemfile.lock | 2 +- README.md | 2 +- lib/openai/version.rb | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ce5e5c7c..af1fd43c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.35.0" + ".": "0.35.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cb3d434..139d1cd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.35.1 (2025-11-04) + +Full Changelog: [v0.35.0...v0.35.1](https://github.com/openai/openai-ruby/compare/v0.35.0...v0.35.1) + +### Bug Fixes + +* **api:** fix nullability of logprobs ([adead66](https://github.com/openai/openai-ruby/commit/adead661c71c8c5f6420bbafc5fa5b188758ddc5)) + ## 0.35.0 (2025-11-03) Full Changelog: [v0.34.1...v0.35.0](https://github.com/openai/openai-ruby/compare/v0.34.1...v0.35.0) diff --git a/Gemfile.lock b/Gemfile.lock index 1e460623..33e4b07f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GIT PATH remote: . specs: - openai (0.35.0) + openai (0.35.1) connection_pool GEM diff --git a/README.md b/README.md index b5a9943c..2f371854 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application ```ruby -gem "openai", "~> 0.35.0" +gem "openai", "~> 0.35.1" ``` diff --git a/lib/openai/version.rb b/lib/openai/version.rb index 91426220..ec1b414b 100644 --- a/lib/openai/version.rb +++ b/lib/openai/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module OpenAI - VERSION = "0.35.0" + VERSION = "0.35.1" end