Class: Olyx::Guardrails::LlmAnalysis
- Inherits:
-
Object
- Object
- Olyx::Guardrails::LlmAnalysis
- Defined in:
- lib/olyx/guardrails/llm_analysis.rb
Overview
Normalizes and bounds responses from an untrusted optional LLM provider.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(provider, text, context) ⇒ LlmAnalysis
constructor
A new instance of LlmAnalysis.
Constructor Details
#initialize(provider, text, context) ⇒ LlmAnalysis
Returns a new instance of LlmAnalysis.
13 14 15 16 17 |
# File 'lib/olyx/guardrails/llm_analysis.rb', line 13 def initialize(provider, text, context) @provider = provider @text = text @context = context end |
Class Method Details
.call(provider, text, context) ⇒ Object
9 10 11 |
# File 'lib/olyx/guardrails/llm_analysis.rb', line 9 def self.call(provider, text, context) new(provider, text, context).call end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 |
# File 'lib/olyx/guardrails/llm_analysis.rb', line 19 def call Llm::AnalysisPipeline.call(@provider.call(@text, @context)) rescue StandardError => error { error: error..to_s[0..200] } end |