Skip to content

Commit 05627bb

Browse files
committed
feat(docs): update configuration examples to use nested config syntax
This commit updates documentation examples across multiple files to demonstrate the new nested configuration structure for HTM. The changes include: - Replacing flat configuration attributes like `embedding_provider` with nested attributes like `config.embedding.provider` - Adding a new configuration example for job and chunking settings - Maintaining consistency in configuration syntax across documentation files The update reflects a likely change in the library's configuration API, providing clearer and more modular configuration options.
1 parent ac29ef2 commit 05627bb

7 files changed

Lines changed: 57 additions & 46 deletions

File tree

docs/api/yard/HTM/Configuration.md

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,37 +16,48 @@ HTM uses RubyLLM for multi-provider LLM support. Supported providers:
1616
* :deepseek (DeepSeek)
1717

1818

19-
**`@example`**
19+
**`@example`** Using nested configuration sections
2020
```ruby
2121
HTM.configure do |config|
22-
config.embedding_provider = :openai
23-
config.embedding_model = 'text-embedding-3-small'
24-
config.tag_provider = :openai
25-
config.tag_model = 'gpt-4o-mini'
22+
config.embedding.provider = :openai
23+
config.embedding.model = 'text-embedding-3-small'
24+
config.tag.provider = :openai
25+
config.tag.model = 'gpt-4o-mini'
2626
config.openai_api_key = ENV['OPENAI_API_KEY']
2727
end
2828
```
29-
**`@example`**
29+
**`@example`** Using Ollama (local default)
3030
```ruby
3131
HTM.configure do |config|
32-
config.embedding_provider = :ollama
33-
config.embedding_model = 'nomic-embed-text'
34-
config.tag_provider = :ollama
35-
config.tag_model = 'llama3'
32+
config.embedding.provider = :ollama
33+
config.embedding.model = 'nomic-embed-text'
34+
config.tag.provider = :ollama
35+
config.tag.model = 'llama3'
3636
config.ollama_url = 'http://localhost:11434'
3737
end
3838
```
39-
**`@example`**
39+
**`@example`** Mixed providers
4040
```ruby
4141
HTM.configure do |config|
42-
config.embedding_provider = :openai
43-
config.embedding_model = 'text-embedding-3-small'
42+
config.embedding.provider = :openai
43+
config.embedding.model = 'text-embedding-3-small'
4444
config.openai_api_key = ENV['OPENAI_API_KEY']
45-
config.tag_provider = :anthropic
46-
config.tag_model = 'claude-3-haiku-20240307'
45+
config.tag.provider = :anthropic
46+
config.tag.model = 'claude-3-haiku-20240307'
4747
config.anthropic_api_key = ENV['ANTHROPIC_API_KEY']
4848
end
4949
```
50+
**`@example`** Job and chunking configuration
51+
```ruby
52+
HTM.configure do |config|
53+
config.job.backend = :inline # or :sidekiq, :active_job, :thread
54+
config.chunking.size = 1024
55+
config.chunking.overlap = 64
56+
config.proposition.enabled = true
57+
config.proposition.provider = :ollama
58+
config.proposition.model = 'gemma3:latest'
59+
end
60+
```
5061
**`@example`**
5162
```ruby
5263
HTM.configure do |config|

docs/api/yard/HTM/JobAdapter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Supported backends:
1818
**`@example`**
1919
```ruby
2020
HTM.configure do |config|
21-
config.job_backend = :active_job
21+
config.job.backend = :active_job
2222
end
2323
```
2424
**`@example`**

docs/api/yard/HTM/Railtie.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ This railtie automatically configures HTM when Rails boots:
2020
```ruby
2121
# config/initializers/htm.rb
2222
HTM.configure do |config|
23-
config.embedding_model = 'custom-model'
24-
config.tag_model = 'custom-tag-model'
23+
config.embedding.model = 'custom-model'
24+
config.tag.model = 'custom-tag-model'
2525
end
2626
```
2727

docs/getting-started/quick-start.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,10 @@ Create an HTM instance for your robot:
125125
```ruby
126126
# Configure HTM globally (optional - uses Ollama by default)
127127
HTM.configure do |config|
128-
config.embedding_provider = :ollama
129-
config.embedding_model = 'nomic-embed-text:latest'
130-
config.tag_provider = :ollama
131-
config.tag_model = 'gemma3:latest'
128+
config.embedding.provider = :ollama
129+
config.embedding.model = 'nomic-embed-text:latest'
130+
config.tag.provider = :ollama
131+
config.tag.model = 'gemma3:latest'
132132
end
133133

134134
# Initialize HTM with a robot name
@@ -338,10 +338,10 @@ puts "=" * 60
338338

