Class HTM::Config ¶
| Inherits | MywayConfig::Base |
| Includes | HTM::Config::Builder, HTM::Config::Database, HTM::Config::Validator |
| Defined in | lib/htm/config.rb, lib/htm/config/builder.rb, lib/htm/config/database.rb, lib/htm/config/validator.rb |
HTM Configuration using Anyway Config
Schema is defined in lib/htm/config/defaults.yml (single source of truth) Configuration uses nested sections for better organization: - HTM.config.database.host - HTM.config.embedding.provider - HTM.config.providers.openai.api_key
Configuration sources (lowest to highest priority): 1. Bundled defaults: lib/htm/config/defaults.yml (ships with gem) 2. XDG user config: * ~/Library/Application Support/htm/htm.yml (macOS only) * ~/.config/htm/htm.yml (XDG default) * $XDG_CONFIG_HOME/htm/htm.yml (if XDG_CONFIG_HOME is set) 3. Project config: ./config/htm.yml (environment-specific) 4. Local overrides: ./config/htm.local.yml (gitignored) 5. Environment variables (HTM_*) 6. Explicit values passed to configure block
@example Configure with environment variables
export HTM_EMBEDDING__PROVIDER=openai
export HTM_EMBEDDING__MODEL=text-embedding-3-small
export HTM_PROVIDERS__OPENAI__API_KEY=sk-xxx
@example Configure with XDG user config (~/.config/htm/htm.yml)
embedding:
provider: ollama
model: nomic-embed-text:latest
providers:
ollama:
url: http://localhost:11434
@example Configure with Ruby block
HTM.configure do |config|
config.embedding.provider = :openai
config.embedding.model = 'text-embedding-3-small'
end
Constants¶
BOOLEAN_STRINGS ¶
String spellings accepted for nested boolean env vars
DEFAULT_DIMENSIONS ¶
Default embedding dimensions by provider
Attributes¶
embedding_generator [RW] ¶
Callable Accessors (not loaded from config sources)
logger [RW] ¶
Callable Accessors (not loaded from config sources)
proposition_extractor [RW] ¶
Callable Accessors (not loaded from config sources)
tag_extractor [RW] ¶
Callable Accessors (not loaded from config sources)
token_counter [RW] ¶
Callable Accessors (not loaded from config sources)
Public Class Methods¶
active_xdg_config_file() ¶
Not documented.
env() ¶
Not documented.
valid_environment?() ¶
Check if current environment is valid (defined in config)
- @return [Boolean] true if environment has a config section
validate_environment!() ¶
Validate that the current environment is configured
- @raise [HTM::ConfigurationError] if environment is invalid
- @return [true] if environment is valid
xdg_config_file() ¶
Not documented.
xdg_config_paths() ¶
XDG Config Path Helpers
Public Instance Methods¶
actual_database_name() ¶
Extract the actual database name from URL or config
- @return [String, nil] the database name
anthropic_api_key() ¶
Not documented.
azure_api_key() ¶
Not documented.
azure_api_version() ¶
Not documented.
azure_endpoint() ¶
Not documented.
bedrock_access_key() ¶
Not documented.
bedrock_region() ¶
Not documented.
bedrock_secret_key() ¶
Not documented.
build_default_embedding_generator() ¶
Not documented.
build_default_logger() ¶
Not documented.
build_default_proposition_extractor() ¶
Not documented.
build_default_tag_extractor() ¶
Not documented.
build_default_token_counter() ¶
Not documented.
build_proposition_extraction_prompt(text) ¶
Not documented.
build_proposition_system_prompt() ¶
Not documented.
build_tag_extraction_prompt(text, existing_ontology) ¶
Prompt Builders
build_tag_system_prompt() ¶
Not documented.
chunk_overlap() ¶
Not documented.
chunk_size() ¶
Chunking convenience accessors
circuit_breaker_failure_threshold() ¶
Circuit breaker convenience accessors
circuit_breaker_half_open_max_calls() ¶
Not documented.
circuit_breaker_reset_timeout() ¶
Not documented.
configure_ruby_llm(provider = nil) ¶
Not documented.
database_config() ¶
Not documented.
database_configured?() ¶
@return[Boolean]
database_host() ¶
@return[String, nil] the database host
database_name() ¶
@return[String, nil] the database name
database_password() ¶
@return[String, nil] the database password
database_port() ¶
@return[Integer, nil] the database port
database_url() ¶
Database convenience methods
database_user() ¶
@return[String, nil] the database user
deepseek_api_key() ¶
Not documented.
embedding_dimensions() ¶
Not documented.
embedding_model() ¶
Not documented.
embedding_provider() ¶
Embedding convenience accessors
embedding_timeout() ¶
Not documented.
environment() ¶
NOTE: test?, development?, production? are auto-generated by MywayConfig::Base based on environment keys in defaults.yml
expected_database_name() ¶
Returns the expected database name based on service.name and environment
- @return [String] expected database name in format "{service_name}_{environment}"
@example
extract_embedding_from_response(response) ¶
Response Extraction Helpers
extract_propositions() ¶
Not documented.
extract_text_from_response(response) ¶
Not documented.
gemini_api_key() ¶
Not documented.
huggingface_api_key() ¶
Not documented.
initialize() ¶
Instance Methods
- @return [Config] a new instance of Config
job_backend() ¶
Job backend convenience accessor
max_embedding_dimension() ¶
Not documented.
max_tag_depth() ¶
Not documented.
normalize_ollama_model(model_name) ¶
Ollama Helpers
ollama_url() ¶
Not documented.
openai_api_key() ¶
Provider credential convenience accessors
openai_organization() ¶
Not documented.
openai_project() ¶
Not documented.
openrouter_api_key() ¶
Not documented.
parse_database_url() ¶
Parse database URL into component hash
- @return [Hash, nil] parsed components or nil if no URL
parse_proposition_response(text) ¶
Not documented.
parse_tag_response(text) ¶
Not documented.
proposition_model() ¶
Not documented.
proposition_provider() ¶
Proposition convenience accessors
proposition_timeout() ¶
Not documented.
refresh_ollama_models!() ¶
Not documented.
relevance_access_weight() ¶
Not documented.
relevance_recency_half_life_hours() ¶
Not documented.
relevance_recency_weight() ¶
Not documented.
relevance_semantic_weight() ¶
Relevance scoring convenience accessors
relevance_tag_weight() ¶
Not documented.
reset_to_defaults() ¶
Not documented.
service_name() ¶
Service name convenience accessor
tag_model() ¶
Not documented.
tag_provider() ¶
Tag convenience accessors
tag_timeout() ¶
Not documented.
valid_database_name?() ¶
Check if the database name matches the expected convention
- @return [Boolean] true if database name matches expected
valid_environment?() ¶
Instance method delegates
- @return [Boolean]
validate!() ¶
Not documented.
validate_callables() ¶
@raise[HTM::ValidationError]
validate_config() ¶
Not documented.
validate_database!() ¶
Validate that database is configured for the current environment
- @raise [HTM::ConfigurationError] if database is not configured
- @return [true] if database is configured
validate_database_name!() ¶
Validate that the database name follows the naming convention
Database names must be: {service_name}_{environment}
- @raise [HTM::ConfigurationError] if database name doesn't match expected
- @return [true] if database name is valid
@example Valid configurations
HTM_ENV=test, service.name=htm, database=htm_test # OK
HTM_ENV=production, service.name=payroll, database=payroll_production # OK
@example Invalid configurations (will raise)
HTM_ENV=test, service.name=htm, database=htm_production # Wrong environment
HTM_ENV=test, service.name=htm, database=payroll_test # Wrong service
HTM_ENV=test, service.name=htm, database=mydb # Wrong format
validate_environment!() ¶
Not documented.
validate_job_backend() ¶
Not documented.
validate_logger() ¶
@raise[HTM::ValidationError]
validate_provider(name, value) ¶
Not documented.
validate_providers() ¶
Not documented.
validate_relevance_weights() ¶
Not documented.
validate_settings!() ¶
Not documented.
validate_week_start() ¶
Not documented.