Class HTM::PropositionService ¶
| Inherits | Object |
| Defined in | lib/htm/proposition_service.rb |
Proposition Service - Extracts atomic factual propositions from text
This service breaks complex text into simple, self-contained factual statements that can be stored as independent memory nodes. Each proposition: * Expresses a single fact * Is understandable without context * Uses full names, not pronouns * Includes relevant dates/qualifiers * Contains one subject-predicate relationship
The actual LLM call is delegated to HTM.configuration.proposition_extractor
@example
propositions = HTM::PropositionService.extract(
"In 1969, Neil Armstrong became the first person to walk on the Moon during Apollo 11."
)
# => ["Neil Armstrong was an astronaut.",
# "Neil Armstrong walked on the Moon in 1969.",
# "Neil Armstrong was the first person to walk on the Moon.",
# "Neil Armstrong walked on the Moon during the Apollo 11 mission.",
# "The Apollo 11 mission occurred in 1969."]
Constants¶
META_RESPONSE_PATTERNS ¶
Patterns that indicate meta-responses (LLM asking for input instead of extracting)
Public Class Methods¶
circuit_breaker() ¶
Get or create the circuit breaker for proposition service
- @return [HTM::CircuitBreaker] The circuit breaker instance
extract(content) ¶
Extract propositions from text content
- @param content [String] Text to analyze
- @raise [CircuitBreakerOpenError] If circuit breaker is open
- @raise [PropositionError] If extraction fails
- @return [Array
max_length() ¶
Get maximum character length from config
- @return [Integer] Maximum character count for valid propositions
meta_response?(proposition) ¶
Check if proposition is a meta-response (LLM asking for input)
- @param proposition [String] Proposition to check
- @return [Boolean] True if it's a meta-response
min_length() ¶
Get minimum character length from config
- @return [Integer] Minimum character count for valid propositions
min_words() ¶
Get minimum words from config
- @return [Integer] Minimum word count for valid propositions
parse_propositions(raw_propositions) ¶
Parse proposition response (handles string or array input)
- @param raw_propositions [String, Array] Raw response from extractor
- @return [Array
reset_circuit_breaker!() ¶
Reset the circuit breaker (useful for testing)
- @return [void]
valid_proposition?(proposition) ¶
Validate single proposition
- @param proposition [String] Proposition to validate
- @return [Boolean] True if valid
validate_and_filter_propositions(propositions) ¶
Validate and filter propositions
- @param propositions [Array@return [Array