Repository navigation
Expand file tree
/
Copy pathtests.txt
More file actions
1491 lines (1359 loc) · 53.1 KB
/
Copy pathtests.txt
File metadata and controls
1491 lines (1359 loc) · 53.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
LLMConfigPrimitives
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
item 0 llm:active => "openai"
member? "openai" llm:providers-all => true
empty? (llm:provider-help "openai") => false
empty? llm:config => false
is-string? llm:list-models => true
LLMProvidersAll
extensions [llm]
length llm:providers-all => 8
member? "openai" llm:providers-all => true
member? "anthropic" llm:providers-all => true
member? "gemini" llm:providers-all => true
member? "ollama" llm:providers-all => true
member? "openrouter" llm:providers-all => true
member? "together" llm:providers-all => true
member? "groq" llm:providers-all => true
member? "typesafe" llm:providers-all => true
LLMProviderStatus
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
length llm:provider-status => 8
LLMListModels
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
is-string? llm:list-models => true
empty? llm:list-models => false
LLMActiveConfig
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
item 0 llm:active => "openai"
LLMConfigSummary
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
is-string? llm:config => true
empty? llm:config => false
LLMHistoryManagement
extensions [llm]
globals [history]
O> llm:clear-history
llm:history => []
O> llm:set-history [["user" "hello"] ["assistant" "hi"]]
O> set history llm:history
length history => 2
(item 0 (item 0 history)) => "user"
(item 1 (item 0 history)) => "hello"
(item 0 (item 1 history)) => "assistant"
(item 1 (item 1 history)) => "hi"
O> llm:clear-history
llm:history => []
LLMSetModel
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "gpt-4o"
item 1 llm:active => "gpt-4o"
LLMThinkingConfigPrimitives
extensions [llm]
O> llm:set-thinking true
O> llm:set-reasoning-effort "high"
O> llm:set-thinking-budget 4096
O> llm:set-thinking false
LLMReasoningEffortValidation
extensions [llm]
O> llm:set-reasoning-effort "none"
O> llm:set-reasoning-effort "low"
O> llm:set-reasoning-effort "medium"
O> llm:set-reasoning-effort "high"
O> llm:set-reasoning-effort "xhigh"
LLMReasoningEffortIsProviderAware
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "groq"
O> llm:set-reasoning-effort "low"
O> llm:set-reasoning-effort "high"
O> llm:set-reasoning-effort "xhigh" => ERROR Extension exception: Invalid reasoning effort: 'xhigh' for provider 'groq'. Must be one of: high, low, medium
O> llm:set-reasoning-effort "none" => ERROR Extension exception: Invalid reasoning effort: 'none' for provider 'groq'. Must be one of: high, low, medium
O> llm:set-provider "openai"
O> llm:set-reasoning-effort "xhigh"
O> llm:set-reasoning-effort "none"
LLMThinkingBudgetValidation
extensions [llm]
O> llm:set-thinking-budget 1024
O> llm:set-thinking-budget 8192
LLMChat
extensions [llm]
globals [response]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> set response llm:chat "Say hello"
is-string? response => true
empty? response => false
LLMChatAsync
extensions [llm]
globals [promise result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> set promise llm:chat-async "Say hi"
is-anonymous-reporter? promise => true
O> set result (runresult promise)
is-string? result => true
empty? result => false
LLMChatHistory
extensions [llm]
globals [r1 r2]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set r1 llm:chat "My name is TestBot"
O> set r2 llm:chat "What is my name?"
length llm:history => 4
(item 0 (item 0 llm:history)) => "user"
(item 0 (item 1 llm:history)) => "assistant"
LLMChooseExactMatch
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
member? (llm:choose "Pick one" ["apple" "banana" "cherry"]) ["apple" "banana" "cherry"] => true
LLMChooseCaseInsensitive
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
(llm:choose "Pick one __TEST_RESPOND:APPLE" ["apple" "banana"]) => "apple"
LLMChooseEmptyListThrows
extensions [llm]
globals [err]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> carefully [let __x llm:choose "Pick" []] [set err error-message]
is-string? err => true
LLMChooseNoMatchThrows
extensions [llm]
globals [err]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> carefully [let __x llm:choose "Pick one __TEST_RESPOND:zzzz" ["apple" "banana"]] [set err error-message]
is-string? err => true
LLMChooseHistoryClean
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:choose "Pick a fruit" ["apple" "banana" "cherry"]
length llm:history => 2
(item 0 (item 0 llm:history)) => "user"
(item 1 (item 0 llm:history)) => "Pick a fruit"
(item 0 (item 1 llm:history)) => "assistant"
member? (item 1 (item 1 llm:history)) ["apple" "banana" "cherry"] => true
LLMChooseHistoryUnchangedOnFailure
extensions [llm]
globals [err]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> llm:set-history [["user" "prior"] ["assistant" "context"]]
O> carefully [let __x llm:choose "Pick __TEST_RESPOND:zzzz" ["apple" "banana"]] [set err error-message]
length llm:history => 2
(item 1 (item 0 llm:history)) => "prior"
LLMChooseThinkingModel
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:choose "Pick one __TEST_THINKING:apple" ["apple" "banana"]
result => "apple"
LLMChatHistoryCorrectOnSuccess
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat "hello"
length llm:history => 2
(item 1 (item 0 llm:history)) => "hello"
(item 0 (item 1 llm:history)) => "assistant"
LLMTemplateChat
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> set result llm:chat-with-template "demos/simple-template.yaml" [["text" "hello world"]]
is-string? result => true
empty? result => false
LLMTemplateWithHistory
extensions [llm]
globals [msg1 template-result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set msg1 llm:chat "previous message"
O> set template-result llm:chat-with-template "demos/simple-template.yaml" [["text" "with history"]]
is-string? template-result => true
empty? template-result => false
length llm:history => 4
LLMChatWithThinking
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-thinking true
O> set result llm:chat-with-thinking "What is 2 + 2?"
is-list? result => true
length result => 2
is-string? (item 0 result) => true
is-string? (item 1 result) => true
empty? (item 0 result) => false
LLMChatWithThinkingBudget
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-thinking true
O> llm:set-thinking-budget 2048
O> set result llm:chat-with-thinking "What is 3 + 5?"
is-list? result => true
length result => 2
is-string? (item 0 result) => true
empty? (item 0 result) => false
LLMMultiAgentChat
extensions [llm]
turtles-own [agent-result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> create-turtles 2
O> ask turtle 0 [ set agent-result llm:chat "Say one" ]
O> ask turtle 1 [ set agent-result llm:chat "Say two" ]
is-string? [agent-result] of turtle 0 => true
is-string? [agent-result] of turtle 1 => true
empty? [agent-result] of turtle 0 => false
empty? [agent-result] of turtle 1 => false
LLMOpenRouterProvider
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openrouter"
item 0 llm:active => "openrouter"
item 1 llm:active => "openai/gpt-oss-20b"
empty? (llm:provider-help "openrouter") => false
O> llm:set-model "openai/gpt-4o"
item 1 llm:active => "openai/gpt-4o"
LLMTogetherProvider
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "together"
item 0 llm:active => "together"
item 1 llm:active => "Qwen/Qwen3.8-Flash"
empty? (llm:provider-help "together") => false
O> llm:set-model "deepseek-ai/DeepSeek-R1"
item 1 llm:active => "deepseek-ai/DeepSeek-R1"
LLMGroqProvider
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "groq"
item 0 llm:active => "groq"
item 1 llm:active => "openai/gpt-oss-20b"
empty? (llm:provider-help "groq") => false
O> llm:set-model "openai/gpt-oss-120b"
item 1 llm:active => "openai/gpt-oss-120b"
LLMGroqChat
extensions [llm]
globals [response]
O> llm:set-api-key "test-key"
O> llm:set-provider "groq"
O> llm:clear-history
O> set response llm:chat "Say hello"
is-string? response => true
empty? response => false
length llm:history => 2
LLMConfigLoading
extensions [llm]
O> llm:load-config "demos/config"
item 0 llm:active => "openai"
member? "openai" llm:providers => true
LLMLoadConfigRejectsUnknownProvider
extensions [llm]
globals [err]
O> carefully [llm:load-config "demos/test-config-bad-provider"] [set err error-message]
is-string? err => true
(position "opanai" err) != false => true
LLMChatHistoryUnchangedOnFailure
extensions [llm]
globals [err]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> llm:set-history [["user" "prior"] ["assistant" "context"]]
O> carefully [let __x llm:chat "__TEST_FAIL"] [set err error-message]
is-string? err => true
length llm:history => 2
(item 1 (item 0 llm:history)) => "prior"
LLMChatWithThinkingHistoryUnchangedOnFailure
extensions [llm]
globals [err]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> llm:set-history [["user" "prior"] ["assistant" "context"]]
O> carefully [let __x llm:chat-with-thinking "__TEST_FAIL"] [set err error-message]
is-string? err => true
length llm:history => 2
(item 1 (item 0 llm:history)) => "prior"
LLMChatAsyncOverlappingPairsAtomic
extensions [llm]
globals [p1 p2 r1 r2 h]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set p1 llm:chat-async "__TEST_DELAY:300:slow"
O> set p2 llm:chat-async "fast"
O> set r1 (runresult p1)
O> set r2 (runresult p2)
r1 => "stub:slow"
r2 => "stub:fast"
O> set h llm:history
length h => 4
(item 0 (item 0 h)) => "user"
(item 0 (item 1 h)) => "assistant"
(item 0 (item 2 h)) => "user"
(item 0 (item 3 h)) => "assistant"
member? (item 1 (item 1 h)) ["stub:slow" "stub:fast"] => true
member? (item 1 (item 3 h)) ["stub:slow" "stub:fast"] => true
LLMMixedSyncAsyncHistoryAtomic
extensions [llm]
globals [p1 r1 r2 h]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set p1 llm:chat-async "__TEST_DELAY:300:slow"
O> set r1 llm:chat "quick"
O> set r2 (runresult p1)
O> set h llm:history
length h => 4
(item 0 (item 0 h)) => "user"
(item 0 (item 1 h)) => "assistant"
(item 0 (item 2 h)) => "user"
(item 0 (item 3 h)) => "assistant"
LLMCompileErrorValid
extensions [llm]
llm:compile-error "fd 1" => ""
llm:compile-error "rt 90 fd 1" => ""
llm:compile-error "" => ""
llm:compile-error " " => ""
llm:compile-error "ifelse xcor > 0 [ fd 1 ] [ bk 1 ]" => ""
llm:compile-error "rt (random 90) * 0.5 + (random 45) * 0.5" => ""
LLMCompileErrorInvalid
extensions [llm]
(llm:compile-error "frobnicate") != "" => true
(llm:compile-error "fd") != "" => true
(llm:compile-error "if xcor > 0 [fd 1] [bk 1]") != "" => true
(llm:compile-error "ifelse xcor > 0 [ fd 1 ]") != "" => true
(llm:compile-error "rt undefined-var-xyz") != "" => true
is-string? (llm:compile-error "frobnicate") => true
LLMCompileErrorTurtleContext
extensions [llm]
llm:compile-error "set heading 90" => ""
llm:compile-error "set color red fd 1" => ""
LLMCompileErrorLEARCorpus
extensions [llm]
llm:compile-error "ifelse random 2 < 1 [lt 10 fd 1] [ifelse random 2 < 1 [rt 10 fd 1] [fd 1] ]" => ""
llm:compile-error "ifelse random 2 = 0 [ lt random 20 fd 1 ] [ rt random 20 fd 1 ]" => ""
llm:compile-error "ifelse random 2 = 0 [fd 1] [rt 90 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 10 fd 1] [rt random 10 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 20 fd 1] [rt random 10 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 30 fd 1] [rt random 30 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [rt random 30 fd 1] [lt random 30 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [ifelse random 2 = 0 [lt 10 fd 1] [rt 10 fd 1]] [ifelse random 2 = 0 [lt random 10 fd 1] [rt random 10 fd 1]]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 10 fd 1] [ifelse random 2 = 0 [rt random 10 fd 1] [fd 1] ]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 10 fd 1] [ifelse random 2 = 1 [rt random 10 fd 1] [fd 1] ]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random 20 fd 1] [rt random 20 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [lt random-float 10 fd 1] [rt random-float 10 fd 1]" => ""
llm:compile-error "ifelse random 2 = 0 [ fd 1 ] [ ifelse random 2 = 1 [ rt 10 fd 1 ] [ lt 10 fd 1 ] ]" => ""
llm:compile-error "ifelse random-float 1 < 0.4 [lt random 10 fd 1] [ifelse random-float 1 < 0.3 [rt random 10 fd 1] [fd 1] ]" => ""
LLMCompileErrorBannedPrimitives
extensions [llm]
(llm:compile-error "fd 1" ["die"]) => ""
(llm:compile-error "fd 1" []) => ""
(llm:compile-error "die" ["die"]) => "Disallowed primitive(s) used: die"
(llm:compile-error "fd 1 die" ["die" "clear-all"]) => "Disallowed primitive(s) used: die"
(llm:compile-error "DIE" ["die"]) => "Disallowed primitive(s) used: die"
(llm:compile-error "die" ["DIE"]) => "Disallowed primitive(s) used: die"
LLMCompileErrorBannedNoFalsePositives
extensions [llm]
(llm:compile-error "fd 1 ; die is banned" ["die"]) => ""
(llm:compile-error "let diehard 1 fd diehard" ["die"]) => ""
(llm:compile-error "print \"die\"" ["die"]) => ""
LLMCompileErrorSyntaxBeforeBanned
extensions [llm]
(llm:compile-error "frobnicate die" ["die"]) != "" => true
member? "Disallowed" (llm:compile-error "frobnicate die" ["die"]) => false
LLMCompileErrorMultiLineLocals
extensions [llm]
llm:compile-error "let x 5\nfd x" => ""
llm:compile-error "let x 5\nlet y x * 2\nrt y\nfd 1" => ""
llm:compile-error "let x 5\n\n rt x\n fd 1\n" => ""
llm:compile-error "let d 3\nifelse d > 2\n [ fd d ]\n [ rt 90 fd 1 ]" => ""
llm:compile-error " \n fd 1 \n " => ""
llm:compile-error "let x 1 let y 2 let z 3 fd x + y + z" => ""
(llm:compile-error "let x 5\nfd undefined-thing") != "" => true
(llm:compile-error "fd x\nlet x 5") != "" => true
(llm:compile-error "let x 5\nlet x 6\nfd x") != "" => true
(llm:compile-error "let x 5\nlet x 6\nfd x") => "There is already a local variable here called X (offset 43)"
LLMCompileErrorTurtleOwnVariables
extensions [llm]
llm:compile-error "fd xcor" => ""
llm:compile-error "set heading heading + 10 fd 1" => ""
llm:compile-error "ifelse pcolor = green [ fd 1 ] [ rt 90 ]" => ""
llm:compile-error "let n count turtles in-radius 3\nfd n" => ""
(llm:compile-error "fd not-a-turtle-variable") != "" => true
LLMCompileErrorComments
extensions [llm]
llm:compile-error "; only a comment" => ""
llm:compile-error "fd 1 ; move forward" => ""
llm:compile-error "; leading comment\nfd 1\n; trailing comment" => ""
llm:compile-error "let x 5 ; set speed\nfd x" => ""
LLMCompileErrorNestedAndBlocks
extensions [llm]
llm:compile-error "ask other turtles in-radius 2 [ rt 180 ]" => ""
llm:compile-error "repeat 3 [ fd 1 rt 120 ]" => ""
llm:compile-error "if any? other turtles [ fd 1 ]" => ""
llm:compile-error "(ifelse xcor > 5 [ rt 90 ] xcor < -5 [ lt 90 ] [ fd 1 ])" => ""
llm:compile-error "foreach [1 2 3] [ n -> fd n ]" => ""
(llm:compile-error "repeat 3 [ fd 1 rt 120") != "" => true
(llm:compile-error "ask turtles [ fd 1 ] ]") != "" => true
LLMCompileErrorBannedMultiLine
extensions [llm]
(llm:compile-error "let x 5\nfd x\ndie" ["die"]) => "Disallowed primitive(s) used: die"
(llm:compile-error "fd 1\n; die here is a comment\nrt 90" ["die"]) => ""
(llm:compile-error "ask turtles [ die ]" ["die"]) => "Disallowed primitive(s) used: die"
(llm:compile-error "fd 1\nrt 90" ["die" "clear-all" "hatch"]) => ""
(llm:compile-error "let diehard 1\nfd diehard" ["die"]) => ""
LLMCompileErrorBannedMultipleFound
extensions [llm]
(llm:compile-error "ask turtles [ die ]" ["die" "ask"]) => "Disallowed primitive(s) used: ask, die"
(llm:compile-error "die die die" ["die"]) => "Disallowed primitive(s) used: die"
LLMCompileErrorBannedEdgeCases
extensions [llm]
(llm:compile-error "" ["die"]) => ""
(llm:compile-error "fd 1" [" "]) => ""
(llm:compile-error "fd 1" ["fd"]) => "Disallowed primitive(s) used: fd"
(llm:compile-error "fd 1" [" die "]) => ""
(llm:compile-error "die" [" die "]) => "Disallowed primitive(s) used: die"
LLMCompileErrorBannedListValidation
extensions [llm]
(llm:compile-error "die" [1 2]) => ERROR Extension exception: llm:compile-error expects a list of primitive names as strings, but got: 1, 2
(llm:compile-error "fd 1" ["die" 5]) => ERROR Extension exception: llm:compile-error expects a list of primitive names as strings, but got: 5
LLMGetLookup
extensions [llm]
llm:get [["name" "Alice"] ["age" 30]] "name" => "Alice"
llm:get [["name" "Alice"] ["age" 30]] "age" => 30
llm:get [["flag" true]] "flag" => true
llm:get [["skills" ["coding" "design"]]] "skills" => ["coding" "design"]
llm:get (llm:get [["addr" [["city" "Chicago"]]]] "addr") "city" => "Chicago"
llm:get [["name" "Alice"]] "missing" => ERROR Extension exception: llm:get: key "missing" not found. Available keys: name
llm:get [] "any" => ERROR Extension exception: llm:get: key "any" not found. The list is empty.
llm:get ["a" "b"] "a" => ERROR Extension exception: llm:get: key "a" not found. Available keys: (none - the list is not a list of [key value] pairs)
LLMChatWithSchemaParsesJson
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-with-schema "__TEST_RESPOND:{\"action\":\"explore\",\"confidence\":0.8}" "{\"type\":\"object\",\"properties\":{\"action\":{\"type\":\"string\"},\"confidence\":{\"type\":\"number\"}}}"
llm:get result "action" => "explore"
llm:get result "confidence" => 0.8
is-list? result => true
O> llm:clear-history
LLMChatWithSchemaNested
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-with-schema "__TEST_RESPOND:{\"plan\":[\"a\",\"b\"],\"meta\":{\"n\":2}}" "{\"type\":\"object\",\"properties\":{\"plan\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"meta\":{\"type\":\"object\",\"properties\":{\"n\":{\"type\":\"number\"}}}}}"
llm:get result "plan" => ["a" "b"]
llm:get (llm:get result "meta") "n" => 2
O> llm:clear-history
LLMChatWithSchemaRejectsBadSchema
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
llm:chat-with-schema "hello" "not json at all" => ERROR Extension exception: llm:chat-with-schema: Schema is not valid JSON: expected null got "n" at index 0
llm:chat-with-schema "hello" "" => ERROR Extension exception: llm:chat-with-schema: Schema cannot be empty. Provide a JSON Schema object, e.g. {"type":"object","properties":{"action":{"type":"string"}}}
LLMChatWithSchemaRejectsNonObjectTopLevel
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
llm:chat-with-schema "hi" "{\"type\":\"string\"}" => ERROR Extension exception: llm:chat-with-schema: schema must have type 'object' at the top level, but got 'string'. llm:chat-with-schema reports a list of [key value] pairs, so the reply has to be a JSON object. Wrap it, e.g. {"type":"object","properties":{"value":{"type":"string"}}}
llm:chat-with-schema "hi" "{\"type\":\"array\",\"items\":{\"type\":\"string\"}}" => ERROR Extension exception: llm:chat-with-schema: schema must have type 'object' at the top level, but got 'array'. llm:chat-with-schema reports a list of [key value] pairs, so the reply has to be a JSON object. Wrap it, e.g. {"type":"object","properties":{"value":{"type":"string"}}}
LLMChatWithSchemaRejectsNonObjectReply
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:chat-with-schema "__TEST_RESPOND:\"just a string\"" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"string\"}}}" => ERROR Extension exception: llm:chat-with-schema: expected a JSON object in the reply, but got a string. Response text: "just a string"
llm:history => []
O> llm:clear-history
LLMChatWithSchemaHistory
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-with-schema "__TEST_RESPOND:{\"a\":1}" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"number\"}}}"
length llm:history => 2
item 0 (item 0 llm:history) => "user"
item 0 (item 1 llm:history) => "assistant"
O> llm:clear-history
LLMChatWithSchemaHistoryUnchangedOnFailure
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> carefully [ let r llm:chat-with-schema "__TEST_FAIL" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"number\"}}}" ] [ ]
llm:history => []
O> llm:clear-history
LLMChatWithSchemaRejectsNonJsonReply
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:chat-with-schema "__TEST_RESPOND:sorry I cannot" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"number\"}}}" => ERROR Extension exception: llm:chat-with-schema: Response was not valid JSON: expected json value got "s" at index 0. Response text: sorry I cannot
llm:history => []
O> llm:clear-history
LLMChatJsonReturnsRawString
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-json "__TEST_RESPOND:{\"a\":1}"
is-string? result => true
result => "{\"a\":1}"
length llm:history => 2
O> llm:clear-history
LLMChatJsonRejectsNonJsonReply
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:chat-json "__TEST_RESPOND:Sure! Here is the JSON you asked for." => ERROR Extension exception: llm:chat-json: Response was not valid JSON: expected json value got "S" at index 0. Response text: Sure! Here is the JSON you asked for.
llm:history => []
O> llm:clear-history
LLMChatJsonAcceptsNonObjectJson
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-json "__TEST_RESPOND:[1,2,3]"
result => "[1,2,3]"
length llm:history => 2
O> llm:clear-history
LLMChatJsonHistoryUnchangedOnFailure
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> carefully [ let r llm:chat-json "__TEST_FAIL" ] [ ]
llm:history => []
O> llm:clear-history
LLMChooseStructured
extensions [llm]
globals [choice]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set choice llm:choose "Pick a direction" ["north" "south" "east" "west"]
member? choice ["north" "south" "east" "west"] => true
length llm:history => 2
O> llm:clear-history
LLMChooseStructuredEmptyList
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
llm:choose "Pick" [] => ERROR Extension exception: Choice list cannot be empty
LLMChooseSendsEnumConstraint
extensions [llm]
globals [choice]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set choice llm:choose "__TEST_ECHO_FORMAT_ENUM" ["north" "south"]
choice => "south"
length llm:history => 2
item 1 (item 1 llm:history) => "south"
O> llm:clear-history
O> set choice llm:choose "__TEST_ECHO_FORMAT_ENUM" ["alpha" "beta" "gamma"]
choice => "gamma"
O> llm:clear-history
LLMChatJsonSendsJsonObjectFormat
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-json "__TEST_ECHO_FORMAT"
result => "{\"format\":\"json_object\"}"
O> llm:clear-history
LLMChatWithSchemaSendsSchemaFormat
extensions [llm]
globals [result]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set result llm:chat-with-schema "__TEST_ECHO_FORMAT" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"string\"}}}"
llm:get result "format" => "json_schema"
llm:get result "topLevelType" => "object"
llm:get result "name" => "netlogo_schema"
O> llm:clear-history
LLMChoosePromptMatchesEnumSchema
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:choose "__TEST_ECHO_PROMPT_TAIL" ["north" "south"] => ERROR Extension exception: llm:choose: response 'Your choice as {"choice": "<option>"}:' did not match any choice. Choices: north, south
llm:history => []
O> llm:clear-history
LLMChooseDegradesWhenFormatIgnored
extensions [llm]
globals [choice]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set choice llm:choose "__TEST_IGNORE_FORMAT Pick a direction" ["north" "south" "east" "west"]
choice => "north"
length llm:history => 2
item 1 (item 1 llm:history) => "north"
O> llm:clear-history
LLMChooseDegradesCaseInsensitively
extensions [llm]
globals [choice]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
O> set choice llm:choose "pick __TEST_IGNORE_FORMAT __TEST_RAW_CHOICE:NORTH" ["north" "south"]
choice => "north"
length llm:history => 2
O> llm:clear-history
LLMChooseDegradesOnMalformedConstrainedJson
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:choose "__TEST_IGNORE_FORMAT __TEST_RAW_CHOICE:{\"choice\": pick" ["north" "south"] => ERROR Extension exception: llm:choose: response '{"choice": pick' did not match any choice. Choices: north, south
llm:history => []
O> llm:clear-history
LLMChooseUnmatchedAfterDegradationLeavesHistoryClean
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:clear-history
llm:choose "__TEST_IGNORE_FORMAT __TEST_RAW_CHOICE:up" ["north" "south"] => ERROR Extension exception: llm:choose: response 'up' did not match any choice. Choices: north, south
llm:history => []
O> llm:clear-history
LLMUsageStartsAtZero
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
llm:get llm:usage "input-tokens" => 0
llm:get llm:usage "output-tokens" => 0
llm:get llm:usage "total-tokens" => 0
llm:get llm:usage "calls" => 0
llm:get llm:usage "cost" => ""
llm:get llm:usage-total "calls" => 0
LLMUsageAccumulatesAcrossCalls
extensions [llm]
globals [r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> set r llm:chat "__TEST_USAGE:10,5 hello"
O> set r llm:chat "__TEST_USAGE:20,7,3 again"
llm:get llm:usage "input-tokens" => 30
llm:get llm:usage "output-tokens" => 12
llm:get llm:usage "total-tokens" => 42
llm:get llm:usage "reasoning-tokens" => 3
llm:get llm:usage "calls" => 2
O> clear-all
LLMUsageIsPerAgent
extensions [llm]
globals [r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> crt 2
O> ask turtles [ set r llm:chat (word "__TEST_USAGE:" (10 * (who + 1)) ",1 hi") ]
[llm:get llm:usage "input-tokens"] of turtle 0 => 10
[llm:get llm:usage "input-tokens"] of turtle 1 => 20
llm:get llm:usage "input-tokens" => 0
llm:get llm:usage-total "input-tokens" => 30
llm:get llm:usage-total "output-tokens" => 2
llm:get llm:usage-total "calls" => 2
O> clear-all
LLMUsageResetsOnClearAll
extensions [llm]
globals [r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> set r llm:chat "__TEST_USAGE:10,5 hi"
llm:get llm:usage-total "calls" => 1
O> clear-all
llm:get llm:usage "calls" => 0
llm:get llm:usage-total "calls" => 0
LLMUsageRecordsAsyncCalls
extensions [llm]
globals [p r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> set p llm:chat-async "__TEST_USAGE:4,3 hi"
O> set r (runresult p)
llm:get llm:usage "total-tokens" => 7
llm:get llm:usage "calls" => 1
O> clear-all
LLMUsageRecordsEveryPrimitive
extensions [llm]
globals [r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> set r llm:choose "__TEST_USAGE:1,1 pick" ["north" "south"]
O> set r llm:chat-with-schema "__TEST_USAGE:2,1" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"string\"}}}"
O> set r llm:chat-json "__TEST_USAGE:3,1"
O> set r llm:chat-with-thinking "__TEST_USAGE:4,1 think"
llm:get llm:usage "input-tokens" => 10
llm:get llm:usage "calls" => 4
O> clear-all
LLMUsageCountsRejectedReply
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> carefully [ let r llm:chat-with-schema "__TEST_USAGE:9,2 __TEST_RESPOND:not-json" "{\"type\":\"object\",\"properties\":{\"a\":{\"type\":\"string\"}}}" ] [ ]
llm:history => []
llm:get llm:usage "input-tokens" => 9
llm:get llm:usage "calls" => 1
O> clear-all
LLMUsageUnchangedWhenCallFails
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> carefully [ let r llm:chat "__TEST_USAGE:9,2 __TEST_FAIL" ] [ ]
llm:get llm:usage "calls" => 0
llm:get llm:usage "input-tokens" => 0
O> clear-all
LLMProfileDefaultsToGlobal
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
llm:profile => "default"
llm:profiles => []
LLMLoadProfileRejectsBadProvider
extensions [llm]
globals [err]
O> carefully [llm:load-profile "bad" "demos/test-config-bad-provider"] [set err error-message]
member? "Unknown provider" err => true
llm:profiles => []
LLMLoadProfileRejectsMissingFile
extensions [llm]
globals [err]
O> carefully [llm:load-profile "nope" "demos/no-such-file"] [set err error-message]
member? "Failed to load" err => true
llm:profiles => []
LLMLoadProfileRejectsReservedName
extensions [llm]
O> llm:load-profile "default" "demos/test-profile-a" => ERROR Extension exception: llm:load-profile: 'default' is reserved for the global configuration. Choose another name.
LLMUseProfileUnknownThrows
extensions [llm]
O> llm:load-profile "a" "demos/test-profile-a"
O> llm:use-profile "zzz" => ERROR Extension exception: llm:use-profile: no profile named 'zzz'. Loaded profiles: a
LLMUseProfileRoutesToItsModel
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "model-default"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> llm:load-profile "b" "demos/test-profile-b"
O> crt 2
O> ask turtle 0 [ llm:use-profile "a" ]
O> ask turtle 1 [ llm:use-profile "b" ]
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-a"
[llm:chat "__TEST_ECHO_MODEL"] of turtle 1 => "model-b"
llm:chat "__TEST_ECHO_MODEL" => "model-default"
[llm:profile] of turtle 0 => "a"
[llm:profile] of turtle 1 => "b"
llm:profile => "default"
llm:profiles => ["a" "b"]
O> clear-all
LLMActiveAndConfigReportCallingAgentProfile
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "model-default"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
[llm:active] of turtle 0 => ["openai" "model-a"]
llm:active => ["openai" "model-default"]
member? "model-a" [llm:config] of turtle 0 => true
member? "model-a" llm:config => false
O> clear-all
LLMUseProfileDefaultReturnsToGlobal
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "model-default"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-a"
O> ask turtle 0 [ llm:use-profile "default" ]
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-default"
[llm:profile] of turtle 0 => "default"
O> clear-all
LLMProfileAsyncKeepsProviderAfterReassignment
extensions [llm]
globals [p r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "model-default"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> llm:load-profile "b" "demos/test-profile-b"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
O> ask turtle 0 [ set p llm:chat-async "__TEST_DELAY:300:__TEST_ECHO_MODEL" ]
O> ask turtle 0 [ llm:use-profile "b" ]
O> set r (runresult p)
r => "model-a"
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-b"
O> clear-all
LLMSetModelLeavesProfilesAlone
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> llm:set-model "model-default"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
O> llm:set-model "model-changed"
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-a"
llm:chat "__TEST_ECHO_MODEL" => "model-changed"
O> clear-all
LLMReloadProfileReplacesIt
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-a"
O> llm:load-profile "a" "demos/test-profile-b"
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-b"
llm:profiles => ["a"]
O> clear-all
LLMFailedReloadKeepsOldProfile
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 1
O> ask turtle 0 [ llm:use-profile "a" ]
O> carefully [llm:load-profile "a" "demos/test-config-bad-provider"] [ ]
[llm:chat "__TEST_ECHO_MODEL"] of turtle 0 => "model-a"
O> clear-all
LLMClearAllResetsAssignmentsKeepsProfiles
extensions [llm]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> llm:use-profile "a"
llm:profile => "a"
O> clear-all
llm:profile => "default"
llm:profiles => ["a"]
O> clear-all
LLMProfileHistoryAndUsageStayPerAgent
extensions [llm]
globals [r]
O> llm:set-api-key "test-key"
O> llm:set-provider "openai"
O> clear-all
O> llm:load-profile "a" "demos/test-profile-a"
O> crt 2