Skip to content

Commit 25a513f

Browse files
committed
use to_proc for more flexibility
1 parent 59a7606 commit 25a513f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/openai.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ def initialize
5656
end
5757

5858
def azure_token_provider=(provider)
59-
unless provider.nil? || (provider.is_a?(Proc) && provider.arity.zero?)
59+
unless provider.nil? || provider.respond_to?(:to_proc)
6060
raise ConfigurationError,
61-
"OpenAI Azure AD token provider must be a Proc that takes no arguments"
61+
"OpenAI Azure AD token provider must be a Proc, Lambda, or respond to to_proc."
6262
end
6363

64-
@azure_token_provider = provider
64+
@azure_token_provider = provider&.to_proc
6565
end
6666
end
6767

0 commit comments

Comments
 (0)