-
Notifications
You must be signed in to change notification settings - Fork 4
/
tests.nnb
2045 lines (2045 loc) · 125 KB
/
tests.nnb
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
{
"cells": [
{
"language": "markdown",
"source": [
"# AGiXT Typescript SDK Tests\n\n## Get a list of Providers\n\nThis will get a list of AI Providers available to use with AGiXT.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst providers = await ApiClient.getProviders();\nconsole.log(providers);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" 'perplexity', 'gpt4free',",
" 'azure', 'chatgpt',",
" 'runpod', 'poe',",
" 'oobabooga', 'openai',",
" 'huggingface', 'pipeline',",
" 'fastchat', 'agixt',",
" 'palm', 'claude',",
" 'huggingchat', 'llamacppapi',",
" 'petal', 'kobold',",
" 'llamacpp', 'custom',",
" 'bard'",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Default Provider Settings\n\nChoose a provider from the list of AI providers and get the default settings for that provider. For this example, we're choosing to see the settings for the `openai` provider.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst provider_settings = await ApiClient.getProviderSettings(\"openai\");\nconsole.log(provider_settings);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{",
" OPENAI_API_KEY: '',",
" AI_MODEL: 'gpt-3.5-turbo-16k-0613',",
" AI_TEMPERATURE: 0.7,",
" AI_TOP_P: 0.7,",
" MAX_TOKENS: 16384,",
" API_URI: 'https://api.openai.com/v1',",
" WAIT_BETWEEN_REQUESTS: 1,",
" WAIT_AFTER_FAILURE: 3,",
" stream: 'false',",
" provider: 'openai'",
"}",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Embedding Providers\n\nEmbedding providers are used to embed information to vectors to store in the vector database to be searched for context injection.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst embedding_providers = await ApiClient.getEmbedProviders();\nconsole.log(embedding_providers);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" 'default',",
" 'azure',",
" 'openai',",
" 'google_palm',",
" 'google_vertex',",
" 'cohere'",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Extension Settings\n\nThis is where we get all third party extension settings for the agent with defaults to fill in when there is nothing entered on the front end.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst extension_settings = await ApiClient.getExtensionSettings();\nconsole.log(extension_settings);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{",
" macostts: { USE_MAC_OS_TTS: false },",
" file_system: {",
" WORKING_DIRECTORY: './WORKSPACE',",
" WORKING_DIRECTORY_RESTRICTED: true",
" },",
" streamlabs_tts: { USE_STREAMLABS_TTS: true, STREAMLABS_VOICE: 'Brian' },",
" whisper_stt: { WHISPER_MODEL: 'base.en' },",
" huggingface: {",
" HUGGINGFACE_API_KEY: '',",
" HUGGINGFACE_AUDIO_TO_TEXT_MODEL: 'facebook/wav2vec2-large-960h-lv60-self'",
" },",
" discord: { DISCORD_API_KEY: '', DISCORD_COMMAND_PREFIX: '/AGiXT' },",
" dalle: { OPENAI_API_KEY: '' },",
" google: { GOOGLE_API_KEY: '' },",
" github: { GITHUB_USERNAME: '', GITHUB_API_KEY: '' },",
" stable_diffusion: {",
" STABLE_DIFFUSION_API_URL: 'https://api-inference.huggingface.co/models/runwayml/stable-diffusion-v1-5',",
" HUGGINGFACE_API_KEY: ''",
" },",
" gtts: { USE_GTTS: false },",
" elevenlabs: { ELEVENLABS_API_KEY: '', ELEVENLABS_VOICE: 'Josh' },",
" sendgrid_email: { SENDGRID_API_KEY: '', SENDGRID_EMAIL: '' },",
" searxng: { SEARXNG_INSTANCE_URL: '' },",
" twitter: {",
" TW_CONSUMER_KEY: '',",
" TW_CONSUMER_SECRET: '',",
" TW_ACCESS_TOKEN: '',",
" TW_ACCESS_TOKEN_SECRET: ''",
" }",
"}",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Extension Commands\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst extensions = await ApiClient.getExtensions();\nconsole.log(extensions);\nconsole.log(extensions[0]);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" {",
" extension_name: 'Web Playwright',",
" description: 'Web Playwright',",
" settings: [],",
" commands: [ [Object], [Object], [Object] ]",
" },",
" {",
" extension_name: 'Agixt Actions',",
" description: 'Agixt Actions',",
" settings: [],",
" commands: [",
" [Object], [Object],",
" [Object], [Object],",
" [Object], [Object],",
" [Object], [Object]",
" ]",
" },",
" {",
" extension_name: 'Macostts',",
" description: 'Macostts',",
" settings: [ 'USE_MAC_OS_TTS' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'File System',",
" description: 'File System',",
" settings: [ 'WORKING_DIRECTORY', 'WORKING_DIRECTORY_RESTRICTED' ],",
" commands: [",
" [Object], [Object],",
" [Object], [Object],",
" [Object], [Object],",
" [Object], [Object],",
" [Object]",
" ]",
" },",
" {",
" extension_name: 'Streamlabs Tts',",
" description: 'Streamlabs Tts',",
" settings: [ 'USE_STREAMLABS_TTS', 'STREAMLABS_VOICE' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Whisper Stt',",
" description: 'Whisper Stt',",
" settings: [ 'WHISPER_MODEL' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Huggingface',",
" description: 'Huggingface',",
" settings: [ 'HUGGINGFACE_API_KEY', 'HUGGINGFACE_AUDIO_TO_TEXT_MODEL' ],",
" commands: [ [Object], [Object] ]",
" },",
" {",
" extension_name: 'Discord',",
" description: 'Discord',",
" settings: [ 'DISCORD_API_KEY', 'DISCORD_COMMAND_PREFIX' ],",
" commands: []",
" },",
" {",
" extension_name: 'Dalle',",
" description: 'Dalle',",
" settings: [ 'OPENAI_API_KEY' ],",
" commands: []",
" },",
" {",
" extension_name: 'Google',",
" description: 'Google',",
" settings: [ 'GOOGLE_API_KEY' ],",
" commands: []",
" },",
" {",
" extension_name: 'Github',",
" description: 'Github',",
" settings: [ 'GITHUB_USERNAME', 'GITHUB_API_KEY' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Stable Diffusion',",
" description: 'Stable Diffusion',",
" settings: [ 'STABLE_DIFFUSION_API_URL', 'HUGGINGFACE_API_KEY' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Gtts',",
" description: 'Gtts',",
" settings: [ 'USE_GTTS' ],",
" commands: []",
" },",
" {",
" extension_name: 'Times',",
" description: 'Times',",
" settings: [],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Elevenlabs',",
" description: 'Elevenlabs',",
" settings: [ 'ELEVENLABS_API_KEY', 'ELEVENLABS_VOICE' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Sendgrid Email',",
" description: 'Sendgrid Email',",
" settings: [ 'SENDGRID_API_KEY', 'SENDGRID_EMAIL' ],",
" commands: []",
" },",
" {",
" extension_name: 'Searxng',",
" description: 'Searxng',",
" settings: [ 'SEARXNG_INSTANCE_URL' ],",
" commands: [ [Object] ]",
" },",
" {",
" extension_name: 'Twitter',",
" description: 'Twitter',",
" settings: [",
" 'TW_CONSUMER_KEY',",
" 'TW_CONSUMER_SECRET',",
" 'TW_ACCESS_TOKEN',",
" 'TW_ACCESS_TOKEN_SECRET'",
" ],",
" commands: []",
" }",
"]",
"{",
" extension_name: 'Web Playwright',",
" description: 'Web Playwright',",
" settings: [],",
" commands: [",
" {",
" friendly_name: 'Scrape Text with Playwright',",
" command_name: 'scrape_text_with_playwright',",
" command_args: [Object]",
" },",
" {",
" friendly_name: 'Scrape Links with Playwright',",
" command_name: 'scrape_links_with_playwright',",
" command_args: [Object]",
" },",
" {",
" friendly_name: 'Take Screenshot with Playwright',",
" command_name: 'take_screenshot_with_playwright',",
" command_args: [Object]",
" }",
" ]",
"}",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"### Details of Extension Commands\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst extensions = await ApiClient.getExtensions();\n// Example of data under commands for the File system extension.\nconsole.log(extensions[3].commands);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" {",
" friendly_name: 'Write to File',",
" command_name: 'write_to_file',",
" command_args: { filename: '', text: '' }",
" },",
" {",
" friendly_name: 'Read File',",
" command_name: 'read_file',",
" command_args: { filename: '' }",
" },",
" {",
" friendly_name: 'Search Files',",
" command_name: 'search_files',",
" command_args: { directory: '' }",
" },",
" {",
" friendly_name: 'Append to File',",
" command_name: 'append_to_file',",
" command_args: { filename: '', text: '' }",
" },",
" {",
" friendly_name: 'Execute Python File',",
" command_name: 'execute_python_file',",
" command_args: { file: '' }",
" },",
" {",
" friendly_name: 'Delete File',",
" command_name: 'delete_file',",
" command_args: { filename: '' }",
" },",
" {",
" friendly_name: 'Execute Shell',",
" command_name: 'execute_shell',",
" command_args: { command_line: '' }",
" },",
" {",
" friendly_name: 'Indent String for Python Code',",
" command_name: 'indent_string',",
" command_args: { string: '', indents: 1 }",
" },",
" {",
" friendly_name: 'Generate Commands Dictionary',",
" command_name: 'generate_commands_dict',",
" command_args: { python_file_content: '' }",
" }",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get command arguments\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst command_args = await ApiClient.getCommandArgs(\"Write to File\");\nconsole.log(command_args);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{ filename: '', text: '' }",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Create a new Agent\n\nCreates a new agent with the `gpt4free` provider.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\n\nconst new_agent = await ApiClient.addAgent(\"Test Agent\", {\n provider: \"gpt4free\",\n embedder: \"default\",\n AI_MODEL: \"gpt-3.5-turbo\",\n AI_TEMPERATURE: \"0.7\",\n AI_TOP_P: \"1\",\n MAX_TOKENS: \"4096\",\n helper_agent_name: \"OpenAI\",\n WEBSEARCH_TIMEOUT: 0,\n OPENAI_API_KEY: OPENAI_API_KEY,\n WAIT_BETWEEN_REQUESTS: 1,\n WAIT_AFTER_FAILURE: 3,\n stream: false,\n WORKING_DIRECTORY: \"./WORKSPACE\",\n WORKING_DIRECTORY_RESTRICTED: true,\n AUTONOMOUS_EXECUTION: false,\n});\nconsole.log(new_agent);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{ message: 'Agent Test Agent created.' }",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Execute a Command\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agent_name = \"Test Agent\";\nconst conversation_name = \"Command execution for testing\";\nconst command_name = \"Write to File\";\nconst command_args = {\n filename: \"test file.txt\",\n text: \"This is just a test!\",\n};\n\nconst command_execution = await ApiClient.executeCommand(\n agent_name,\n command_name,\n command_args,\n conversation_name\n);\nconsole.log(command_execution);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Unable to retrieve data.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get a list of all current Agents\n\nAny agents that you have created will be listed here.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agents = await ApiClient.getAgents();\nconsole.log(agents);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" { name: 'New Test Agent', status: false },",
" { name: 'FreeAgent', status: false },",
" { name: 'gpt4free', status: false },",
" { name: 'OpenOrca', status: false },",
" { name: 'OpenOrca-13B', status: false },",
" { name: 'easychat', status: false },",
" { name: 'Vicuna', status: false },",
" { name: 'OpenAI', status: false },",
" { name: 'Starchat', status: false },",
" { name: '[object Object]', status: false }",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Rename the test agent\n\nWe will just rename it to `New Test Agent`.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst rename_agent = await ApiClient.renameAgent(\n \"Test Agent\",\n \"New Test Agent\"\n);\nconsole.log(rename_agent);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{ message: 'Agent renamed.' }",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get the agent's settings\n\nThis will get the settings for the agent we just created, this will tell you all commands available to the agent as well as all of the provider settings for the agent.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agent_config = await ApiClient.getAgentConfig(\"New Test Agent\");\nconsole.log(agent_config);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{",
" commands: {",
" 'Scrape Text with Playwright': false,",
" 'Scrape Links with Playwright': false,",
" 'Take Screenshot with Playwright': false,",
" 'Create Task Chain': false,",
" 'Generate Extension from OpenAPI': false,",
" 'Generate Agent Helper Chain': false,",
" 'Ask for Help or Further Clarification to Complete Task': false,",
" 'Create a new command': false,",
" 'Execute Python Code': false,",
" 'Get Python Code from Response': false,",
" 'Get Mindmap for task to break it down': false,",
" 'Speak with MacOS TTS': false,",
" 'Write to File': true,",
" 'Read File': false,",
" 'Search Files': false,",
" 'Append to File': false,",
" 'Execute Python File': false,",
" 'Delete File': false,",
" 'Execute Shell': false,",
" 'Indent String for Python Code': false,",
" 'Generate Commands Dictionary': false,",
" 'Speak with TTS with Streamlabs Text to Speech': false,",
" 'Read Audio from File': false,",
" 'Read Audio from File with Huggingface': false,",
" 'Read Audio with Huggingface': false,",
" 'Clone Github Repository': false,",
" 'Generate Image with Stable Diffusion': false,",
" 'Get Datetime': false,",
" 'Speak with TTS Using Elevenlabs': false,",
" 'Use The Search Engine': false",
" },",
" settings: {",
" provider: 'openai',",
" embedder: 'openai',",
" AI_MODEL: 'gpt-3.5-turbo-16k-0613',",
" AI_TEMPERATURE: '0.8',",
" AI_TOP_P: '1',",
" MAX_TOKENS: '16000',",
" helper_agent_name: 'OpenAI',",
" WEBSEARCH_TIMEOUT: 0,",
" OPENAI_API_KEY: 'YOUR_OPENAI_API_KEY_HERE',",
" WAIT_BETWEEN_REQUESTS: 1,",
" WAIT_AFTER_FAILURE: 3,",
" stream: false,",
" WORKING_DIRECTORY: './WORKSPACE',",
" WORKING_DIRECTORY_RESTRICTED: true,",
" AUTONOMOUS_EXECUTION: false",
" }",
"}",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Update the agent's settings\n\nWe'll just update the temperature from the default `0.7` to `0.8` to confirm that we can modify a setting.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agent_config = await ApiClient.getAgentConfig(\"New Test Agent\");\nagent_config.settings.AI_TEMPERATURE = \"0.8\";\nconst update_agent_config = await ApiClient.updateAgentSettings(\n \"New Test Agent\",\n agent_config.settings\n);\nconsole.log(update_agent_config);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Agent New Test Agent configuration updated.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get a list of the agent's commands\n\nThis will get a list of all commands available to the agent.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agent_commands = await ApiClient.getCommands(\"New Test Agent\");\nconsole.log(agent_commands);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"{",
" 'Scrape Text with Playwright': false,",
" 'Scrape Links with Playwright': false,",
" 'Take Screenshot with Playwright': false,",
" 'Create Task Chain': false,",
" 'Generate Extension from OpenAPI': false,",
" 'Generate Agent Helper Chain': false,",
" 'Ask for Help or Further Clarification to Complete Task': false,",
" 'Create a new command': false,",
" 'Execute Python Code': false,",
" 'Get Python Code from Response': false,",
" 'Get Mindmap for task to break it down': false,",
" 'Speak with MacOS TTS': false,",
" 'Write to File': true,",
" 'Read File': false,",
" 'Search Files': false,",
" 'Append to File': false,",
" 'Execute Python File': false,",
" 'Delete File': false,",
" 'Execute Shell': false,",
" 'Indent String for Python Code': false,",
" 'Generate Commands Dictionary': false,",
" 'Speak with TTS with Streamlabs Text to Speech': false,",
" 'Read Audio from File': false,",
" 'Read Audio from File with Huggingface': false,",
" 'Read Audio with Huggingface': false,",
" 'Clone Github Repository': false,",
" 'Generate Image with Stable Diffusion': false,",
" 'Get Datetime': false,",
" 'Speak with TTS Using Elevenlabs': false,",
" 'Use The Search Engine': false",
"}",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Toggle a Command for the Agent\n\nWe'll toggle the `Write to File` command to `true` to confirm that we can toggle a command.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst toggle_command = await ApiClient.toggleCommand(\n \"New Test Agent\",\n \"Write to File\",\n true\n);\nconsole.log(toggle_command);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Command 'Write to File' toggled for agent 'New Test Agent'.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Update Agent Commands\n\nIn this example, we'll only change the `Write to File` command to `False`, but we could change any (or all) of the commands with this API call.\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst agent_config = await ApiClient.getAgentConfig(\"New Test Agent\");\n// Change agent_config.commands command of \"Write to File\" to false.\nagent_config.commands[\"Write to File\"] = false;\nconst update_agent_config = await ApiClient.updateAgentCommands(\n \"New Test Agent\",\n agent_config.commands\n);\nconsole.log(update_agent_config);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Agent New Test Agent configuration updated.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Create a new conversation\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst conversation = await ApiClient.newConversation(\n \"New Test Agent\",\n \"New Test Conversation\"\n);\nconsole.log(conversation);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Conversations\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst conversations = await ApiClient.getConversations();\nconsole.log(conversations);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" 'Command execution for testing',",
" 'Talk about chains',",
" 'AGiXT Conversation',",
" 'Talk for Tests',",
" 'default',",
" 'OpenAI History',",
" 'gpt4free conversation',",
" 'vicuna reasoning',",
" 'Tell me about AGiXT',",
" 'New Test Conversation',",
" 'test reasoning',",
" 'Stable diffusion chain',",
" 'Test',",
" 'Chain Execution History: Poem Writing Chain',",
" 'AGiXT Chains',",
" 'test orca reasoning',",
" 'Talk about AGiXT with OpenOrca'",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Get Conversation Details\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst conversation = await ApiClient.getConversation(\n \"New Test Agent\",\n \"Test\",\n 100,\n 1\n);\nconsole.log(conversation);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" {",
" message: 'What can you tell me about AGiXT?',",
" role: 'USER',",
" timestamp: 'August 09, 2023 05:17 PM'",
" },",
" {",
" message: 'AGiXT is a dynamic Artificial Intelligence Automation Platform designed to manage AI instruction and task execution across various providers. It uses adaptive memory handling and a wide range of commands to enhance AI understanding and responsiveness. AGiXT features Smart Instruct and Smart Chat, which integrate web search, planning strategies, and conversation continuity to improve task completion. It also supports multiple AI providers, code evaluation, comprehensive chain management, and platform interoperability. AGiXT aims to push the boundaries of AI and contribute to the development of Artificial General Intelligence (AGI).',",
" role: 'OpenAI',",
" timestamp: 'August 09, 2023 05:17 PM'",
" }",
"]",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Delete Message from Conversation\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst conversation = await ApiClient.getConversation(\n \"New Test Agent\",\n \"Test\",\n 100,\n 1\n);\nconsole.log(conversation);\n\nconst delete_message = await ApiClient.deleteConversationMessage(\n \"New Test Agent\",\n \"Test\",\n conversation[0].message\n);\nconsole.log(delete_message);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"[",
" {",
" message: 'What can you tell me about AGiXT?',",
" role: 'USER',",
" timestamp: 'August 09, 2023 05:17 PM'",
" },",
" {",
" message: 'AGiXT is a dynamic Artificial Intelligence Automation Platform designed to manage AI instruction and task execution across various providers. It uses adaptive memory handling and a wide range of commands to enhance AI understanding and responsiveness. AGiXT features Smart Instruct and Smart Chat, which integrate web search, planning strategies, and conversation continuity to improve task completion. It also supports multiple AI providers, code evaluation, comprehensive chain management, and platform interoperability. AGiXT aims to push the boundaries of AI and contribute to the development of Artificial General Intelligence (AGI).',",
" role: 'OpenAI',",
" timestamp: 'August 09, 2023 05:17 PM'",
" }",
"]",
"Message deleted.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Delete a Conversation\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst conversation = await ApiClient.deleteConversation(\n \"New Test Agent\",\n \"Test\"\n);\nconsole.log(conversation);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Conversation `Test` for agent gpt4free deleted.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Have the Agent Learn from specified Text\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst text_learning = await ApiClient.learnText(\n \"New Test Agent\",\n \"What is AGiXT?\",\n \"AGiXT is an open-source artificial intelligence automation platform.\",\n 0\n);\nconsole.log(text_learning);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Agent learned the content from the text assocated with the user input.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Have the Agent Learn from a File\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst file_learning = await ApiClient.learnFile(\n \"New Test Agent\",\n \"text.txt\",\n \"Test content of test.txt\",\n 0\n);\nconsole.log(file_learning);\n"
],
"outputs": [
{
"items": [
{
"mime": "application/vnd.code.notebook.stdout",
"value": [
"Agent learned the content from the file.",
""
]
}
]
}
]
},
{
"language": "markdown",
"source": [
"## Have the Agent Learn from a URL\n"
],
"outputs": []
},
{
"language": "typescript",
"source": [
"import AGiXTSDK from \"./index.ts\";\nconst ApiClient = new AGiXTSDK({\n baseUri: \"http://localhost:7437\",\n apiKey: \"\",\n});\nconst url_learning = await ApiClient.learnUrl(\n \"New Test Agent\",\n \"https://josh-xt.github.io/AGiXT/\",\n 0\n);\nconsole.log(url_learning);\n"
],
"outputs": [
{