Class: Agentic::Verification::SchemaVerificationStrategy
- Inherits:
-
VerificationStrategy
- Object
- VerificationStrategy
- Agentic::Verification::SchemaVerificationStrategy
- Defined in:
- lib/agentic/verification/schema_verification_strategy.rb
Overview
Verifies task results against a schema
Instance Attribute Summary
Attributes inherited from VerificationStrategy
Instance Method Summary collapse
-
#verify(task, result) ⇒ VerificationResult
Verifies a task result against a schema.
Methods inherited from VerificationStrategy
Constructor Details
This class inherits a constructor from Agentic::Verification::VerificationStrategy
Instance Method Details
#verify(task, result) ⇒ VerificationResult
Verifies a task result against a schema
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/agentic/verification/schema_verification_strategy.rb', line 14 def verify(task, result) unless result.successful? return VerificationResult.new( task_id: task.id, verified: false, confidence: 0.0, messages: ["Task failed, skipping schema verification"] ) end # Extracting schema from task if available schema = task.input["output_schema"] if task.input.is_a?(Hash) unless schema return VerificationResult.new( task_id: task.id, verified: true, confidence: 0.5, messages: ["No schema specified for verification, passing by default"] ) end # In a real implementation, we would validate the output against the schema # For this stub, we'll assume validation passes VerificationResult.new( task_id: task.id, verified: true, confidence: 0.9, messages: ["Output matches expected schema"] ) end |