Class: OpenAI::Internal::Type::FileInput Abstract Private
- Inherits:
-
Object
- Object
- OpenAI::Internal::Type::FileInput
- Extended by:
- Converter
- Defined in:
- lib/openai/internal/type/file_input.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Either ‘Pathname` or `StringIO`, or `IO`, or `OpenAI::Internal::Type::FileInput`.
Note: when ‘IO` is used, all retries are disabled, since many IO` streams are not rewindable.
Class Method Summary collapse
- .==(other) ⇒ Boolean
- .===(other) ⇒ Boolean
- .coerce(value, state:) ⇒ StringIO, Object private
- .dump(value, state:) ⇒ Pathname, ... private
- .to_sorbet_type ⇒ Object private
Methods included from Converter
coerce, dump, inspect, inspect, type_info
Methods included from Util::SorbetRuntimeSupport
#const_missing, #define_sorbet_constant!, #sorbet_constant_defined?, #to_sorbet_type
Class Method Details
.==(other) ⇒ Boolean
39 |
# File 'lib/openai/internal/type/file_input.rb', line 39 def self.==(other) = other.is_a?(Class) && other <= OpenAI::Internal::Type::FileInput |
.===(other) ⇒ Boolean
25 26 27 28 29 30 31 32 |
# File 'lib/openai/internal/type/file_input.rb', line 25 def self.===(other) case other in Pathname | StringIO | IO | String | OpenAI::FilePart true else false end end |
.coerce(value, state:) ⇒ StringIO, Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/openai/internal/type/file_input.rb', line 55 def coerce(value, state:) exactness = state.fetch(:exactness) case value in String exactness[:yes] += 1 StringIO.new(value) in StringIO exactness[:yes] += 1 value else exactness[:no] += 1 value end end |
.dump(value, state:) ⇒ Pathname, ...
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/openai/internal/type/file_input.rb', line 79 def dump(value, state:) # rubocop:disable Lint/DuplicateBranch case value in IO state[:can_retry] = false in OpenAI::FilePart if value.content.is_a?(IO) state[:can_retry] = false else end # rubocop:enable Lint/DuplicateBranch value end |
.to_sorbet_type ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
96 97 98 |
# File 'lib/openai/internal/type/file_input.rb', line 96 def to_sorbet_type T.any(Pathname, StringIO, IO, String, OpenAI::FilePart) end |