Class: Deepsearch::Configuration
- Inherits:
-
Object
- Object
- Deepsearch::Configuration
- Defined in:
- lib/deepsearch/configuration.rb
Instance Attribute Summary collapse
-
#custom_search_adapter_class ⇒ Object
Returns the value of attribute custom_search_adapter_class.
-
#listener ⇒ Object
An object that can listen to events from the Deepsearch pipeline.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#prompts ⇒ Object
Returns the value of attribute prompts.
-
#ruby_llm ⇒ Object
readonly
Returns the value of attribute ruby_llm.
-
#search_adapter ⇒ Object
Returns the value of attribute search_adapter.
-
#serper_api_key ⇒ Object
Returns the value of attribute serper_api_key.
-
#tavily_api_key ⇒ Object
Returns the value of attribute tavily_api_key.
Instance Method Summary collapse
-
#configure_llm! ⇒ Object
Configure RubyLLM with current settings from the ‘RubyLLMConfig` config object.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #reset! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/deepsearch/configuration.rb', line 70 def initialize @tavily_api_key = nil @serper_api_key = nil @search_adapter = :tavily @custom_search_adapter_class = nil @listener = nil @logger = Logger.new($stdout, level: Logger::DEBUG) @ruby_llm = RubyLLMConfig.new @prompts = PromptsConfig.new end |
Instance Attribute Details
#custom_search_adapter_class ⇒ Object
Returns the value of attribute custom_search_adapter_class.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def custom_search_adapter_class @custom_search_adapter_class end |
#listener ⇒ Object
An object that can listen to events from the Deepsearch pipeline. The object must respond to ‘on_deepsearch_event(event_name, **payload)`.
66 67 |
# File 'lib/deepsearch/configuration.rb', line 66 attr_accessor :tavily_api_key, :serper_api_key, :search_adapter, :custom_search_adapter_class, :logger, :listener, :prompts |
#logger ⇒ Object
Returns the value of attribute logger.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def logger @logger end |
#prompts ⇒ Object
Returns the value of attribute prompts.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def prompts @prompts end |
#ruby_llm ⇒ Object (readonly)
Returns the value of attribute ruby_llm.
68 69 70 |
# File 'lib/deepsearch/configuration.rb', line 68 def ruby_llm @ruby_llm end |
#search_adapter ⇒ Object
Returns the value of attribute search_adapter.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def search_adapter @search_adapter end |
#serper_api_key ⇒ Object
Returns the value of attribute serper_api_key.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def serper_api_key @serper_api_key end |
#tavily_api_key ⇒ Object
Returns the value of attribute tavily_api_key.
66 67 68 |
# File 'lib/deepsearch/configuration.rb', line 66 def tavily_api_key @tavily_api_key end |
Instance Method Details
#configure_llm! ⇒ Object
Configure RubyLLM with current settings from the ‘RubyLLMConfig` config object.
92 93 94 95 96 97 98 99 100 101 |
# File 'lib/deepsearch/configuration.rb', line 92 def configure_llm! require "ruby_llm" unless defined?(RubyLLM) RubyLLM.configure do |config| RubyLLMConfig.supported_attributes.each do |attr| value = @ruby_llm.public_send(attr) config.public_send("#{attr}=", value) unless value.nil? end end end |
#reset! ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/deepsearch/configuration.rb', line 81 def reset! @tavily_api_key = nil @serper_api_key = nil @search_adapter = :tavily @listener = nil @logger = Logger.new($stdout, level: Logger::DEBUG) @ruby_llm = RubyLLMConfig.new @prompts = PromptsConfig.new end |