Module: LLM::Contract Private
- Included in:
- Completion
- Defined in:
- lib/llm/contract.rb,
lib/llm/contract/completion.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
The LLM::Contract module enforces API contracts between
provider response adapters and the runtime. Users never
interact with this module directly.
Defined Under Namespace
Modules: Completion
Constant Summary collapse
- ContractError =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Class.new(LLM::Error)
Instance Method Summary collapse
- #included(mod) ⇒ Object private
Instance Method Details
#included(mod) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/llm/contract.rb', line 16 def included(mod) meths = mod.instance_methods(false) if meths.empty? raise ContractError, "#{mod} does not implement any methods required by #{self}" end missing = instance_methods - meths if missing.any? raise ContractError, "#{mod} does not implement methods (#{missing.join(", ")}) required by #{self}" end end |