Class: Bristow::Providers::Base
- Inherits:
-
Object
- Object
- Bristow::Providers::Base
- Defined in:
- lib/bristow/providers/base.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#chat(params) ⇒ Object
Abstract method - must be implemented by subclasses.
-
#default_model ⇒ Object
Abstract method - must be implemented by subclasses.
- #format_function_response(response, result) ⇒ Object
-
#format_functions(functions) ⇒ Object
Abstract method - must be implemented by subclasses.
- #function_arguments(response) ⇒ Object
- #function_name(response) ⇒ Object
-
#initialize(api_key:) ⇒ Base
constructor
A new instance of Base.
- #is_function_call?(response) ⇒ Boolean
-
#stream_chat(params, &block) ⇒ Object
Abstract method - must be implemented by subclasses.
Constructor Details
#initialize(api_key:) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/bristow/providers/base.rb', line 6 def initialize(api_key:) @api_key = api_key raise ArgumentError, "API key is required" if api_key.nil? || api_key.empty? end |
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/bristow/providers/base.rb', line 4 def api_key @api_key end |
Instance Method Details
#chat(params) ⇒ Object
Abstract method - must be implemented by subclasses
12 13 14 |
# File 'lib/bristow/providers/base.rb', line 12 def chat(params) raise NotImplementedError, "Subclasses must implement #chat" end |
#default_model ⇒ Object
Abstract method - must be implemented by subclasses
27 28 29 |
# File 'lib/bristow/providers/base.rb', line 27 def default_model raise NotImplementedError, "Subclasses must implement #default_model" end |
#format_function_response(response, result) ⇒ Object
43 44 45 |
# File 'lib/bristow/providers/base.rb', line 43 def format_function_response(response, result) raise NotImplementedError, "Subclasses must implement #format_function_response" end |
#format_functions(functions) ⇒ Object
Abstract method - must be implemented by subclasses
22 23 24 |
# File 'lib/bristow/providers/base.rb', line 22 def format_functions(functions) raise NotImplementedError, "Subclasses must implement #format_functions" end |
#function_arguments(response) ⇒ Object
39 40 41 |
# File 'lib/bristow/providers/base.rb', line 39 def function_arguments(response) raise NotImplementedError, "Subclasses must implement #function_arguments" end |
#function_name(response) ⇒ Object
35 36 37 |
# File 'lib/bristow/providers/base.rb', line 35 def function_name(response) raise NotImplementedError, "Subclasses must implement #function_name" end |
#is_function_call?(response) ⇒ Boolean
31 32 33 |
# File 'lib/bristow/providers/base.rb', line 31 def is_function_call?(response) raise NotImplementedError, "Subclasses must implement #is_function_call?" end |
#stream_chat(params, &block) ⇒ Object
Abstract method - must be implemented by subclasses
17 18 19 |
# File 'lib/bristow/providers/base.rb', line 17 def stream_chat(params, &block) raise NotImplementedError, "Subclasses must implement #stream_chat" end |