Module: DSPy::Support::OpenAISDKWarning
- Defined in:
- lib/dspy/support/openai_sdk_warning.rb
Constant Summary collapse
- WARNING_MESSAGE =
<<~WARNING.freeze WARNING: ruby-openai gem detected. This may cause conflicts with DSPy's OpenAI integration. DSPy uses the official 'openai' gem. The community 'ruby-openai' gem uses the same OpenAI namespace and will cause conflicts. To fix this, remove 'ruby-openai' from your Gemfile and use the official gem instead: - Remove: gem 'ruby-openai' - Keep: gem 'openai' (official SDK that DSPy uses) The official gem provides better compatibility and is actively maintained by OpenAI. WARNING
Class Method Summary collapse
Class Method Details
.community_gem_loaded? ⇒ Boolean
27 28 29 |
# File 'lib/dspy/support/openai_sdk_warning.rb', line 27 def self.community_gem_loaded? defined?(::OpenAI) && defined?(::OpenAI::Client) && !defined?(::OpenAI::Internal) end |
.warn_if_community_gem_loaded! ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dspy/support/openai_sdk_warning.rb', line 19 def self.warn_if_community_gem_loaded! return if @warned return unless community_gem_loaded? Kernel.warn WARNING_MESSAGE @warned = true end |