Midrash.ai is an experiment to explore the meaning of “truth” and “bias” in AI chatbots, using the Babylonian Talmud as an example. The Talmud is considered by some to be the canon interpretation of the Torah, which is in turn considered to be the source of absolute truth. The Talmud provides us with several useful characteristics to explore questions of bias and truth in AI chatbots: -- Who are appropriate validators of truth? (e.g. Religious officials, The “crowd”, Ourselves) -- Do we situate bias in a generative model in its ability to describe its underlying distribution, or its accordance with proper moral effect? -- The Talmud is an explicit “source of truth” in that its underlying values are directly declared. How does this help us examine the same questions for systems in which the underlying value systems are implicit, un-declared, or deliberately obscured?
You can access a hosted version of Midrash.ai here: https://midrash.ai
Midrash.ai is a partnership between Handshake (https://handshake.fyi) and AI and Faith (https://aiandfaith.org).
Midrash.ai is based on an English translation of the Babylonian Talmud by Michael L Rodkinson. The original PDF, and the OCR'd text, can be found here: https://drive.google.com/drive/u/0/folders/176M_zubz3AktyL1H4wq8_7l6IpWOsLWw
MidrashBot uses a fairly standard architecture of retrieval-enhanced generation to produce its answers. An edition of the Babylonian Talmud is programmatically divided into chunks that are converted into searchable “embeddings.” When a question is posed to the system, it appends chunks into the prompt whose embeddings fall below a minimum vector distance from the question.
- Methods:
GET
- Returns:
- index
- JavaScript
- images
- Methods:
POST
- Body:
message
: string -ai
: string (openai or ai)
- Returns:
- Stream text good response, text/plain stream
- Methods:
POST
- Body:
message
: string
- Returns:
document
: document titledocumentcontent
: document contentinput_id
: "i"message
: message equal to the message sentpinecone
: hash of the message, id in pinecone
- Function: Handles form request to the backend
- Properties:
searchValue
isLoading
isWaiting
result
reference
statusMessage
stream
refer
refcontent
text
abortController
ai
.
- Methods:
handleSubmit
- Submits the form and updates the answer and reference content.
getContent
- Fetches content based on the user prompt.
-
Function: Handles typing animation for generating, predicting and researching text.
-
Properties:
displayText
words
currentWordIndex
typingSpeed
deletingSpeed
pauseDuration
isDeleting
.
-
Methods:
type
- Types the text with animation.
delete
- Deletes the text with animation.
sleep
- Sets a pause with input duration.
init
- Initializes the typing animation loop.
- Store:
globalState
- Properties:
showAnswer
showReference
showBookReference
- Methods:
toggleAnswer
- Toggles answer visibility.
toggleReference
- Toggles reference visibility.
toggleBookReference
- Toggles book reference visibility.