Class: RCrewAI::LLMClients::Base
- Inherits:
-
Object
- Object
- RCrewAI::LLMClients::Base
- Defined in:
- lib/rcrewai/llm_clients/base.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
- #chat(messages:, tools: nil, tool_choice: :auto, stream: nil, **options) ⇒ Object
- #complete(prompt:, **options) ⇒ Object
-
#initialize(config = RCrewAI.configuration) ⇒ Base
constructor
A new instance of Base.
-
#supports_native_tools?(model: config.model) ⇒ Boolean
rubocop:disable Lint/UnusedMethodArgument.
Constructor Details
#initialize(config = RCrewAI.configuration) ⇒ Base
Returns a new instance of Base.
12 13 14 15 16 17 |
# File 'lib/rcrewai/llm_clients/base.rb', line 12 def initialize(config = RCrewAI.configuration) @config = config @logger = Logger.new($stdout) @logger.level = Logger::INFO validate_config! end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
10 11 12 |
# File 'lib/rcrewai/llm_clients/base.rb', line 10 def config @config end |
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
10 11 12 |
# File 'lib/rcrewai/llm_clients/base.rb', line 10 def logger @logger end |
Instance Method Details
#chat(messages:, tools: nil, tool_choice: :auto, stream: nil, **options) ⇒ Object
19 20 21 |
# File 'lib/rcrewai/llm_clients/base.rb', line 19 def chat(messages:, tools: nil, tool_choice: :auto, stream: nil, **) raise NotImplementedError, 'Subclasses must implement #chat method' end |
#complete(prompt:, **options) ⇒ Object
27 28 29 |
# File 'lib/rcrewai/llm_clients/base.rb', line 27 def complete(prompt:, **) chat(messages: [{ role: 'user', content: prompt }], **) end |
#supports_native_tools?(model: config.model) ⇒ Boolean
rubocop:disable Lint/UnusedMethodArgument
23 24 25 |
# File 'lib/rcrewai/llm_clients/base.rb', line 23 def supports_native_tools?(model: config.model) # rubocop:disable Lint/UnusedMethodArgument true end |