Skip to content

Commit 04b111d

Browse files
chore: more accurate type annotations and aliases
1 parent df9e099 commit 04b111d

38 files changed

+97
-133
lines changed

lib/openai/errors.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
module OpenAI
44
module Errors
55
class Error < StandardError
6-
# @!parse
7-
# # @return [StandardError, nil]
8-
# attr_accessor :cause
6+
# @!attribute cause
7+
#
8+
# @return [StandardError, nil]
99
end
1010

1111
class ConversionError < OpenAI::Errors::Error
@@ -49,25 +49,25 @@ def initialize(url:, status: nil, body: nil, request: nil, response: nil, messag
4949
end
5050

5151
class APIConnectionError < OpenAI::Errors::APIError
52-
# @!parse
53-
# # @return [nil]
54-
# attr_accessor :status
52+
# @!attribute status
53+
#
54+
# @return [nil]
5555

56-
# @!parse
57-
# # @return [nil]
58-
# attr_accessor :body
56+
# @!attribute body
57+
#
58+
# @return [nil]
5959

60-
# @!parse
61-
# # @return [nil]
62-
# attr_accessor :code
60+
# @!attribute code
61+
#
62+
# @return [nil]
6363

64-
# @!parse
65-
# # @return [nil]
66-
# attr_accessor :param
64+
# @!attribute param
65+
#
66+
# @return [nil]
6767

68-
# @!parse
69-
# # @return [nil]
70-
# attr_accessor :type
68+
# @!attribute type
69+
#
70+
# @return [nil]
7171

7272
# @api private
7373
#

lib/openai/internal/type/boolean.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,16 @@ def coerce(value, state:)
4646
value
4747
end
4848

49-
# @!parse
50-
# # @api private
51-
# #
52-
# # @param value [Boolean, Object]
53-
# #
54-
# # @param state [Hash{Symbol=>Object}] .
55-
# #
56-
# # @option state [Boolean] :can_retry
57-
# #
58-
# # @return [Boolean, Object]
59-
# def dump(value, state:) = super
49+
# @!method dump(value, state:)
50+
# @api private
51+
#
52+
# @param value [Boolean, Object]
53+
#
54+
# @param state [Hash{Symbol=>Object}] .
55+
#
56+
# @option state [Boolean] :can_retry
57+
#
58+
# @return [Boolean, Object]
6059
end
6160
end
6261
end

lib/openai/internal/type/enum.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,16 @@ def coerce(value, state:)
100100
end
101101
end
102102

103-
# @!parse
104-
# # @api private
105-
# #
106-
# # @param value [Symbol, Object]
107-
# #
108-
# # @param state [Hash{Symbol=>Object}] .
109-
# #
110-
# # @option state [Boolean] :can_retry
111-
# #
112-
# # @return [Symbol, Object]
113-
# def dump(value, state:) = super
103+
# @!method dump(value, state:)
104+
# @api private
105+
#
106+
# @param value [Symbol, Object]
107+
#
108+
# @param state [Hash{Symbol=>Object}] .
109+
#
110+
# @option state [Boolean] :can_retry
111+
#
112+
# @return [Symbol, Object]
114113

115114
# @api private
116115
#

lib/openai/internal/type/unknown.rb

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,16 @@ def coerce(value, state:)
4848
value
4949
end
5050

51-
# @!parse
52-
# # @api private
53-
# #
54-
# # @param value [Object]
55-
# #
56-
# # @param state [Hash{Symbol=>Object}] .
57-
# #
58-
# # @option state [Boolean] :can_retry
59-
# #
60-
# # @return [Object]
61-
# def dump(value, state:) = super
51+
# @!method dump(value, state:)
52+
# @api private
53+
#
54+
# @param value [Object]
55+
#
56+
# @param state [Hash{Symbol=>Object}] .
57+
#
58+
# @option state [Boolean] :can_retry
59+
#
60+
# @return [Object]
6261
end
6362

6463
# rubocop:enable Lint/UnusedMethodArgument

lib/openai/models/beta/thread_create_and_run_params.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ module Content
337337
# @!method self.variants
338338
# @return [Array(String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>)]
339339

340+
# @type [OpenAI::Internal::Type::Converter]
340341
MessageContentPartParamArray =
341342
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Models::Beta::Threads::MessageContentPartParam }]
342343
end

lib/openai/models/beta/thread_create_params.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ module Content
114114
# @!method self.variants
115115
# @return [Array(String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>)]
116116

117+
# @type [OpenAI::Internal::Type::Converter]
117118
MessageContentPartParamArray =
118119
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Models::Beta::Threads::MessageContentPartParam }]
119120
end

lib/openai/models/beta/threads/message_create_params.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ module Content
7272
# @!method self.variants
7373
# @return [Array(String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>)]
7474

75+
# @type [OpenAI::Internal::Type::Converter]
7576
MessageContentPartParamArray =
7677
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Models::Beta::Threads::MessageContentPartParam }]
7778
end

lib/openai/models/beta/threads/run_create_params.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ module Content
307307
# @!method self.variants
308308
# @return [Array(String, Array<OpenAI::Models::Beta::Threads::ImageFileContentBlock, OpenAI::Models::Beta::Threads::ImageURLContentBlock, OpenAI::Models::Beta::Threads::TextContentBlockParam>)]
309309

310+
# @type [OpenAI::Internal::Type::Converter]
310311
MessageContentPartParamArray =
311312
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Models::Beta::Threads::MessageContentPartParam }]
312313
end

lib/openai/models/chat/chat_completion_assistant_message_param.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ module ArrayOfContentPart
131131
# @!method self.variants
132132
# @return [Array(String, Array<OpenAI::Models::Chat::ChatCompletionContentPartText, OpenAI::Models::Chat::ChatCompletionContentPartRefusal>)]
133133

134+
# @type [OpenAI::Internal::Type::Converter]
134135
ArrayOfContentPartArray =
135136
OpenAI::Internal::Type::ArrayOf[union: -> { OpenAI::Models::Chat::ChatCompletionAssistantMessageParam::Content::ArrayOfContentPart }]
136137
end

lib/openai/models/chat/chat_completion_developer_message_param.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module Content
5353
# @!method self.variants
5454
# @return [Array(String, Array<OpenAI::Models::Chat::ChatCompletionContentPartText>)]
5555

56+
# @type [OpenAI::Internal::Type::Converter]
5657
ChatCompletionContentPartTextArray =
5758
OpenAI::Internal::Type::ArrayOf[-> { OpenAI::Models::Chat::ChatCompletionContentPartText }]
5859
end

0 commit comments

Comments
 (0)