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_instructions ⇒ Object
readonly
Returns the value of attribute received_instructions.
-
#received_prompts ⇒ Object
readonly
Returns the value of attribute received_prompts.
Instance Method Summary collapse
-
#generate_review(prompt, instructions: nil) ⇒ 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 65 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 61 def initialize(config:) @config = config @received_prompts = [] @received_instructions = [] end |
Instance Attribute Details
#received_instructions ⇒ Object (readonly)
Returns the value of attribute received_instructions.
57 58 59 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 57 def received_instructions @received_instructions end |
#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, instructions: nil) ⇒ String
Generate a review by returning the configured response.
73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/cleo_quality_review/llm_providers/stub.rb', line 73 def generate_review(prompt, instructions: nil) received_prompts << prompt received_instructions << instructions response = config.response case response when Proc response.call(prompt) else response.to_s end end |