339339
# Step 1: Configure and initialize HTM
340340
HTM.configure do |config|
341-
config.embedding_provider = :ollama
342-
config.embedding_model = 'nomic-embed-text:latest'
343-
config.tag_provider = :ollama
344-
config.tag_model = 'gemma3:latest'
341+
config.embedding.provider = :ollama
342+
config.embedding.model = 'nomic-embed-text:latest'
343+
config.tag.provider = :ollama
344+
config.tag.model = 'gemma3:latest'
345345
end
346346

347347
htm = HTM.new(
@@ -522,8 +522,8 @@ htm = HTM.new(
522522

523523
# Try different embedding models via configure
524524
HTM.configure do |config|
525-
config.embedding_provider = :ollama
526-
config.embedding_model = 'llama3:latest' # Use Llama3
525+
config.embedding.provider = :ollama
526+
config.embedding.model = 'llama3:latest' # Use Llama3
527527
end
528528

529529
# Try different recall strategies

docs/guides/robot-groups.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ require 'htm'
8989

9090
# Configure HTM
9191
HTM.configure do |config|
92-
config.embedding_provider = :ollama
93-
config.embedding_model = 'nomic-embed-text'
94-
config.tag_provider = :ollama
95-
config.tag_model = 'llama3'
92+
config.embedding.provider = :ollama
93+
config.embedding.model = 'nomic-embed-text'
94+
config.tag.provider = :ollama
95+
config.tag.model = 'llama3'
9696
end
9797

9898
# Create a robot group with active and passive members
@@ -386,8 +386,8 @@ group_name = 'distributed-service'
386386

387387
# Configure HTM
388388
HTM.configure do |config|
389-
config.embedding_provider = :ollama
390-
config.embedding_model = 'nomic-embed-text'
389+
config.embedding.provider = :ollama
390+
config.embedding.model = 'nomic-embed-text'
391391
end
392392

393393
# Create HTM instance for this worker

docs/index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ require 'htm'
8181

8282
# Configure HTM globally (optional - uses Ollama by default)
8383
HTM.configure do |config|
84-
config.embedding_provider = :ollama
85-
config.embedding_model = 'nomic-embed-text:latest'
86-
config.tag_provider = :ollama
87-
config.tag_model = 'gemma3:latest'
84+
config.embedding.provider = :ollama
85+
config.embedding.model = 'nomic-embed-text:latest'
86+
config.tag.provider = :ollama
87+
config.tag.model = 'gemma3:latest'
8888
end
8989

9090
# Initialize HTM for your robot

docs/multi_framework_support.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ require 'htm'
1515

1616
# Configure for CLI (synchronous execution)
1717
HTM.configure do |config|
18-
config.job_backend = :inline # Jobs run immediately
18+
config.job.backend = :inline # Jobs run immediately
1919
end
2020

2121
htm = HTM.new(robot_name: "cli_assistant")
@@ -151,7 +151,7 @@ HTM.configuration.job_backend # => :thread
151151

152152
```ruby
153153
HTM.configure do |config|
154-
config.job_backend = :inline # Force synchronous
154+
config.job.backend = :inline # Force synchronous
155155
end
156156
```
157157

@@ -177,7 +177,7 @@ export HTM_JOB_BACKEND=inline # Override auto-detection
177177
```ruby
178178
# Use inline backend
179179
HTM.configure do |config|
180-
config.job_backend = :inline
180+
config.job.backend = :inline
181181

182182
# CLI-friendly logging
183183
config.logger.formatter = proc do |severity, datetime, progname, msg|
@@ -253,8 +253,8 @@ gem 'htm'
253253

254254
# config/initializers/htm.rb (optional)
255255
HTM.configure do |config|
256-
config.embedding_model = 'nomic-embed-text'
257-
config.tag_model = 'llama3'
256+
config.embedding.model = 'nomic-embed-text'
257+
config.tag.model = 'llama3'
258258
end
259259
```
260260

@@ -397,8 +397,8 @@ bundle exec sidekiq
397397
```ruby
398398
# Use faster/smaller models
399399
HTM.configure do |config|
400-
config.embedding_model = 'all-minilm' # Smaller, faster
401-
config.tag_model = 'gemma2:2b' # Smaller model
400+
config.embedding.model = 'all-minilm' # Smaller, faster
401+
config.tag.model = 'gemma2:2b' # Smaller model
402402
end
403403

404404
# Or disable features
@@ -438,7 +438,7 @@ end
438438

439439
# After (explicit inline):
440440
HTM.configure do |config|
441-
config.job_backend = :inline
441+
config.job.backend = :inline
442442
end
443443
# Jobs run synchronously, guaranteed to complete
444444
```

0 commit comments

Comments
 (0)