-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
842 lines (772 loc) · 37.9 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Chatting with Catalogs</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css" />
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<style>
img.service-btn {
height: 24px;
width: 24px;
}
.tab-pane {
border-left: 1px solid rgb(222, 226, 230);
border-right: 1px solid rgb(222, 226, 230);
border-bottom: 1px solid rgb(222, 226, 230);
}
textarea {
font-family: Lucida, monospace;
}
</style>
<py-config type="toml">
packages = ["pydantic", "./wheels/pymarc-4.2.2-py3-none-any.whl", "./wheels/rdflib-7.0.0-py3-none-any.whl", "./wheels/paradag-1.2.0-py2.py3-none-any.whl"]
[[fetch]]
from = "src/catalog_chat"
files = ["chat.py", "controls.py", "folio.py", "github.py", "sinopia.py", "workflows/core.py", "workflows/executors.py", "workflows/assign_lcsh.py", "workflows/marc21_to_folio.py", "workflows/new_folio_resource.py", "workflows/sinopia_to_folio.py"]
</py-config>
</head>
<body>
<py-script>
__version__ = "1.0.0"
import asyncio
import json
import sys
from js import alert, console, document, sessionStorage
from chat import (
add_history,
delete_key,
update_chat_modal,
update_parameters
)
from chat import login as chat_gpt_login, ChatGPT
from controls import (
clear_chat_prompt,
download,
init_workflow,
load_chat_session,
load_folio_default,
load_marc_record,
new_example,
run_prompt
)
from folio import Okapi, get_instance, logout_folio
from folio import login as okapi_login
version_span = document.getElementById("version")
version_span.innerHTML = __version__
chat_gpt_instance = None
existing_token = sessionStorage.getItem("chat_gpt_token")
if existing_token:
chat_gpt_instance = ChatGPT(key=existing_token)
update_chat_modal(chat_gpt_instance)
chatgpt_button = document.getElementById("chatGPTButton")
chatgpt_button.classList.remove("btn-outline-danger")
chatgpt_button.classList.add("btn-outline-success")
workflow = None
okapi = None
existing_okapi = sessionStorage.getItem("okapi")
if existing_okapi:
okapi = Okapi.parse_obj(json.loads(existing_okapi))
folio_btn = document.getElementById("folioButton")
folio_btn.classList.remove("btn-outline-danger")
folio_btn.classList.add("btn-outline-success")
folio_iframe = document.getElementById("folio-system-frame")
folio_iframe.src = okapi.folio
default_folio = document.getElementById("folio-default")
default_folio.classList.add("d-none")
marc_file = Element("marc-upload-btn")
def download_history():
if chat_gpt_instance is not None and workflow is not None:
download(chat_gpt_instance, workflow)
else:
alert("Need chat gpt instance and workflow to download history")
def load_workflow(workflow_slug):
global workflow
workflow = init_workflow(workflow_slug)
async def login_chatgpt():
global chat_gpt_instance
chat_gpt_instance = await chat_gpt_login()
async def login_okapi():
folio_iframe = document.getElementById("folio-system-frame")
folio_url_elem = document.getElementById("folioURI")
folio_iframe.src = folio_url_elem.value
folio_logged_in = await okapi_login(Okapi())
console.log(f"FOLIO Login? {folio_logged_in}")
async def lcsh_conversation():
instance_uuid_elem = document.getElementById("instance-uuid")
instance = await get_instance(okapi, instance_uuid_elem.value)
raw_instance_elem = document.getElementById("raw-instance")
raw_instance_elem.innerHTML = instance
instance_subjects = document.getElementById("instance-subjects")
h3 = document.createElement("h3")
h3.innerHTML = "Instance Subjects"
instance_subjects.appendChild(h3)
subjects_ul = document.createElement("ul")
for subject in instance["subjects"]:
li = document.createElement("li")
li.innerHTML = subject
subjects_ul.appendChild(li)
instance_subjects.appendChild(subjects_ul)
results_div = document.getElementById("lcsh-result")
conversation = await chat_gpt_instance("\n".join(instance["subjects"]))
if "error" in conversation:
results_div.innerHTML = f"""Error status {conversation["error"]}\n{conversation["message"]}"""
else:
for choice in conversation.get("choices"):
pre_elem = document.createElement("pre")
pre_elem.innerHTML = choice["text"]
results_div.appendChild(pre_elem)
async def load_mrc_file():
marc_str = await load_marc_record(marc_file)
main_prompt = document.getElementById("mainChatPrompt")
main_prompt.value = marc_str
def load_sinopia():
sinopia_url_select = document.getElementById("sinopiaURI")
sinopia_iframe = document.getElementById("sinopia-frame")
sinopia_iframe.src = sinopia_url_select.value
def save_edge_ai():
edge_ai_api_url_elem = document.getElementById("edgeAIURI")
edge_ai_api_url = edge_ai_api_url_elem.value
print(f"Saves Edge AI API URI at {edge_ai_api_url}")
</py-script>
<div class="container-fluid">
<div class="row">
<div class="col-9">
<h1>Chatting with Catalogs</h1>
<blockquote>An exploration of using LLMs with Library Systems</blockquote>
</div>
<div class="col-2">
<img src="imgs/hexsticker.png" alt="AI4LAM Hex Sticker and Logo" style="height: 100px;">
</div>
</div>
<div class="row">
<div class="col-md-1">
<div class="btn-group-vertical" role="group">
<button type="button" class="btn btn-outline-danger"
id="chatGPTButton"
data-bs-toggle="modal"
data-bs-target="#chatApiKeyModal">
<img src="imgs/ChatGPT.png" alt="ChatGPT Tools" class="service-btn">
ChatGPT
</button>
<!-- <button type="button"
class="btn btn-outline-danger"
id="edgeAIButton"
data-bs-toggle="modal"
data-bs-target="#edgeAIModal">
Edge AI
</button> -->
<button type="button"
id="folioButton"
class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#folioModal">
<img src="imgs/folio.png" alt="FOLIO LSP" class="service-btn">
FOLIO
</button>
<button type="button"
class="btn btn-outline-success"
id="sinopiaButton"
data-bs-toggle="modal"
data-bs-target="#sinopiaModal">
<img src="imgs/sinopia.png" alt="Sinopia Linked Data Editor" class="service-btn">
Sinopia
</button>
<!-- <button type="button" class="btn btn-outline-danger" data-bs-toggle="modal" data-bs-target="#githubApiKeyModal">
<img src="imgs/github.png" alt="Github Tools" class="service-btn">
Github
</button> //-->
<button type="button"
class="btn btn-outline-success"
data-bs-toggle="offcanvas"
data-bs-target="#pythonREPL" aria-controls="pythonREPL"
>
<img src="imgs/python.png" alt="Python REPL" class="service-btn">
Python
</button>
</div>
</div>
<div class="col-md-11">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active"
id="prompt-tab"
data-bs-toggle="tab"
data-bs-target="#prompt-chat"
role="tab"
aria-selected="true"
aria-controls="prompt-chat">
<i class="bi bi-chat-square-fill"></i> Chat
</a>
</li>
<li class="nav-item">
<a class="nav-link"
id="folio-tab"
data-bs-toggle="tab"
data-bs-target="#folio-system"
role="tab"
aria-selected="true"
aria-controls="folio-system">
<img src="imgs/folio.png" alt="FOLIO LSP" class="service-btn">
FOLIO</a>
</li>
<li class="nav-item">
<a class="nav-link"
id="sinopia-tab"
data-bs-toggle="tab"
data-bs-target="#sinopia"
aria-selected="false"
aria-controls="sinopia">
<img src="imgs/sinopia.png" alt="Sinopia Linked Data Editor" class="service-btn">
Sinopia</a>
</li>
<li class="nav-item">
<a class="nav-link"
id="help-tab"
data-bs-toggle="tab"
data-bs-target="#help"
aria-selected="false"
aria-controls="help">
<i class="bi bi-info-circle"></i> Help & Documentation</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" role="tabpanel" id="prompt-chat" aria-labelledby="prompt-tab">
<div class="container">
<h2 id="workflow-title"></h2>
<div class="row">
<div class="col">
<article class="card text-bg-primary d-none" id="system-card">
<div class="card-header">System Context</div>
<div class="card-body">
<h5 class="card-title">System Message</h5>
<p class="card-text">
System messages helps in setting the behavior of the model
</p>
<div class="card-text" id="system-message"></div>
<h5 class="card-title">Additional Context</h5>
<p class="card-text">For few-shot prompts, provides examples of question and
responses. De-select all examples for a zero-shot prompt.</p>
<div class="text-center">
<button class="btn btn-secondary m-b-1" py-click="new_example()">New Example</button>
</div>
<div id="prompt-examples"></div>
</div>
</article>
<label for="mainChatPrompt" class="form-label">Prompt</label>
<textarea class="form-control" id="mainChatPrompt" rows="10"></textarea>
<div class="btn-group" id="prompt-btn-group">
<input class="btn btn-warning d-none"
type="file"
py-change="asyncio.ensure_future(load_mrc_file())"
id="marc-upload-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-title="Upload MARC21 File">
</input>
<button class="btn btn-info"
py-click="workflow=clear_chat_prompt(chat_gpt_instance)"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-title="Clear Prompt">
<i class="bi bi-wind"></i>
</button>
<button class="btn btn-info"
id="download-chat-wkflw-btn"
data-bs-toggle="tooltip"
data-bs-placement="top"
py-click="download_history()"
data-bs-title="Download Chat Workflow">
<i class="bi bi-cloud-download"></i>
</button>
<button class="btn btn-info"
py-click="asyncio.ensure_future(run_prompt(workflow, chat_gpt_instance))"
data-bs-toggle="tooltip"
data-bs-placement="top"
data-bs-title="Run">
<i class="bi bi-play-fill"></i>
</button>
</div>
</div>
<div class="col">
<h2>Workflows</h2>
<p>
Select a prompt template to launch a specific workflow.
</p>
<ul>
<li>
<a href="#" py-click="load_workflow('new-resource')">Catalog a New Resource by Chat</a>
</li>
<li>
<a href="#" py-click="load_workflow('transform-bf-folio')">Transform Sinopia BIBFRAME to FOLIO Inventory</a>
</li>
<!-- <li class="">
<a href="#" py-click="asyncio.ensure_future(load_workflow('add-lcsh'))">Add LCSH to Sinopia RDF or FOLIO Records</a>
</li> //-->
<li>
<a href="#" py-click="load_workflow('marc-to-folio')">Upload a MARC Record to create a FOLIO Inventory Record</a>
</li>
</ul>
<div class="mt-2 alert alert-info w-75">
<small class="align-middle">Bugs? Ideas for improvment? Please add a ticket <a href="https://github.com/AI4LAM/catalog-chat/issues" target="_blank">here</a>.</small>
</div>
<div class="">
<h2>Vector stores</h2>
<p>
To improve the context of the chat and reduce model hallucinations,
select one or more of the following vector datastores:
</p>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" disabled id="folio-vector-db"></input>
<label class="form-check-label" for="folio-vector-db">FOLIO Inventory</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" disabled id="sinopia-vector-db"></input>
<label class="form-check-label" for="sinopia-vector-db">Sinopia RDF</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" disabled id="lcsh-vector-db"></input>
<label class="form-check-label" for="lcsh-vector-db">Library of Congress Subject Headings (LCSH)</label>
</div>
</div>
</div>
</div>
<div class="text-center d-none" id="chat-loading">
<div class="spinner-border" role="status">
<span class="visually-hidden">Loading...</span>
</div>
</div>
<article>
<h3>Chat History</h3>
<div id="chat-history">
</div>
</article>
</div>
</div>
<div class="tab-pane fade" role="tabpanel" id="folio-system" aria-labelledby="folio-tab">
<div id="folio-default" class="container">
<p>To use the FOLIO Demo site, use the following credentials:</p>
<dl>
<dt>FOLIO URL:</dt>
<dd><a href="https://folio-orchid.dev.folio.org">https://folio-orchid.dev.folio.org</a></dd>
<dt>Okapi URL:</dt>
<dd><a href="https://folio-orchid-okapi.dev.folio.org/">https://folio-orchid-okapi.dev.folio.org//</a></dd>
<dt>Tenant:</dt>
<dd>diku</dd>
<dt>Login:</dt>
<dd>diku_admin</dd>
<dt>Password:</dt>
<dd>admin</dd>
</dl>
<button class="btn btn-warning" py-click="load_folio_default()" data-bs-toggle="modal" data-bs-target="#folioModal">Load</button>
</div>
<iframe id="folio-system-frame" title="Embedded FOLIO System" src="" width="80%" height="800px"></iframe>
</div>
<div class="tab-pane fade" role="tabpanel" id="sinopia" aria-labelledby="sinopia-tab">
<iframe id="sinopia-frame" title="Embedded Sinopia System" src="https://stage.sinopia.io/" width="100%" height="800px">
</iframe>
</div>
<div class="tab-pane fade" role="tabpanel" id="help" aria-labelledby="help-tab" >
<div class="row">
<div class="col">
<div class="container">
<h2>Help</h2>
<div class="alert alert-warning alert-dismissible fade show" role="alert">
<strong>NOTE!</strong> To use <em>Chatting with Catalogs</em>, you'll need an active ChatGPT
<a href="https://help.openai.com/en/articles/4936850-where-do-i-find-my-api-key">token</a>.
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
<p>
A demonstration application for constructing library systems workflows using Large Language
Models (LLM).
</p>
</div>
<article id="workflows" class="container">
<header>
<h3>Workflows</h3>
</header>
<p>
Workflows in this app are inspired by <a href="https://airflow.apache.org/">Apache Airflow</a> and
<a href="https://www.prefect.io/">Prefect.io</a> use of
<a href="https://en.wikipedia.org/wiki/Directed_acyclic_graph">DAGs (Directed Acyclic Graphs)</a>.
Catalog Chat uses the pure-python package, <a href="https://github.com/xianghuzhao/paradag/">paradag</a>,
to construct workflows as a DAG. A workflow wraps LLM API calls along with calling
specific FOLIO Okapi and Sinopia APIs by building context and examples specific to the use case.
</p>
<img src="imgs/workflow-flowchart.png" alt="Basic Cataloging Workflow Flowchart" />
<section>
</section>
</article>
<article id="roadmap" class="container">
<header>
<h3>Roadmap</h3>
</header>
<section>
<ul>
<li>Support for more Large Language Models (Llama2, Claude, Bard, etc.) ticket <a href="https://github.com/AI4LAM/catalog-chat/issues/1">#1</a></li>
<li>Provide API for LCSH Vector datastore</li>
<li>Implement Vector datastore for FOLIO</li>
<li>Implement Vector datastore for Sinopia</li>
</ul>
</section>
</article>
</div>
<div class="col">
<h2>Documentation</h2>
<article id="about" class="container">
<header>
<h3>About this App</h3>
</header>
<section>
The <em>Chatting with Catalogs</em> application is built as a static website using the
<a href="https://pyscript.net/">pyscript</a> project that loads a Python 3.11 environment into your
web-browser through Webassembly. We use the following Python packages:
<ul>
<li><a href="https://github.com/xianghuzhao/paradag/">Paradag</a></li>
<li><a href="https://docs.pydantic.dev/latest/">Pydantic</a></li>
<li><a href="https://pymarc.readthedocs.io/en/latest/">Pymarc</a></li>
<li><a href="https://rdflib.readthedocs.io/en/stable/">RDFLib</a></li>
</ul>
</section>
</article>
<article id="openai-api" class="container">
<header>
<h3>OpenAI API</h3>
</header>
<section>
<p>
This application uses the ChatGPT
<a href="https://platform.openai.com/docs/guides/text-generation/chat-completions-api">chat completion</a> API
using the <code>functions</code> parameter to emulate the ReAct pattern for calling functions that in turn, call
<a href="https://folio.org/">FOLIO</a>'s <a href="https://github.com/folio-org/okapi/">Okapi</a> APIs and
Sinopia's <a href="https://ld4p.github.io/sinopia_api/">APIs</a>
</p>
</section>
</article>
<article class="container" id="meta-wg">
<header>
<h3>ai4lam Metadata Working Group</h3>
</header>
<section>
<p>
The <a href="https://ai4lam.github.io/metadata-working-group/">ai4lam Metadata Working Group</a>, part of
the larger <a href="http://ai4lam.org/">ai4lam</a> community, started experimenting with the web interface
for <a href="https://chat.openai.com/">ChatGPT</a>. In 2023, the group explored the use of ChatGPT which
became the base for the workflows used in this application.
</p>
<ul>
<li>
<a href="#"
data-bs-toggle="modal"
data-bs-target="#gptChatSessionModal"
py-click="load_chat_session('FOLIOBookCheckout')">FOLIO Book Checkout</a>
</li>
<li>
<a href="#"
data-bs-toggle="modal"
data-bs-target="#gptChatSessionModal"
py-click="load_chat_session('MARC21Conversions')">MARC21 Conversion to FOLIO Instance Record</a>
</li>
<li>
<a href="#"
data-bs-toggle="modal"
data-bs-target="#gptChatSessionModal"
py-click="load_chat_session('BFTransformation')">Sinopia BIBFRAME to FOLIO Instance Record & LCSH assignment</a>
</li>
</ul>
</section>
</article>
<!-- <article class="container">
<header>
<h3>Retrieval Augmented Generation (RAG)</h3>
</header> //-->
</article>
<article id="lit-review" class="container">
<header>
<h3>Selected Bibliography</h3>
<figure>
<blockquote class="blockquote">
“...libraries are faced with the challenge of wrangling an infinite amount of data with finite time, funds, and personnel.”
</blockquote>
<figcaption class="blockquote-footer">
Smith, C. (2021). Controlled vocabularies: Past, present and future of subject access.
<cite title="Source Title">Cataloging & Classification Quarterly</cite>, 59(2-3), 186–202.
<a href="https://doi.org/10.1080/01639374.2021.1881007">https://doi.org/10.1080/01639374.2021.1881007</a>
</figcaption>
</figure>
<figure>
<blockquote class="blockquote">
“Many groups have used [automated] tools in a semi-mediated process that best balances out efficiency and quality.”
</blockquote>
<figcaption class="blockquote-footer">
Turp, C. Leanne Olson & Kelly Stathis (2023) From Uncontrolled Keywords to FAST? Attempting Metadata Reconciliation
for a Canadian Research Data Aggregator, <cite title="Source Title">Journal of Library Metadata</cite>,
DOI: <a href="https://doi.org/10.1080/19386389.2023.2251857">10.1080/19386389.2023.2251857</a>
</figcaption>
</figure>
<figure>
<blockquote class="blockquote">
“... catalogers do not have to have a firm grasp on the inner statistical workings of each text mining
algorithm or computation methods…Understanding the process of preparing a corpus, selecting features,
and interpreting output is, perhaps, more important.”
</blockquote>
<figcaption class="blockquote-footer">
Short, M. (2019). Text mining and subject analysis for fiction; or, using machine learning and information
extraction to assign subject headings to dime novels.
<cite title="Source Title">Cataloging & Classification Quarterly</cite>, 57(5), 315-336.
</figcaption>
</figure>
<figure>
<blockquote class="blockquote">
“Catalogers and metadata experts among others in the information field have a role to play in developing,
exploring and responsibly using AI.”
</blockquote>
<figcaption class="blockquote-footer">
Greenberg, J., Zhao, X., Monselise, M., Grabus, S., & Boone, J. (2021). Knowledge organization
systems: a network for AI with helping interdisciplinary vocabulary engineering.
<cite title="Source Title">Cataloging & Classification Quarterly</cite>, 59(8), 720-739.
</figcaption>
</figure>
<figure>
<blockquote class="blockquote">
“Researchers have begun to show that for some professions, the wisest AI implementation scenario is
augmenting existing expertise with semi-automated support, a form of “human
compatible” AI.
</blockquote>
<blockquote class="blockquote">
“If automation is to be useful for the communities it seeks to support, it must be ushered in with
profound appreciation for, and in collaboration with, the professionals the automation would support.”
</blockquote>
<figcaption class="blockquote-footer">
Hahn, J. (2021). Semi-automated methods for bibframe work entity description.
<cite title="Source Title">Cataloging & Classification Quarterly</cite>, 59(8), 853-867.
</figcaption>
</figure>
</article>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Chat API Key Modal -->
<div class="modal fade" id="chatApiKeyModal" tabindex="-1" aria-labelledby="chatApiKeyModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<img src="imgs/ChatGPT.png" alt="ChatGPT Tools">
<h5 class="modal-title" id="apiKeyModalLabel">Enter your ChatGPT API key</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="chatApiKeyModalBody">
<form>
<div class="mb-3">
<label for="chatApiKey" class="form-label">API Key</label>
<input type="text" class="form-control" id="chatApiKey" placeholder="Enter your secret API key" aria-describedby="apiKeyHelp">
<div id="apiKeyHelp" class="form-text">This API key will be used to access restricted resources. Please keep it safe.</div>
</div>
<button type="button"
data-bs-dismiss="modal"
py-click="asyncio.ensure_future(login_chatgpt())"
class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- Edge AI Key Modal -->
<div class="modal fade" id="edgeAIModal" tabindex="-1" aria-labelledby="edgeAIModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="edgeAIModalLabel">Enter Edge AI API URI</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="edgeAIModalBody">
<form>
<div class="mb-3">
<label for="edgeAIURI" class="form-label">Edge AI API</label>
<input type="text" class="form-control" id="edgeAIURI" placeholder="Enter URI to the Edge AI API" aria-describedby="edgeAIapiHelp">
<div id="edgeAIapiHelp" class="form-text">This Edge AI API connects to either a local or remote API endpoint.</div>
</div>
<button type="button"
data-bs-dismiss="modal"
py-click="save_edge_ai()"
class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- FOLIO Login Modal -->
<div class="modal fade" id="folioModal" tabindex="-1" aria-labelledby="folioModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<img src="imgs/folio.png" alt="FOLIO LSP" style="height: 64px;">
<h5 class="modal-title" id="folioModalLabel">Login to FOLIO</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body" id="folioModalBody">
<form>
<div class="mb-3">
<label for="folioURI" class="form-label">FOLIO URI</label>
<input class="form-control" id="folioURI">
</div>
<div class="mb-3">
<label for="okapiURI" class="form-label">Okapi URI</label>
<input class="form-control" id="okapiURI">
</div>
<div class="mb-3">
<label for="folioTenant" class="form-label">Tenant</label>
<input class="form-control" id="folioTenant">
</div>
<div class="mb-3">
<label for="folioUser" class="form-label">Username</label>
<input class="form-control" id="folioUser">
</div>
<div class="mb-3">
<label for="folioPassword" class="form-label">Password</label>
<input type="password" class="form-control" id="folioPassword">
</div>
<button type="button"
data-bs-dismiss="modal"
class="btn btn-primary"
py-click="asyncio.ensure_future(login_okapi())">Login</button>
</form>
</div>
</div>
</div>
</div>
<!-- Github API Key Modal -->
<div class="modal fade" id="githubApiKeyModal" tabindex="-1" aria-labelledby="githubApiKeyModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<img src="imgs/github.png" alt="Github Tools" style="height: 64px;">
<h5 class="modal-title" id="apiKeyModalLabel">Enter your Github API key</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form>
<div class="mb-3">
<label for="githubApiKey" class="form-label">API Key</label>
<input type="text" class="form-control" id="githubApiKey" placeholder="Enter your secret API key" aria-describedby="apiKeyHelp">
<div id="apiKeyHelp" class="form-text">This API key will be used to access restricted resources. Please keep it safe.</div>
</div>
<button class="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- Sinopia Login-->
<div class="modal fade" id="sinopiaModal" tabindex="-1" aria-labelledby="sinopiaModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<img src="imgs/sinopia.png" alt="Sinopia Hex Sticker" style="height: 64px;">
<h5 class="modal-title" id="sinopiaModalLabel">Enter Sinopia URI</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<form>
<div class="mb-3">
<label for="sinopiaURI" class="form-label">Sinopia URI</label>
<select id="sinopiaURI" aria-describedby="sinopiaHelp" class="form-control">
<option value="https://development.sinopia.io">Development (https://development.sinopia.io)</option>
<option value="https://stage.sinopia.io">Stage (https://stage.sinopia.io)</option>
<option value="https://sinopia.io">Production (https://sinopia.io)</option>
</select>
<div id="sinopiaHelp" class="form-text">Please select development, stage, or production Sinopia environments</div>
</div>
<button class="btn btn-primary"
data-bs-dismiss="modal"
type="button"
py-click="load_sinopia()">Submit</button>
</form>
</div>
</div>
</div>
</div>
<!-- ChatGPT Session-->
<div class="modal" tabindex="-1" id="gptChatSessionModal" aria-hidden="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Workflow</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<iframe src="" id="chat-gpt-session" width="95%" height="800px"></iframe>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- Python OffCanvas -->
<div class="offcanvas offcanvas-bottom"
tabindex="-1"
id="pythonREPL"
style="background-color: rgb(245, 249, 250)"
data-bs-scroll="true"
data-bs-backdrop="false"
aria-labelledby="pythonOffCanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="pythonOffCanvasLabel">
<img src="imgs/python.png" alt="Python REPL" class="service-btn">
Python
</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<div class="row">
<div class="col-md-2">
<p>Interact Programmatically with Tools through the REPL</p>
<strong>Global Variables</strong>
<ul>
<li><code>workflow</code> - The current workflow object, default is None</li>
<li><code>chat_gpt_instance</code> - Chat GPT Instance</li>
</ul>
</div>
<div class="col-md-9">
<div id="python-wrapper">
<py-repl id="chat-repl" auto-generate="true"></py-repl>
<div id="py-output"></div>
</div>
</div>
</div>
</div>
</div>
<!-- Error Toast -->
<div aria-live="polite" aria-atomic="true" class="d-flex justify-content-center align-items-center w-100">
<div id="errorToast" class="toast" role="alert" aria-live="assertive" aria-atomic="true">
<div class="toast-header">
<strong class="me-auto">Error Message</strong>
<small>11 mins ago</small>
<button type="button" class="btn-close" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
<div class="toast-body" id="errorToastBody"></div>
</div>
</div>
</div>
<footer class="p-2 mt-2 rounded bg-secondary-subtle">
<small>
<p>
An experimental Chat application by AI4LAM Metadata Working Group.
Version <span id="version"></span> ©2023-2024. All source code licensed under the Apache 2, code repository at
<a href="https://github.com/AI4LAM/catalog-chat">https://github.com/AI4LAM/catalog-chat</a>.
</p>
</small>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script>
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
<script>
const tooltipTriggerList = document.querySelectorAll('[data-bs-toggle="tooltip"]')
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl))
</script>
</body>
</html>