Class: CleoQualityReview::LlmProviders::Stub::Client
- Inherits:
-
Object
- Object
- CleoQualityReview::LlmProviders::Stub::Client
- Defined in:
- lib/cleo_quality_review/llm_providers/stub.rb
Overview
Stub LLM client, mirrors OpenAi::Client interface.
Instance Attribute Summary collapse
-
#received_prompts ⇒ Object
readonly
Returns the value of attribute received_prompts.
Instance Method Summary collapse
-
#generate_review(prompt) ⇒ String
Generate a review by returning the configured response.
-
#initialize(config:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(config:) ⇒ Client
Returns a new instance of Client.
61 62 63 64 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 61 def initialize(config:) @config = config @received_prompts = [] end |
Instance Attribute Details
#received_prompts ⇒ Object (readonly)
Returns the value of attribute received_prompts.
57 58 59 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 57 def received_prompts @received_prompts end |
Instance Method Details
#generate_review(prompt) ⇒ String
Generate a review by returning the configured response.
70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 70 def generate_review(prompt) received_prompts << prompt response = config.response case response when Proc response.call(prompt) else response.to_s end end |