Skip to content

Commit 0e24b3e

Browse files
fix: sorbet types for enums, and make tapioca detection ignore tapioca dsl
1 parent a8af268 commit 0e24b3e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/openai.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
require "uri"
1717
# We already ship the preferred sorbet manifests in the package itself.
1818
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
19-
if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
19+
if Object.const_defined?(:Tapioca) &&
20+
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
21+
ARGV.none?(/dsl/)
2022
return
2123
end
2224

lib/openai/internal/util.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,12 @@ def to_sorbet_type(type)
875875
case type
876876
in OpenAI::Internal::Util::SorbetRuntimeSupport
877877
type.to_sorbet_type
878-
else
878+
in Class | Module
879879
type
880+
in true | false
881+
T::Boolean
882+
else
883+
type.class
880884
end
881885
end
882886
end

0 commit comments

Comments
 (0)