Skip to content

Class: HTM::Config

Inherits: Anyway::Config

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

export HTM_EMBEDDING__PROVIDER=openai
export HTM_EMBEDDING__MODEL=text-embedding-3-small
export HTM_PROVIDERS__OPENAI__API_KEY=sk-xxx
@example
embedding:
  provider: ollama
  model: nomic-embed-text:latest
providers:
  ollama:
    url: http://localhost:11434
@example
HTM.configure do |config|
  config.embedding.provider = :openai
  config.embedding.model = 'text-embedding-3-small'
end

Class Methods

active_xdg_config_file()

config_section_with_defaults(section_key )

Create a coercion that merges incoming value with SCHEMA defaults for a section. This ensures env vars like HTM_DATABASE__URL don't lose other defaults.

deep_merge_hashes(base , overlay )

Deep merge helper for coercion

env()

xdg_config_file()

xdg_config_paths()

XDG Config Path Helpers

Attributes

embedding_generator[RW]

Callable Accessors (not loaded from config sources)

logger[RW]

Returns the value of attribute logger.

proposition_extractor[RW]

Callable Accessors (not loaded from config sources)

tag_extractor[RW]

Callable Accessors (not loaded from config sources)

token_counter[RW]

Returns the value of attribute token_counter.

Instance Methods

anthropic_api_key()

azure_api_key()

azure_api_version()

azure_endpoint()

bedrock_access_key()

bedrock_region()

bedrock_secret_key()

chunk_overlap()

chunk_size()

Chunking convenience accessors

circuit_breaker_failure_threshold()

Circuit breaker convenience accessors

circuit_breaker_half_open_max_calls()

circuit_breaker_reset_timeout()

configure_ruby_llm(providernil)

database_config()

database_configured?()

@return [Boolean]

database_url()

Database convenience methods

deepseek_api_key()

development?()

@return [Boolean]

embedding_dimensions()

embedding_model()

embedding_provider()

Embedding convenience accessors

embedding_timeout()

environment()

extract_propositions()

gemini_api_key()

huggingface_api_key()

initialize()

Instance Methods

@return [Config] a new instance of Config

job_backend()

Job backend convenience accessor

max_embedding_dimension()

max_tag_depth()

normalize_ollama_model(model_name)

Ollama Helpers

ollama_url()

openai_api_key()

Provider credential convenience accessors

openai_organization()

openai_project()

openrouter_api_key()

production?()

@return [Boolean]

proposition_model()

proposition_provider()

Proposition convenience accessors

proposition_timeout()

refresh_ollama_models!()

relevance_access_weight()

relevance_recency_half_life_hours()

relevance_recency_weight()

relevance_semantic_weight()

Relevance scoring convenience accessors

relevance_tag_weight()

reset_to_defaults()

service_name()

Service name convenience accessor

tag_model()

tag_provider()

Tag convenience accessors

tag_timeout()

test?()

Environment Helpers

@return [Boolean]

validate!()

validate_settings!()