You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update for 6-provider architecture and reasoning primitives
Bring all top-level docs in line with the data-driven provider registry
that now supports 6 providers (openai, anthropic, gemini, ollama,
openrouter, together).
- README.md: lead description and Quick Links cover all 6 providers
- SETUP.md: add OpenRouter and Together AI setup sections, update
parameter table and provider-specific defaults; note DeepSeek-R1
thinking-tag behavior + max_tokens guidance
- USAGE.md: provider list in `set-provider` reference; add a
reasoning/thinking example block (`set-thinking`,
`set-reasoning-effort`, `set-thinking-budget`,
`chat-with-thinking`); expand discovery examples
- API-REFERENCE.md: add quick-table rows for the 4 reasoning
primitives, add a full Reasoning / Thinking Primitives section,
extend Valid Providers list, readiness-check table, and
provider-status example to include OpenRouter and Together
- EXAMPLES.md: include OpenRouter and Together in the
compare-providers list; add Reasoning Models and OpenRouter
one-key-many-models examples
- TESTING.md: document `demos/tests/config.txt.example` workflow,
enumerate the 13 test procedures (including the two skip-aware
provider-specific ones), list OPENROUTER_API_KEY / TOGETHER_API_KEY
for future smoke-test secrets
-`"openrouter"` - OpenRouter (200+ models from many vendors via one API key)
78
+
-`"together"` - Together AI (fast open-source model inference)
73
79
74
80
**Example**:
75
81
@@ -229,6 +235,65 @@ set color read-from-string color-choice
229
235
- Useful for agent decision-making in models
230
236
- Maintains conversation context
231
237
238
+
## Reasoning / Thinking Primitives
239
+
240
+
For models that expose intermediate reasoning (Anthropic Claude, Google Gemini, Ollama qwen3/deepseek-r1, OpenRouter, Together AI). OpenAI o-series uses internal reasoning that the API does not return.
241
+
242
+
### llm:chat-with-thinking
243
+
244
+
**Syntax**: `llm:chat-with-thinking text`
245
+
246
+
**Description**: Same as `llm:chat`, but returns both the final answer and the model's reasoning text as a 2-element list.
247
+
248
+
**Returns**: `[answer thinking]` — both strings. `thinking` will be `""` if the provider/model does not expose reasoning tokens.
249
+
250
+
**Example**:
251
+
252
+
```netlogo
253
+
llm:set-thinking true
254
+
let result llm:chat-with-thinking "What is 17 * 23?"
255
+
let answer item 0 result
256
+
let thinking item 1 result
257
+
print (word "Answer: " answer)
258
+
print (word "Reasoning: " thinking)
259
+
```
260
+
261
+
**Notes**:
262
+
263
+
- Only the final answer is added to conversation history (not the thinking text).
264
+
- For DeepSeek-R1 on Together AI, thinking is parsed from `<think>...</think>` tags in the content.
265
+
- For Anthropic, OpenRouter, and Gemini, thinking comes from a dedicated reasoning field in the API response.
266
+
267
+
### llm:set-thinking
268
+
269
+
**Syntax**: `llm:set-thinking enabled?`
270
+
271
+
**Description**: Enable or disable reasoning mode for the current provider. When enabled, the request includes provider-specific reasoning fields.
272
+
273
+
**Parameters**:
274
+
275
+
-`enabled?` (boolean): `true` to enable, `false` to disable
276
+
277
+
### llm:set-reasoning-effort
278
+
279
+
**Syntax**: `llm:set-reasoning-effort level`
280
+
281
+
**Description**: Set the reasoning effort hint for models that support it (OpenAI o-series, OpenRouter, Together AI hybrid models).
282
+
283
+
**Parameters**:
284
+
285
+
-`level` (string): `"low"`, `"medium"`, or `"high"`
286
+
287
+
### llm:set-thinking-budget
288
+
289
+
**Syntax**: `llm:set-thinking-budget tokens`
290
+
291
+
**Description**: Maximum tokens the model may spend on reasoning before producing the final answer. Used by Anthropic and Gemini.
292
+
293
+
**Parameters**:
294
+
295
+
-`tokens` (number): Minimum 1024. For Anthropic, the value is clamped to `[1024, max_tokens-1]`.
296
+
232
297
## History Management
233
298
234
299
### llm:history
@@ -320,12 +385,14 @@ if member? "ollama" llm:providers [
Copy file name to clipboardExpand all lines: docs/EXAMPLES.md
+51-1Lines changed: 51 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -306,7 +306,7 @@ extensions [llm]
306
306
globals [providers-list current-question]
307
307
308
308
to setup
309
-
set providers-list ["openai" "anthropic" "gemini"]
309
+
set providers-list ["openai" "anthropic" "gemini" "openrouter" "together"]
310
310
set current-question ""
311
311
end
312
312
@@ -479,6 +479,56 @@ end
479
479
480
480
## Advanced Usage Examples
481
481
482
+
### Reasoning Models — Show the Model's Work
483
+
484
+
Use `llm:chat-with-thinking` to get both the final answer and the model's intermediate reasoning. Works with Anthropic Claude, Gemini 2.x, Ollama qwen3 / deepseek-r1, OpenRouter reasoning models, and Together AI's DeepSeek-R1.
485
+
486
+
```netlogo
487
+
extensions [llm]
488
+
489
+
to setup-reasoning
490
+
llm:load-config "config.txt" ;; e.g. provider=together, model=deepseek-ai/DeepSeek-R1
491
+
llm:set-thinking true
492
+
llm:set-reasoning-effort "high" ;; OpenAI o-series + OpenRouter + Together hybrid
;; ask-with-reasoning "If a train leaves Chicago at 3pm going 60 mph, ..."
506
+
```
507
+
508
+
Note: bump `max_tokens` to 2000+ in your config for reasoning models; they often spend most of their token budget on the thinking phase before producing the final answer.
509
+
510
+
### OpenRouter — One Key, Many Models
511
+
512
+
Switch between vendors without juggling separate API keys:
513
+
514
+
```netlogo
515
+
extensions [llm]
516
+
517
+
to setup
518
+
llm:set-provider "openrouter"
519
+
llm:set-api-key "sk-or-your-key"
520
+
end
521
+
522
+
to compare-vendors-via-openrouter
523
+
let prompt "Summarize agent-based modeling in one sentence."
524
+
foreach ["openai/gpt-4o-mini" "anthropic/claude-3.5-haiku" "meta-llama/llama-3.3-70b-instruct"] [ m ->
Copy file name to clipboardExpand all lines: docs/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# NetLogo Multi-LLM Extension
2
2
3
-
Unified LLM capabilities for NetLogo with multi-provider support (OpenAI, Anthropic/Claude, Google/Gemini, and local Ollama), per‑agent memory, async requests, and simple configuration.
3
+
Unified LLM capabilities for NetLogo with multi-provider support — OpenAI, Anthropic/Claude, Google/Gemini, local Ollama, OpenRouter (200+ models via one key), and Together AI (fast open-source inference) — plus per‑agent memory, async requests, reasoning/thinking models, and simple configuration.
4
4
5
5
## Quick Links
6
6
- Usage Guide: `docs/USAGE.md`
@@ -20,7 +20,7 @@ extensions [ llm ]
20
20
```
21
21
llm:load-config "config.txt"
22
22
```
23
-
See `docs/CONFIGURATION.md` for ready-to-copy examples (OpenAI, Anthropic, Gemini, Ollama). For inline setup:
23
+
See `docs/CONFIGURATION.md` for ready-to-copy examples (OpenAI, Anthropic, Gemini, Ollama, OpenRouter, Together AI). For inline setup:
Browse the full catalog: [api.together.ai/models](https://api.together.ai/models)
151
+
152
+
**Reasoning model note:** DeepSeek-R1 emits its thinking inside `<think>...</think>` tags (sometimes filling the entire response). Use `llm:chat-with-thinking` to get the answer and reasoning split out, and bump `max_tokens` to 2000+ so the model has room to finish its answer after thinking.
Copy file name to clipboardExpand all lines: docs/TESTING.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,9 +82,31 @@ These tests are **excluded from default `sbt test`** and from CI.
82
82
Use `demos/tests/tests.nlogox` when you want to verify real providers end-to-end.
83
83
84
84
These tests do require:
85
-
- valid provider credentials for cloud providers, or
85
+
- valid provider credentials for cloud providers (OpenAI, Anthropic, Gemini, OpenRouter, Together AI), or
86
86
- a running Ollama server for local provider tests
87
87
88
+
### Test setup
89
+
90
+
1. Copy the template: `cp demos/tests/config.txt.example demos/tests/config.txt`
91
+
2. Edit `config.txt`: set `provider=` to your chosen provider and replace the matching `*_api_key=REPLACE_ME` line with a real key. `config.txt` is gitignored, so the key stays local.
92
+
3. Open `demos/tests/tests.nlogox` in NetLogo.
93
+
4. In the Command Center: `run-all-tests`
94
+
95
+
### What the suite covers
96
+
97
+
The suite runs the same 13 test procedures regardless of provider, plus two provider-specific procedures that auto-skip if not applicable:
98
+
99
+
-`test-providers` — registry has all 6 providers and `provider-help` returns text for each
100
+
-`test-invalid-provider` — bogus provider name is rejected
101
+
-`test-load-config` / `test-config-rollback` — config file loads cleanly and rolls back on failure
-`test-thinking-config`, `test-chat-with-thinking` — reasoning primitives and `[answer thinking]` return shape
104
+
-`test-openrouter-vendor-prefix` — vendor-prefixed model names (skips unless `provider=openrouter`)
105
+
-`test-together-thinking` — DeepSeek-R1 `<think>` tag extraction (skips unless `provider=together` AND model contains "DeepSeek")
106
+
-`test-reasoning-marker` — `[reasoning]` marker visible in `llm:list-models`
107
+
108
+
To exercise everything, run the suite twice — once with `provider=openrouter`, once with `provider=together` (use `model=deepseek-ai/DeepSeek-R1` and `max_tokens=2000+` for the Together reasoning test).
109
+
88
110
Suggested usage:
89
111
- run automated tests first (`sbt test`)
90
112
- run manual integration checks before releases or when changing provider adapters
@@ -125,5 +147,5 @@ For cloud-provider smoke tests you will need real API keys in CI secrets.
125
147
126
148
Typical setup later:
127
149
- separate workflow (manual trigger and/or nightly schedule)
128
-
- secrets like `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`
150
+
- secrets like `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GEMINI_API_KEY`, `OPENROUTER_API_KEY`, `TOGETHER_API_KEY`
129
151
- not required for normal PR merges (to avoid flaky/costly gating)
0 commit comments