diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000000000000000000000000000000000000..587532310e7c4ef0194423d3f90e9d252f20153f
Binary files /dev/null and b/.DS_Store differ
diff --git a/.gitattributes b/.gitattributes
index a6344aac8c09253b3b630fb776ae94478aa0275b..49b5446751e295a519d356381a6c2ee363c842f9 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,35 +1,35 @@
-*.7z filter=lfs diff=lfs merge=lfs -text
-*.arrow filter=lfs diff=lfs merge=lfs -text
-*.bin filter=lfs diff=lfs merge=lfs -text
-*.bz2 filter=lfs diff=lfs merge=lfs -text
-*.ckpt filter=lfs diff=lfs merge=lfs -text
-*.ftz filter=lfs diff=lfs merge=lfs -text
-*.gz filter=lfs diff=lfs merge=lfs -text
-*.h5 filter=lfs diff=lfs merge=lfs -text
-*.joblib filter=lfs diff=lfs merge=lfs -text
-*.lfs.* filter=lfs diff=lfs merge=lfs -text
-*.mlmodel filter=lfs diff=lfs merge=lfs -text
-*.model filter=lfs diff=lfs merge=lfs -text
-*.msgpack filter=lfs diff=lfs merge=lfs -text
-*.npy filter=lfs diff=lfs merge=lfs -text
-*.npz filter=lfs diff=lfs merge=lfs -text
-*.onnx filter=lfs diff=lfs merge=lfs -text
-*.ot filter=lfs diff=lfs merge=lfs -text
-*.parquet filter=lfs diff=lfs merge=lfs -text
-*.pb filter=lfs diff=lfs merge=lfs -text
-*.pickle filter=lfs diff=lfs merge=lfs -text
-*.pkl filter=lfs diff=lfs merge=lfs -text
-*.pt filter=lfs diff=lfs merge=lfs -text
-*.pth filter=lfs diff=lfs merge=lfs -text
-*.rar filter=lfs diff=lfs merge=lfs -text
-*.safetensors filter=lfs diff=lfs merge=lfs -text
-saved_model/**/* filter=lfs diff=lfs merge=lfs -text
-*.tar.* filter=lfs diff=lfs merge=lfs -text
-*.tar filter=lfs diff=lfs merge=lfs -text
-*.tflite filter=lfs diff=lfs merge=lfs -text
-*.tgz filter=lfs diff=lfs merge=lfs -text
-*.wasm filter=lfs diff=lfs merge=lfs -text
-*.xz filter=lfs diff=lfs merge=lfs -text
-*.zip filter=lfs diff=lfs merge=lfs -text
-*.zst filter=lfs diff=lfs merge=lfs -text
-*tfevents* filter=lfs diff=lfs merge=lfs -text
+ai-ta-env/lib/python3.12/site-packages/torch/lib/libtorch_cpu.dylib filter=lfs diff=lfs merge=lfs -text
+course-logistics-retriever/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
+c_textbook.pdf filter=lfs diff=lfs merge=lfs -text
+chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_notes/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/index_metadata.pickle filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/link_lists.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/header.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/index_metadata.pickle filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/length.bin filter=lfs diff=lfs merge=lfs -text
+chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/link_lists.bin filter=lfs diff=lfs merge=lfs -text
+course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/data_level0.bin filter=lfs diff=lfs merge=lfs -text
+course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/header.bin filter=lfs diff=lfs merge=lfs -text
+course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/length.bin filter=lfs diff=lfs merge=lfs -text
+ece120-spring-2022-notes-for-students-1.pdf filter=lfs diff=lfs merge=lfs -text
+textbook.pdf filter=lfs diff=lfs merge=lfs -text
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..756ed7913a142c9ada3f010654da39d9253d0dc0
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,10 @@
+venv/
+venv2/
+.env
+__pycache__/chroma_db_textbook_c/chroma.sqlite3
+ai-ta-env/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_pybind11_state.so
+chroma_db_textbook_c/chroma.sqlite3
+ai-ta-env/lib/python3.12/site-packages/torch/lib/libtorch_cpu.dylib
+ai-ta-env
+echo "/Users/nittinmurthi/Documents/VS_Code/120-AI-TA/course-logistics-retriever" >> .gitignore
+echo "/Users/nittinmurthi/Documents/VS_Code/120-AI-TA/ai-ta-env" >> .gitignore
\ No newline at end of file
diff --git a/.gradio/certificate.pem b/.gradio/certificate.pem
new file mode 100644
index 0000000000000000000000000000000000000000..b85c8037f6b60976b2546fdbae88312c5246d9a3
--- /dev/null
+++ b/.gradio/certificate.pem
@@ -0,0 +1,31 @@
+-----BEGIN CERTIFICATE-----
+MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
+TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
+cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
+WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
+ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
+MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
+h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
+0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
+A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
+T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
+B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
+B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
+KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
+OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
+jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
+qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
+rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
+HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
+hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
+ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
+3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
+NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
+ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
+TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
+jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
+oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
+4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
+mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
+emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
+-----END CERTIFICATE-----
diff --git a/README.md b/README.md
index db83f4e84c1f911548cb796187b6b3061f7ee944..e67e32e0f789a5889d533d49ec60900070c7f100 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,7 @@
----
-title: 120 AI TA
-emoji: 🦀
-colorFrom: purple
-colorTo: yellow
-sdk: gradio
-sdk_version: 5.0.2
-app_file: app.py
-pinned: false
-license: mit
----
-
-Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
+---
+title: 120-AI-TA
+app_file: app.py
+sdk: gradio
+sdk_version: 5.0.1
+---
+# 120-AI-Assistant
diff --git a/README_utf8.md b/README_utf8.md
new file mode 100644
index 0000000000000000000000000000000000000000..5fc0e41fbb040c9a8a1bf3ccb2dbe1b0017b6f48
--- /dev/null
+++ b/README_utf8.md
@@ -0,0 +1 @@
+# 120-AI-Assistant
diff --git a/__pycache__/db.cpython-312.pyc b/__pycache__/db.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..61674f1d9871068eb2a80a3ec06bb22cfdfe5a77
Binary files /dev/null and b/__pycache__/db.cpython-312.pyc differ
diff --git a/__pycache__/gradio_demo.cpython-312.pyc b/__pycache__/gradio_demo.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c56496f4bc05e82c7d200d35cf6a7c8701cbacf1
Binary files /dev/null and b/__pycache__/gradio_demo.cpython-312.pyc differ
diff --git a/__pycache__/jdoodle.cpython-312.pyc b/__pycache__/jdoodle.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5548c37f24bfef47029ca62b1fc772788b0c9c12
Binary files /dev/null and b/__pycache__/jdoodle.cpython-312.pyc differ
diff --git a/__pycache__/rag_agent.cpython-312.pyc b/__pycache__/rag_agent.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0b61bce80c78281815901156b07b7a25f8ee8d38
Binary files /dev/null and b/__pycache__/rag_agent.cpython-312.pyc differ
diff --git a/__pycache__/run.cpython-312.pyc b/__pycache__/run.cpython-312.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7290b931deee6d95ad7ad4b01052954c42643335
Binary files /dev/null and b/__pycache__/run.cpython-312.pyc differ
diff --git a/app.py b/app.py
new file mode 100644
index 0000000000000000000000000000000000000000..f8e1bad385c9dfc7d55e30b77f74b7e9495ffdd1
--- /dev/null
+++ b/app.py
@@ -0,0 +1,7 @@
+import gradio as gr
+
+from gradio_demo import build_app
+
+if __name__ == "__main__":
+ app = build_app()
+ app.queue().launch(server_name="0.0.0.0", server_port=4700, share=True)
\ No newline at end of file
diff --git a/build_db.py b/build_db.py
new file mode 100644
index 0000000000000000000000000000000000000000..d56747d726c765985b865b20d2fb8812ca255042
--- /dev/null
+++ b/build_db.py
@@ -0,0 +1,195 @@
+import tiktoken
+import json
+import glob
+import os
+# import latex2markdown
+from langchain.embeddings import OpenAIEmbeddings
+from langchain.document_loaders import PyPDFLoader
+from langchain.document_loaders import TextLoader
+from langchain.text_splitter import RecursiveCharacterTextSplitter
+from langchain.vectorstores import Chroma
+from langchain.docstore.document import Document
+from langchain.document_loaders import UnstructuredHTMLLoader
+from langchain.document_loaders import BSHTMLLoader
+
+from dotenv import load_dotenv
+
+load_dotenv()
+
+model_name = "gpt-3.5-turbo-16k"
+
+encoding = tiktoken.encoding_for_model(model_name)
+
+
+def get_tiktoken_length(text):
+ return len(encoding.encode(text))
+
+# Build syllabus DB
+
+
+loader = TextLoader('course_name.txt')
+raw_documents = loader.load()
+
+text_splitter = RecursiveCharacterTextSplitter(
+ chunk_size=512,
+ chunk_overlap=128,
+ length_function=get_tiktoken_length,
+ is_separator_regex=False,
+)
+
+documents = text_splitter.split_documents(raw_documents)
+
+embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+db = Chroma.from_documents(
+ documents, embedding=embedding, persist_directory="chroma_db_course_name"
+)
+
+
+# # Build testbook DB
+
+loader = PyPDFLoader("textbook.pdf")
+pages = loader.load_and_split()
+
+text_splitter = RecursiveCharacterTextSplitter(
+ chunk_size=512,
+ chunk_overlap=128,
+ length_function=get_tiktoken_length,
+ is_separator_regex=False,
+)
+
+documents = text_splitter.split_documents(pages)
+
+embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+db = Chroma.from_documents(
+ documents, embedding=embedding, persist_directory="chroma_db_textbook"
+)
+
+
+# Build course overview
+
+loader = PyPDFLoader("course_overview.pdf")
+pages = loader.load_and_split()
+
+text_splitter = RecursiveCharacterTextSplitter(
+ chunk_size=512,
+ chunk_overlap=128,
+ length_function=get_tiktoken_length,
+ is_separator_regex=False,
+)
+
+documents = text_splitter.split_documents(pages)
+
+embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+db = Chroma.from_documents(
+ documents, embedding=embedding, persist_directory="chroma_db_course_overview"
+)
+
+# build Overview from html
+# loader = BSHTMLLoader(
+# "Course Overview and Policies - Fall 2023_ Fall 2023-ECE 120-Introduction to Computing-Sections AD1, AD2, AD3, AD4, AD5, AD6, AD7, AD8, AD9, ADA, ADB, ADC, AL1, AL2, AL3, AL5.html")
+# data = loader.load()
+
+# text_splitter = RecursiveCharacterTextSplitter(
+# chunk_size=512,
+# chunk_overlap=128,
+# length_function=get_tiktoken_length,
+# is_separator_regex=False,
+# )
+
+# documents = text_splitter.split_documents(data)
+
+# embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+# print(documents)
+# db = Chroma.from_documents(
+# documents, embedding=embedding, persist_directory="chroma_db_courseoverview_policies"
+# )
+
+
+# build Office Hours from html
+# loader = BSHTMLLoader(
+# "Course Overview and Policies - Fall 2023 Fall 2023-ECE 120-Introduction to Computing.html")
+# data = loader.load()
+
+# text_splitter = RecursiveCharacterTextSplitter(
+# chunk_size=512,
+# chunk_overlap=128,
+# length_function=get_tiktoken_length,
+# is_separator_regex=False,
+# )
+
+# documents = text_splitter.split_documents(data)
+
+# embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+# print(documents)
+# db = Chroma.from_documents(
+# documents, embedding=embedding, persist_directory="chroma_db_courseoverview_policies"
+# )
+
+# Build notebook DB
+
+loader = PyPDFLoader("ece120-spring-2022-notes-for-students-1.pdf")
+pages = loader.load_and_split()
+# print(pages[0])
+
+text_splitter = RecursiveCharacterTextSplitter(
+ chunk_size=512,
+ chunk_overlap=128,
+ length_function=get_tiktoken_length,
+ is_separator_regex=False,
+)
+
+documents = text_splitter.split_documents(pages)
+
+embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+db = Chroma.from_documents(
+ documents, embedding=embedding, persist_directory="chroma_db_notes"
+)
+
+
+# Build from canvas
+
+# directory_path = "./canvas"
+
+# # Loop through all files in the directory
+# for filename in os.listdir(directory_path):
+# file_path = os.path.join(directory_path, filename)
+# if os.path.isfile(file_path) and filename != ".DS_Store":
+
+# # print(filename)
+# if filename.endswith(".html"):
+# loader = UnstructuredHTMLLoader(file_path)
+# data = loader.load()
+# else:
+# loader = PyPDFLoader(file_path)
+# data = loader.load_and_split()
+
+# # if (filename == "Office Hours FA23.html"):
+# # #print(data)
+# # if (filename.endswith(".pdf")):
+# # print(data)
+# text_splitter = RecursiveCharacterTextSplitter(
+# chunk_size=512,
+# chunk_overlap=128,
+# length_function=get_tiktoken_length,
+# is_separator_regex=False,
+# )
+
+# documents = text_splitter.split_documents(data)
+
+# embedding = OpenAIEmbeddings(model="text-embedding-ada-002")
+
+# # print(documents)
+# filename = filename.replace(".html", "")
+# filename = filename.replace(".pdf", "")
+# filename = filename.replace(" ", "_")
+# db_name = "chroma_db_" + filename
+# print(db_name)
+# db = Chroma.from_documents(
+# documents, embedding=embedding, persist_directory=db_name
+# )
diff --git a/c_textbook.pdf b/c_textbook.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..498fb986a9b29b633aaa5a73cc4a09912c360781
--- /dev/null
+++ b/c_textbook.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:2e962d60a6dc5b4a2fc86bd33f916a740edd98b53ebcd26ba3e7780cd7899186
+size 3241540
diff --git a/chat_logs.db b/chat_logs.db
new file mode 100644
index 0000000000000000000000000000000000000000..fcca7ced38490821fbb4b7f97283322e18324b9b
Binary files /dev/null and b/chat_logs.db differ
diff --git a/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/data_level0.bin b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..8d59af8d46593f309b55ca904928b8064fded705
--- /dev/null
+++ b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a13e72541800c513c73dccea69f79e39cf4baef4fa23f7e117c0d6b0f5f99670
+size 3212000
diff --git a/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/header.bin b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..5e3435b012ee69310b8100812b2faf2bd6a11f73
--- /dev/null
+++ b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ec6df10978b056a10062ed99efeef2702fa4a1301fad702b53dd2517103c746
+size 100
diff --git a/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/length.bin b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..fb155d822b6ca4351e2925bbc2dba0f49f05e0ab
--- /dev/null
+++ b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fc19b1997119425765295aeab72d76faa6927d4f83985d328c26f20468d6cc76
+size 4000
diff --git a/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/link_lists.bin b/chroma_db/4401fb4d-4c8b-4751-9d49-ab876fb94f37/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/chroma_db/chroma.sqlite3 b/chroma_db/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..f3e09086e1ee78ecdc5a414085bf1957436a8cbc
Binary files /dev/null and b/chroma_db/chroma.sqlite3 differ
diff --git a/chroma_db_c_textbook/chroma.sqlite3 b/chroma_db_c_textbook/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..b3c38a3b067ef7b359be41e51546e36827d13b8d
Binary files /dev/null and b/chroma_db_c_textbook/chroma.sqlite3 differ
diff --git a/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/data_level0.bin b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..7a6a34e26606bc819339fb574fda4bf75cea708c
--- /dev/null
+++ b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f18abd8c514282db82706e52b0a33ed659cd534e925a6f149deb7af9ce34bd8e
+size 6284000
diff --git a/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/header.bin b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..ee204d8a496230eb2a7ef3501254a60686e579bb
--- /dev/null
+++ b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:effaa959ce2b30070fdafc2fe82096fc46e4ee7561b75920dd3ce43d09679b21
+size 100
diff --git a/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/length.bin b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..f1ad320994a264645b64dce38108a537b644ee83
--- /dev/null
+++ b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:1a88ac0fd7dd9df9afbed531948b627b6b61aeb64e28869c6c7945aa988b500b
+size 4000
diff --git a/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/link_lists.bin b/chroma_db_course_name/6e11f3ac-c45c-4301-be21-bb6f466a3945/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/chroma_db_course_name/chroma.sqlite3 b/chroma_db_course_name/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..c37881ad4549f23cd478ad2926eeee4e85f47687
Binary files /dev/null and b/chroma_db_course_name/chroma.sqlite3 differ
diff --git a/chroma_db_course_overview/chroma.sqlite3 b/chroma_db_course_overview/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..4ad33dae60068a5ea39e2333255598a77a6bcbaa
Binary files /dev/null and b/chroma_db_course_overview/chroma.sqlite3 differ
diff --git a/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/data_level0.bin b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..7a6a34e26606bc819339fb574fda4bf75cea708c
--- /dev/null
+++ b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f18abd8c514282db82706e52b0a33ed659cd534e925a6f149deb7af9ce34bd8e
+size 6284000
diff --git a/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/header.bin b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..ee204d8a496230eb2a7ef3501254a60686e579bb
--- /dev/null
+++ b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:effaa959ce2b30070fdafc2fe82096fc46e4ee7561b75920dd3ce43d09679b21
+size 100
diff --git a/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/length.bin b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..fb155d822b6ca4351e2925bbc2dba0f49f05e0ab
--- /dev/null
+++ b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fc19b1997119425765295aeab72d76faa6927d4f83985d328c26f20468d6cc76
+size 4000
diff --git a/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/link_lists.bin b/chroma_db_course_overview/d9bb09c9-1853-4372-b5c7-f334ac48161b/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/data_level0.bin b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..8d59af8d46593f309b55ca904928b8064fded705
--- /dev/null
+++ b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a13e72541800c513c73dccea69f79e39cf4baef4fa23f7e117c0d6b0f5f99670
+size 3212000
diff --git a/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/header.bin b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..5e3435b012ee69310b8100812b2faf2bd6a11f73
--- /dev/null
+++ b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ec6df10978b056a10062ed99efeef2702fa4a1301fad702b53dd2517103c746
+size 100
diff --git a/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/length.bin b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..d2841a4937737486efb0c7bb48c68683f3632472
--- /dev/null
+++ b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:45c7c76f8f8086b86de48e545f6e9581ae9f4fba9dcc53463690d4354d39f8ba
+size 4000
diff --git a/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/link_lists.bin b/chroma_db_kc/8eef439e-cf2c-4d12-937d-5366c39ffecd/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/chroma_db_kc/chroma.sqlite3 b/chroma_db_kc/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..07ae991abe63333ae8e97e51ce460d5c02182a0a
Binary files /dev/null and b/chroma_db_kc/chroma.sqlite3 differ
diff --git a/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/data_level0.bin b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..7a6a34e26606bc819339fb574fda4bf75cea708c
--- /dev/null
+++ b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f18abd8c514282db82706e52b0a33ed659cd534e925a6f149deb7af9ce34bd8e
+size 6284000
diff --git a/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/header.bin b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..ee204d8a496230eb2a7ef3501254a60686e579bb
--- /dev/null
+++ b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:effaa959ce2b30070fdafc2fe82096fc46e4ee7561b75920dd3ce43d09679b21
+size 100
diff --git a/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/length.bin b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..fb155d822b6ca4351e2925bbc2dba0f49f05e0ab
--- /dev/null
+++ b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fc19b1997119425765295aeab72d76faa6927d4f83985d328c26f20468d6cc76
+size 4000
diff --git a/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/link_lists.bin b/chroma_db_notes/5f8958b6-6ac3-46de-87da-80db44ea546a/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/chroma_db_notes/chroma.sqlite3 b/chroma_db_notes/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..1eb641457d42306f056601ae4035cfb664e340f9
--- /dev/null
+++ b/chroma_db_notes/chroma.sqlite3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:9fdee3172227f8ddce213a7f3159ee53bc144c015e3e8dd92b62f47351913550
+size 9121792
diff --git a/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/data_level0.bin b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..faa4516d5a36a24f9137585efc24e065747f26d6
--- /dev/null
+++ b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:5b9993fe3a9429aebda5585cc954098ba0cfc6e28445542be944ee3790fba024
+size 6284000
diff --git a/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/header.bin b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..4bce9972fd294c4a8815898ca42b14721e9811bc
--- /dev/null
+++ b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0095dc22dcae266b3f572b771887f967744661616a421d65b394c2f9b390b42b
+size 100
diff --git a/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/index_metadata.pickle b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/index_metadata.pickle
new file mode 100644
index 0000000000000000000000000000000000000000..23a0e158e9ce90c3208b5a0d44d4125a6a9d6e52
--- /dev/null
+++ b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/index_metadata.pickle
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:614e6b187763097db23e55abba2455ca9b19a5b2dc21cabfff7011f99e862202
+size 55974
diff --git a/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/length.bin b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..fb155d822b6ca4351e2925bbc2dba0f49f05e0ab
--- /dev/null
+++ b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fc19b1997119425765295aeab72d76faa6927d4f83985d328c26f20468d6cc76
+size 4000
diff --git a/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/link_lists.bin b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..910aaef1956ba1a26c7928a7f6b64737b652dd36
--- /dev/null
+++ b/chroma_db_textbook/b5f1423b-51bb-4c00-aa38-a01906190de4/link_lists.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:7f2a57b34857379dbe4794748e80e19d9493cf8d8524465b264d98bbee541df1
+size 8148
diff --git a/chroma_db_textbook/chroma.sqlite3 b/chroma_db_textbook/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..0adba550e1374d8127c5c5a40930f2272e0b89bf
--- /dev/null
+++ b/chroma_db_textbook/chroma.sqlite3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:35b8186f22b95b25ca7f2f6e13e8ff95dccd447c1ecaf3e85b9a4f70c2539d87
+size 24813568
diff --git a/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/data_level0.bin b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..b67d78559b65349d1566fb014b9c3fe8852c8bea
--- /dev/null
+++ b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:941e01b1786d6c1a46abf6a6e91c93eebdfc584ee69b222115ed843a8420b15c
+size 41756000
diff --git a/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/header.bin b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..9d39d16ce994cf3355f749d46033e0c5f9310d0e
--- /dev/null
+++ b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:abaff80be8b0830b667c74b7c6591b0298d04f6cd0d748f1f27d290574b2bfac
+size 100
diff --git a/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/index_metadata.pickle b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/index_metadata.pickle
new file mode 100644
index 0000000000000000000000000000000000000000..519fe86ca70092ed1d787131dfafaba1e35611e7
--- /dev/null
+++ b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/index_metadata.pickle
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:93a2806174103a6c1d8ff5f99140ca1ddfb1513f58f9c67a0c661e83a62f78b5
+size 752213
diff --git a/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/length.bin b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..45e3398cba8befd964bac1503f5e5ad4db412119
--- /dev/null
+++ b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:4f9fdb09de08b61ebcf72b6158ef4e2e274c9670163dfcfc78afd18c48602f00
+size 52000
diff --git a/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/link_lists.bin b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..651f7ceae89ab0eb7fcbd2eca2cb80bbfa600bac
--- /dev/null
+++ b/chroma_db_textbook_c/a4183442-2316-4aac-a81b-f420a95571af/link_lists.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:682439a867d16871ebf46f353c2895bfc2da0adf9aefc7a18d3a1f2d7a32ec38
+size 113676
diff --git a/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/data_level0.bin b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/data_level0.bin
new file mode 100644
index 0000000000000000000000000000000000000000..edbc20105be4deb12a35e726e4bb1b4feade936c
--- /dev/null
+++ b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/data_level0.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:531ad6699fec90b2ce1a1b903513c48cad88557ef38e00742ba70a0e8dce4cda
+size 3212000
diff --git a/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/header.bin b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/header.bin
new file mode 100644
index 0000000000000000000000000000000000000000..5e3435b012ee69310b8100812b2faf2bd6a11f73
--- /dev/null
+++ b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/header.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:0ec6df10978b056a10062ed99efeef2702fa4a1301fad702b53dd2517103c746
+size 100
diff --git a/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/length.bin b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/length.bin
new file mode 100644
index 0000000000000000000000000000000000000000..fb155d822b6ca4351e2925bbc2dba0f49f05e0ab
--- /dev/null
+++ b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/length.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:fc19b1997119425765295aeab72d76faa6927d4f83985d328c26f20468d6cc76
+size 4000
diff --git a/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/link_lists.bin b/course-logistics-retriever/259a86b0-454b-4c1a-87eb-d61787722f66/link_lists.bin
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/course-logistics-retriever/chroma.sqlite3 b/course-logistics-retriever/chroma.sqlite3
new file mode 100644
index 0000000000000000000000000000000000000000..9b073a5dd21901736ae6817371146197dd8cb4d8
--- /dev/null
+++ b/course-logistics-retriever/chroma.sqlite3
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a2c62370ebd32b1318a6ba9fd4855f9dbbf8c9916a1d54ec43ad7bec6b6136ee
+size 77008896
diff --git a/course_name.txt b/course_name.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9d678960662417f9cb39ad19e40054ca2ef478b4
--- /dev/null
+++ b/course_name.txt
@@ -0,0 +1 @@
+ECE 120 - Introduction to Computing
\ No newline at end of file
diff --git a/course_overview.pdf b/course_overview.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..879caa60b36f763f9846b28d6ba7d24a31e343d5
Binary files /dev/null and b/course_overview.pdf differ
diff --git a/db.py b/db.py
new file mode 100644
index 0000000000000000000000000000000000000000..9c8f8893f29a6e14f2ec57abee04bec527cbf419
--- /dev/null
+++ b/db.py
@@ -0,0 +1,92 @@
+import sqlite3
+import hashlib
+import uuid
+# Hash passwords
+def hash_password(password):
+ return hashlib.sha256(password.encode()).hexdigest()
+# Authenticate user and return session ID
+def authenticate_user(username, password):
+ conn = init_db()
+ hashed_password = hash_password(password)
+
+ # Check if user exists
+ user = conn.execute('SELECT * FROM users WHERE username = ? AND password = ?', (username, hashed_password)).fetchone()
+
+ if user:
+ # Create or update session ID
+ session_id = str(uuid.uuid4())
+ conn.execute('UPDATE users SET session_id = ? WHERE id = ?', (session_id, user[0]))
+ conn.commit()
+ conn.close()
+ return session_id # Return session ID
+ conn.close()
+ return None
+# Register new user
+def register_user(username, password):
+ conn = init_db()
+ hashed_password = hash_password(password)
+ try:
+ conn.execute('INSERT INTO users (username, password) VALUES (?, ?)', (username, hashed_password))
+ conn.commit()
+ conn.close()
+ return "User registered successfully!"
+ except sqlite3.IntegrityError:
+ return "Username already exists."
+# Get user by session ID
+def get_user_by_session(session_id):
+ conn = init_db()
+ result = conn.execute('SELECT id FROM users WHERE session_id = ?', (session_id,)).fetchone()
+ conn.close()
+ if result is not None:
+ user_id = result[0] # Extract the integer user_id from the tuple
+ return user_id
+ else:
+ return None # Handle the case where no user is found
+# Log chat messages and responses
+def log_chat(user_id, session_id, message, response):
+ conn = init_db()
+ conn.execute(
+ 'INSERT INTO chat_logs (user_id, session_id, message, response) VALUES (?, ?, ?, ?)',
+ (user_id, session_id, message, response)
+ )
+ conn.commit()
+ conn.close()
+# Get chat history for a user session
+def get_chat_history(session_id):
+ conn = init_db()
+ logs = conn.execute('SELECT message, response, timestamp FROM chat_logs WHERE session_id = ?', (session_id,)).fetchall()
+ conn.close()
+ return logs
+def init_db():
+ conn = sqlite3.connect('chat_logs.db')
+ return conn
+# Function to create necessary tables (users and chat_logs)
+def create_tables():
+ conn = init_db()
+ # Create users table if it doesn't exist
+ conn.execute('''
+ CREATE TABLE IF NOT EXISTS users (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ username TEXT UNIQUE NOT NULL,
+ password TEXT NOT NULL,
+ session_id TEXT
+ )
+ ''')
+
+ # Create chat logs table if it doesn't exist
+ conn.execute('''
+ CREATE TABLE IF NOT EXISTS chat_logs (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ user_id INTEGER,
+ session_id TEXT,
+ message TEXT,
+ response TEXT,
+ timestamp TEXT,
+ FOREIGN KEY (user_id) REFERENCES users(id)
+ )
+ ''')
+ conn.commit()
+ conn.close()
+if __name__ == "__main__":
+ create_tables()
+ print("Tables created successfully!")
\ No newline at end of file
diff --git a/ece120-spring-2022-notes-for-students-1.pdf b/ece120-spring-2022-notes-for-students-1.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..273f1cfde2a560c85dfe7ca9d4e47c37ac5a641b
--- /dev/null
+++ b/ece120-spring-2022-notes-for-students-1.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:67a8da8b26206e84df82d3c5a96307170c00506d843c825f1cf4117677db8171
+size 1557554
diff --git a/gradio_demo.py b/gradio_demo.py
new file mode 100644
index 0000000000000000000000000000000000000000..20a93e252d4bdbf168ea8b19bdc835ddbffafd22
--- /dev/null
+++ b/gradio_demo.py
@@ -0,0 +1,507 @@
+# import openai
+# import gradio as gr
+# from rag_agent import llm, get_rag_agent
+# import logging
+# import uuid
+# import os
+# import sys
+# import traceback
+# from jdoodle import compile_c_code
+# from transformers import AutoModel, AutoTokenizer
+# import torch
+# from
+#
+# import Client
+# from langchain.callbacks import StdOutCallbackHandler
+# from langchain_core.callbacks import BaseCallbackHandler
+# from langchain_core.language_models import BaseLanguageModel
+# from langchain.tools import BaseTool
+# from typing import List, Dict, Any
+# from db import authenticate_user, register_user, log_chat, get_chat_history, get_user_by_session
+
+# from openai import AzureOpenAI
+
+# class RunIDCallbackHandler(BaseCallbackHandler):
+# def __init__(self):
+# self.run_id = None
+# def on_chain_start(self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) -> None:
+# self.run_id = kwargs.get("run_id")
+
+# os.environ["LANGCHAIN_API_KEY"] = "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"
+# os.environ["LANGCHAIN_TRACING_V2"] = "true"
+# os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
+# os.environ["LANGCHAIN_PROJECT"] = "langsmith-tutorial"
+
+# print("API-KEY: " + os.environ.get("LANGCHAIN_API_KEY"))
+# print("ENDPOINT: " + os.environ.get("LANGCHAIN_ENDPOINT"))
+
+# print(openai.__version__)
+
+# client = Client()
+
+# def get_initial_prompt():
+# return """🤖: Hello!
+# I am an AI Teaching Assistant built to answer all your questions on ECE120.
+# - You can ask about ECE120, any assignment, and even general concepts such as assembly.
+# - You can ask about specific concepts such as "What is a logic gate?"
+# - Seek clarification on course material: "Can you explain the concept of state diagrams with an example?"
+# - Inquire about assignment instructions: "What should I do if my program doesn't compile?"
+# - Remember, the more specific your question, the better I can assist you!"""
+
+# # Load the MiniCPM-Llama3-V-2_5 model
+# # model = AutoModel.from_pretrained("openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True, device_map='auto')
+# # model.eval()
+
+# # tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)
+
+# def build_app():
+# # Session and agent states
+# session_state = gr.State({"logged_in": False, "session_id": None})
+# agent_state = gr.State(None)
+# run_id = gr.State(None)
+
+# with gr.Blocks() as demo:
+# gr.HTML("""
🤖: ECE120 AI-TA
""")
+
+# # Define both interfaces at the top level
+# login_interface = gr.Group(visible=lambda: not session_state.value["logged_in"])
+# assistant_interface = gr.Group(visible=lambda: session_state.value["logged_in"])
+
+# # Login Interface
+# with login_interface:
+# gr.Markdown("## Please Log In or Register")
+# username = gr.Textbox(label="Username", placeholder="Enter your username")
+# password = gr.Textbox(label="Password", type="password", placeholder="Enter your password")
+# login_btn = gr.Button("Login")
+# register_btn = gr.Button("Register")
+# login_output = gr.Textbox(label="Status", interactive=False)
+
+# # Login function
+# def login(username_input, password_input):
+# session_id_value = authenticate_user(username_input, password_input)
+# if session_id_value:
+# session_state.value["logged_in"] = True
+# session_state.value["session_id"] = session_id_value
+# # Initialize the agent when the user logs in
+# agent_state.value = get_rag_agent()
+# return "Login successful!", gr.update(visible=False), gr.update(visible=True)
+# else:
+# return "Login failed. Please try again.", gr.update(), gr.update()
+
+# # Register function
+# def register(username_input, password_input):
+# message = register_user(username_input, password_input)
+# return message
+
+# login_btn.click(
+# login,
+# inputs=[username, password],
+# outputs=[login_output, login_interface, assistant_interface]
+# )
+# register_btn.click(register, inputs=[username, password], outputs=[login_output])
+
+# # Assistant Interface
+# with assistant_interface:
+# with gr.Row():
+# with gr.Column(scale=3):
+# initial_prompt = get_initial_prompt()
+# chatbot = gr.Chatbot(value=[("AI Teaching Assistant", initial_prompt)], height=600, min_width=300, bubble_full_width=False)
+# with gr.Row():
+# msg = gr.Textbox(placeholder="Insert question here...", scale=4)
+# image_input = gr.Image(type="pil", label="Upload Image (optional)", scale=1)
+
+# starter_code = """#include \nint main() \n{\n printf("Hello World");\n return 0;\n}"""
+# code_editor = gr.TextArea(value=starter_code, label="C Code Editor", lines=10)
+# compile_button = gr.Button("Compile")
+# code_output = gr.TextArea(placeholder="Output will appear here...", label="Compiler Output", lines=10)
+# clear = gr.ClearButton([msg, chatbot, code_editor, code_output])
+# with gr.Row():
+# feedback_text = gr.Textbox(label="Feedback (optional)")
+# feedback_score = gr.Slider(minimum=0, maximum=1, step=0.1, label="Score")
+# submit_feedback = gr.Button("Submit Feedback")
+# logout_btn = gr.Button("Logout")
+
+# # Define the respond function
+# # def respond(message, chat_history, image, request: gr.Request):
+# # try:
+# # if not session_state.value["logged_in"]:
+# # return "Please log in to continue.", chat_history, None
+
+# # full_context = " ".join([f"User: {msg} AI: {resp}" for msg, resp in chat_history])
+# # full_context += f" User: {message}"
+
+# # # Use get_resp instead of agent_state.value.invoke
+# # bot_message = get_resp(full_context)
+
+# # chat_history.append((message, f"🤖: {bot_message}"))
+# # except Exception as e:
+# # exc_type, exc_value, exc_traceback = sys.exc_info()
+# # error_details = traceback.extract_tb(exc_traceback)
+# # error_message = f"An error occurred:\n"
+# # error_message += f"Type: {exc_type.__name__}\n"
+# # error_message += f"Message: {str(e)}\n"
+# # error_message += "Traceback:\n"
+# # for frame in error_details:
+# # error_message += f" File '{frame.filename}', line {frame.lineno}, in {frame.name}\n"
+# # error_message += f" {frame.line}\n"
+
+# # print(error_message) # Print to console for debugging
+# # chat_history.append((message, f"🤖: I'm sorry, but an error occurred. Details:\n{error_message}"))
+
+# # return "", chat_history, None # Reset the image input
+
+# # msg.submit(respond, inputs=[msg, chatbot, image_input], outputs=[msg, chatbot, image_input])
+
+# agent= gr.State()
+# session_id = gr.State()
+# demo.load(get_rag_agent, [], [agent])
+
+# demo.load(lambda: [str(uuid.uuid4())], [], [session_id])
+# # Ensure the chatbot is initialized with the initial prompt
+# demo.load(lambda: [("Hello!", initial_prompt)], [], [chatbot])
+# compile_button.click(compile_c_code, inputs=[code_editor], outputs=[code_output])
+
+# def respond(message, chat_history, image, agent, session_id, request: gr.Request):
+# full_context = " ".join([f"User: {msg} AI: {resp}" for msg, resp in chat_history])
+# full_context += f" User: {message}"
+
+# # if image is not None:
+# # # Only process the image if it's provided
+# # image_description = process_image_query(model, tokenizer, image, message)
+# # full_context += f" [Image description: {image_description}]"
+
+# stdout_handler = StdOutCallbackHandler()
+# run_id_handler = RunIDCallbackHandler()
+
+# ret = agent.invoke({"input": full_context},
+# config={"callbacks": [stdout_handler, run_id_handler]})
+
+# bot_message = ret["output"]
+# run_id = run_id_handler.run_id
+# print(f"run_id: {run_id}")
+# chat_history.append((message, f"🤖: {bot_message}"))
+# client_ip = request.client.host
+# return "", chat_history, None, agent, run_id # Reset the image input
+
+# msg.submit(respond, [msg, chatbot, image_input, agent, session_id],
+# [msg, chatbot, image_input, agent, run_id])
+
+# # Compile function
+# def compile_code(code):
+# try:
+# result = compile_c_code(code)
+# return result
+# except Exception as e:
+# return f"Compilation error: {str(e)}"
+
+# compile_button.click(compile_code, inputs=[code_editor], outputs=[code_output])
+
+# # Feedback function
+# def submit_feedback_fn(feedback_text_value, feedback_score_value, run_id_value):
+# if run_id_value:
+# client.create_feedback(
+# run_id=run_id_value,
+# key="user_feedback",
+# score=feedback_score_value,
+# comment=feedback_text_value
+# )
+# return "Feedback submitted successfully!"
+# return "No conversation to provide feedback on."
+
+# submit_feedback.click(
+# submit_feedback_fn,
+# inputs=[feedback_text, feedback_score, run_id],
+# outputs=gr.Textbox(label="Feedback Status")
+# )
+
+# # Logout function
+# def logout():
+# session_state.value["logged_in"] = False
+# session_state.value["session_id"] = None
+# agent_state.value = None # Clear the agent_state
+# return gr.update(visible=True), gr.update(visible=False)
+
+# logout_btn.click(logout, outputs=[login_interface, assistant_interface])
+
+# # Control interface visibility
+# def show_interface():
+# if session_state.value["logged_in"]:
+# return gr.update(visible=False), gr.update(visible=True)
+# else:
+# return gr.update(visible=True), gr.update(visible=False)
+
+# demo.load(show_interface, outputs=[login_interface, assistant_interface])
+
+# return demo
+
+import gradio as gr
+from rag_agent import get_rag_agent, system_message
+import logging
+import uuid
+import os
+from jdoodle import compile_c_code
+from transformers import AutoModel, AutoTokenizer
+import torch
+from langsmith import Client
+from langchain.callbacks import StdOutCallbackHandler
+from langchain_core.callbacks import BaseCallbackHandler
+from langchain_core.language_models import BaseLanguageModel
+from langchain.tools import BaseTool
+from typing import List, Dict, Any
+from langchain_openai import AzureChatOpenAI
+from langchain.schema import HumanMessage
+import base64
+import io
+from db import authenticate_user, register_user, log_chat, get_chat_history, get_user_by_session
+
+class RunIDCallbackHandler(BaseCallbackHandler):
+ def __init__(self):
+ self.run_id = None
+ def on_chain_start(self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) -> None:
+ self.run_id = kwargs.get("run_id")
+
+# os.environ["LANGCHAIN_API_KEY"] = "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"
+# os.environ["LANGCHAIN_TRACING_V2"] = "true"
+# os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
+# os.environ["LANGCHAIN_PROJECT"] = "langsmith-tutorial"
+
+# LANGCHAIN_TRACING_V2="true"
+# LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
+# LANGCHAIN_API_KEY="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"
+# LANGCHAIN_PROJECT="pr-extraneous-shopper-77"
+
+API_KEY = 'a3babad21aee482798891f0e56f538f4' #gpt4o
+ENDPOINT = 'https://invite-instance-openai.openai.azure.com/'
+os.environ["AZURE_OPENAI_ENDPOINT"] = ENDPOINT
+os.environ["AZURE_OPENAI_API_KEY"] = API_KEY
+
+client = Client()
+
+def get_initial_prompt():
+ return """🤖: Hello!
+I am an AI Teaching Assistant built to answer all your questions on ECE120.
+- You can ask about ECE120, any assignment, and even general concepts such as assembly.
+- You can ask about specific concepts such as "What is a logic gate?"
+- Seek clarification on course material: "Can you explain the concept of state diagrams with an example?"
+- Inquire about assignment instructions: "What should I do if my program doesn't compile?"
+- Remember, the more specific your question, the better I can assist you!"""
+
+# Load the MiniCPM-Llama3-V-2_5 model
+
+# model = AutoModel.from_pretrained("openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True, device_map='cpu')
+# model.eval()
+# tokenizer = AutoTokenizer.from_pretrained("openbmb/MiniCPM-Llama3-V-2_5", trust_remote_code=True)
+
+def build_app():
+ # Session and agent states
+ session_state = gr.State({"logged_in": False, "session_id": None})
+ agent_state = gr.State(None)
+ run_id = gr.State(None)
+
+ with gr.Blocks() as demo:
+ gr.HTML("""🤖: ECE120 AI-TA
""")
+
+ login_interface = gr.Group(visible=lambda: not session_state.value["logged_in"])
+ assistant_interface = gr.Group(visible=lambda: session_state.value["logged_in"])
+
+ # Login Interface
+ with gr.Group(visible=lambda: not session_state.value["logged_in"]) as login_interface:
+ gr.Markdown("## Please Log In or Register")
+
+ username = gr.Textbox(label="Username", placeholder="Enter your username")
+ password = gr.Textbox(label="Password", type="password", placeholder="Enter your password")
+ login_btn = gr.Button("Login")
+ register_btn = gr.Button("Register")
+ login_output = gr.Textbox(label="Status", interactive=False)
+
+ # Login function
+ def login(username_input, password_input):
+ session_id_value = authenticate_user(username_input, password_input)
+ if session_id_value:
+ session_state.value["logged_in"] = True
+ session_state.value["session_id"] = session_id_value
+ # Initialize the agent when the user logs in
+ agent_state.value = get_rag_agent()
+ return "Login successful!", gr.update(visible=False), gr.update(visible=True)
+ else:
+ return "Login failed. Please try again.", gr.update(), gr.update()
+
+ # Register function
+ def register(username_input, password_input):
+ message = register_user(username_input, password_input)
+ return message
+
+ login_btn.click(
+ login,
+ inputs=[username, password],
+ outputs=[login_output, login_interface, assistant_interface]
+ )
+ register_btn.click(register, inputs=[username, password], outputs=[login_output])
+
+ with assistant_interface:
+ with gr.Row():
+ with gr.Column(scale=3):
+ initial_prompt = get_initial_prompt()
+ chatbot = gr.Chatbot(value=[("Hello!", initial_prompt)], height=600, min_width=300, bubble_full_width=False)
+ with gr.Row():
+ msg = gr.Textbox(placeholder="Insert question here...", scale=4)
+ image_input = gr.Image(type="pil", label="Upload Image (optional)", scale=1)
+
+ # Define the starter code
+ starter_code = """
+#include
+int main()
+{
+ printf("Hello World");
+ return 0;
+}"""
+ # Initialize the code editor with the starter code
+ code_editor = gr.TextArea(value=starter_code, label="C Code Editor", lines=10)
+ compile_button = gr.Button("Compile")
+ code_output = gr.TextArea(placeholder="Output will appear here...", label="Compiler Output", lines=10)
+ clear = gr.ClearButton([msg, chatbot, code_editor, code_output])
+ with gr.Row():
+ feedback_text = gr.Textbox(label="Feedback (optional)")
+ feedback_score = gr.Slider(minimum=0, maximum=1, step=0.1, label="Score")
+ submit_feedback = gr.Button("Submit Feedback")
+
+ # Add logout button
+ logout_btn = gr.Button("Logout")
+
+ # Define the submit_feedback function
+ def submit_feedback_fn(feedback_text_value, feedback_score_value, run_id_value):
+ print(f"Debug - Feedback function received run_id: {run_id_value}")
+ if run_id_value:
+ client.create_feedback(
+ run_id=run_id_value,
+ key="user_feedback",
+ score=feedback_score_value,
+ comment=feedback_text_value
+ )
+ return "Feedback submitted successfully!"
+ return "No conversation to provide feedback on."
+ submit_feedback.click(
+ submit_feedback_fn,
+ inputs=[feedback_text, feedback_score, run_id],
+ outputs=gr.Textbox(label="Feedback Status")
+ )
+
+ def respond(message, chat_history, image, request: gr.Request):
+ if not session_state.value["logged_in"]:
+ return "Please log in to continue.", chat_history, None, None
+
+ full_context = " ".join([f"User: {msg} AI: {resp}" for msg, resp in chat_history])
+ full_context += f" User: {message}"
+
+ llm = AzureChatOpenAI(
+ azure_deployment="gpt4-o", # or your deployment
+ api_version="2024-02-15-preview", # or your api version
+ temperature=0,
+ max_tokens=None,
+ timeout=None,
+ max_retries=2,
+ # other params...
+ )
+
+ if image is not None:
+ # Convert the PIL image to base64
+ buffered = io.BytesIO()
+ image.save(buffered, format="PNG")
+ image_data = base64.b64encode(buffered.getvalue()).decode("utf-8")
+
+ # Prepare the message with both text and image
+ human_message = HumanMessage(
+ content=[
+ {"type": "text", "text": full_context},
+ {
+ "type": "image_url",
+ "image_url": {"url": f"data:image/png;base64,{image_data}"},
+ },
+ ],
+ )
+
+ # Get response from Azure OpenAI
+ response = llm.invoke([human_message, system_message])
+ bot_message = response.content
+ else:
+ # Use the existing agent for text-only queries
+ if agent_state.value is None:
+ agent_state.value = get_rag_agent()
+
+ stdout_handler = StdOutCallbackHandler()
+ run_id_handler = RunIDCallbackHandler()
+ ret = agent_state.value.invoke(
+ {
+ "input": full_context,
+ },
+ config={
+ "callbacks": [stdout_handler, run_id_handler]
+ }
+ )
+ bot_message = ret["output"]
+ run_id.value = run_id_handler.run_id
+
+ print(f"run_id: {run_id.value}")
+
+ chat_history.append((message, f"🤖: {bot_message}"))
+ client_ip = request.client.host
+
+ # Log the message and response
+ user_id = get_user_by_session(session_state.value["session_id"])
+ log_chat(user_id, session_state.value["session_id"], message, bot_message)
+ return "", chat_history, None, None # Reset the image input
+
+ # Define the respond function
+# def respond(message, chat_history, image, request: gr.Request):
+# if not session_state.value["logged_in"]:
+# return "Please log in to continue.", chat_history, None, None
+# if agent_state.value is None:
+# agent_state.value = get_rag_agent()
+# full_context = " ".join([f"User: {msg} AI: {resp}" for msg, resp in chat_history])
+# full_context += f" User: {message}"
+
+# if image is not None:
+# # Only process the image if it's provided
+# full_context += f" [Image description: {}"
+
+# stdout_handler = StdOutCallbackHandler()
+# run_id_handler = RunIDCallbackHandler()
+# ret = agent_state.value.invoke(
+# {
+# "input": full_context,
+# },
+# config={
+# "callbacks": [stdout_handler, run_id_handler]
+# }
+# )
+# bot_message = ret["output"]
+# run_id.value = run_id_handler.run_id
+
+# print(f"run_id: {run_id.value}")
+
+# chat_history.append((message, f"🤖: {bot_message}"))
+# client_ip = request.client.host
+
+# # Log the message and response
+# user_id = get_user_by_session(session_state.value["session_id"])
+# log_chat(user_id, session_state.value["session_id"], message, bot_message)
+# return "", chat_history, None, None # Reset the image input
+
+ msg.submit(respond, inputs=[msg, chatbot, image_input], outputs=[msg, chatbot, image_input])
+ compile_button.click(compile_c_code, inputs=[code_editor], outputs=[code_output])
+
+ # Logout function
+ def logout():
+ session_state.value["logged_in"] = False
+ session_state.value["session_id"] = None
+ agent_state.value = None # Clear the agent_state
+ return gr.update(visible=True), gr.update(visible=False)
+ logout_btn.click(logout, outputs=[login_interface, assistant_interface])
+ # Control interface visibility
+ def show_interface():
+ if session_state.value["logged_in"]:
+ return gr.update(visible=False), gr.update(visible=True)
+ else:
+ return gr.update(visible=True), gr.update(visible=False)
+ demo.load(show_interface, outputs=[login_interface, assistant_interface])
+ return demo
\ No newline at end of file
diff --git a/image.jpg b/image.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..eb7cf95c1e377f150f35ec89f97eda7c0864fa50
Binary files /dev/null and b/image.jpg differ
diff --git a/jdoodle.py b/jdoodle.py
new file mode 100644
index 0000000000000000000000000000000000000000..b9fba64c11a15e5e6be0051a0413e327ba8308d7
--- /dev/null
+++ b/jdoodle.py
@@ -0,0 +1,25 @@
+import requests
+
+def compile_c_code(code):
+ clientId = 'af116396f4cab55164b10ac0aa7bd424' # JDoodle clientId
+ clientSecret = '72e373a4e4d6547eda8054627144f0217a58c4afc1c3c193d73d8f41023eeea6' # JDoodle clientSecret
+ script = code
+ language = "c"
+ versionIndex = "0" # Change if you use a different version
+
+ data = {
+ "clientId": clientId,
+ "clientSecret": clientSecret,
+ "script": script,
+ "language": language,
+ "versionIndex": versionIndex
+ }
+
+ response = requests.post("https://api.jdoodle.com/v1/execute", json=data)
+ result = response.json()
+
+ # Extracting output from result
+ output = result.get("output", "No output")
+ statusCode = result.get("statusCode", "No status code")
+
+ return f"Status Code: {statusCode}\n{output}"
diff --git a/kc-tool.ipynb b/kc-tool.ipynb
new file mode 100644
index 0000000000000000000000000000000000000000..3f632c22c5ffba605c63487115526486d35c580d
--- /dev/null
+++ b/kc-tool.ipynb
@@ -0,0 +1,82 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Chroma DB is stored in: /Users/nittinmurthi/Documents/VS_Code/120-AI-TA/kc-retriever\n",
+ "Directory exists: True\n",
+ "Contents of the directory: ['8eef439e-cf2c-4d12-937d-5366c39ffecd', 'chroma.sqlite3']\n"
+ ]
+ }
+ ],
+ "source": [
+ "import os\n",
+ "from langchain.vectorstores import Chroma\n",
+ "from langchain.schema import Document\n",
+ "from langchain_community.embeddings import OllamaEmbeddings\n",
+ "\n",
+ "# Assuming you're using OllamaEmbeddings\n",
+ "embedding = OllamaEmbeddings(model=\"nomic-embed-text\")\n",
+ "\n",
+ "kc_texts = [\n",
+ " \"1. Syntax and Structure: Variable declaration and initialization, Function definition and calling, Control structures (if, else, switch, loops), Array manipulation, Pointer usage\",\n",
+ " \"2. Memory Management: Stack vs. heap allocation, Dynamic memory allocation (malloc, free), Memory leaks and dangling pointers\",\n",
+ " \"3. Data Types and Operations: Primitive data types (int, float, char, etc.), Type casting and conversion, Bitwise operations\",\n",
+ " \"4. Input/Output: Standard I/O functions (printf, scanf), File I/O operations\",\n",
+ " \"5. Debugging Techniques: Using print statements for debugging, Debugging tools (gdb, valgrind), Common runtime errors and their causes\",\n",
+ " \"6. Code Organization: Header files and #include directives, Modular programming principles, Code documentation and commenting\"\n",
+ "]\n",
+ "\n",
+ "# Create Document objects from the KC texts\n",
+ "kc_docs = [Document(page_content=text, metadata={\"source\": \"KC\"}) for text in kc_texts]\n",
+ "\n",
+ "# Specify an absolute path for Chroma to store its data\n",
+ "persist_directory = os.path.join(os.getcwd(), \"kc-retriever\")\n",
+ "\n",
+ "# Initialize Chroma vector store with the documents and embeddings, and specify the persist directory\n",
+ "vectorstore_kc = Chroma.from_documents(kc_docs, embedding, persist_directory=persist_directory)\n",
+ "\n",
+ "# Create a retriever from the Chroma vector store\n",
+ "retriever_kc = vectorstore_kc.as_retriever()\n",
+ "\n",
+ "print(f\"Chroma DB is stored in: {persist_directory}\")\n",
+ "print(f\"Directory exists: {os.path.exists(persist_directory)}\")\n",
+ "print(f\"Contents of the directory: {os.listdir(persist_directory)}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "ai-ta-env",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.4"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/rag_agent.py b/rag_agent.py
new file mode 100644
index 0000000000000000000000000000000000000000..7b15d9710359cd397f01a172ab2bc2461bdfe4dc
--- /dev/null
+++ b/rag_agent.py
@@ -0,0 +1,306 @@
+import ollama
+import openai
+import re
+from langchain_openai import AzureOpenAIEmbeddings
+from langchain_chroma import Chroma
+from langchain_ollama.llms import OllamaLLM
+from langchain_community.embeddings import OllamaEmbeddings
+from langchain.agents.agent_toolkits import create_retriever_tool, create_conversational_retrieval_agent
+from langchain.schema.messages import SystemMessage
+from langsmith import Client
+from PIL import Image
+import torch
+import numpy as np
+from transformers import AutoTokenizer
+import traceback
+
+from dotenv import find_dotenv, load_dotenv
+
+from langchain.callbacks import StdOutCallbackHandler
+from langchain_core.callbacks import BaseCallbackHandler
+from langchain_core.language_models import BaseLanguageModel
+from langchain.tools import BaseTool
+from typing import List, Dict, Any
+
+from langchain_openai import AzureOpenAI
+
+from langsmith.wrappers import wrap_openai
+
+import os
+
+import pprint
+
+from langchain_community.utilities import SearxSearchWrapper
+
+API_KEY = 'a3babad21aee482798891f0e56f538f4' #gpt4o
+ENDPOINT = 'https://invite-instance-openai.openai.azure.com/'
+
+os.environ["AZURE_OPENAI_ENDPOINT"] = ENDPOINT
+os.environ["AZURE_OPENAI_API_KEY"] = API_KEY
+
+# import nest_asyncio
+
+# nest_asyncio.apply()
+
+# client = Client(api_key="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", api_url="https://api.smith.langchain.com")
+
+# os.environ["LANGCHAIN_API_KEY"] = "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"
+# os.environ["LANGCHAIN_TRACING_V2"] = "true"
+# os.environ["LANGCHAIN_ENDPOINT"] = "https://api.smith.langchain.com"
+# os.environ["LANGCHAIN_PROJECT"] = "langsmith-tutorial"
+
+#embedding = OllamaEmbeddings(model="nomic-embed-text")
+
+import tiktoken
+
+model_name = "gpt-4"
+
+encoding = tiktoken.encoding_for_model(model_name)
+
+def get_tiktoken_length(text):
+ return len(encoding.encode(text))
+
+
+# Set environment variables
+os.environ["AZURE_OPENAI_API_KEY"] = API_KEY
+os.environ["AZURE_OPENAI_ENDPOINT"] = ENDPOINT
+
+# Initialize the embedding model
+embedding = AzureOpenAIEmbeddings(
+# deployment="your-deployment-name", # Replace with your actual deployment name
+ model="text-embedding-3-large",
+ dimensions=1536,
+# api_version="2024-02-15-preview",
+ chunk_size=512,
+)
+
+db_course_name = Chroma(persist_directory="chroma_db_course_name", embedding_function=embedding)
+
+retriever_course_name = db_course_name.as_retriever()
+
+db_course_overview = Chroma(persist_directory="chroma_db_course_overview", embedding_function=embedding)
+
+retriever_course_overview = db_course_overview.as_retriever()
+
+db_course_notes = Chroma(persist_directory="chroma_db_notes", embedding_function=embedding)
+
+retriever_course_notes = db_course_notes.as_retriever()
+
+db_course_textbook = Chroma(persist_directory="chroma_db_textbook", embedding_function=embedding)
+
+retriever_course_textbook = db_course_textbook.as_retriever()
+
+db_kc = Chroma(persist_directory="chroma_db_kc", embedding_function=embedding)
+
+retriever_kc = db_kc.as_retriever()
+
+db_course_logistics = Chroma(persist_directory="course-logistics-retriever", embedding_function=embedding)
+
+retriever_course_logistics = db_course_logistics.as_retriever()
+
+# search = SearxSearchWrapper(searx_host="http://127.0.0.1:8888", k=5)
+
+tools = [
+ create_retriever_tool(
+ retriever_course_name,
+ "search_course_name",
+ "This includes just the course name.",
+ ),
+ create_retriever_tool(
+ retriever_course_overview,
+ "search_course_overview",
+ "Search for course overview. This includes the course overview and policies.",
+ ),
+ create_retriever_tool(
+ retriever_course_notes,
+ "search_course_notes",
+ "Search for information or answers from the course notes. This includes content and concepts related to the course This should be your primary choice for answering anny course-specific questions.",
+ ),
+ create_retriever_tool(
+ retriever_course_textbook,
+ "search_course_textbook",
+ "Search for information or answers from the course textbook. This includes content related to C programming and should be your first choice to answer any C programing related questions.",
+ ),
+ create_retriever_tool(
+ retriever_kc,
+ "search_knowledge_components",
+ "Search for relevant Knowledge Components (KCs) in C programming. Use this tool to identify specific areas of knowledge that the student might need to focus on for debugging and problem-solving.",
+ ),
+ create_retriever_tool(
+ retriever_course_logistics,
+ "search_course_logistics",
+ "Search for information about course logistics, schedules, policies, and other administrative details from the Canvas course page and related links. Use it to provide exact answers to any questions the student will have regarding the course itself.",
+ ),
+]
+
+# llm = OllamaLLM(model="llama3.1")
+
+# llm = AzureOpenAI(
+# azure_endpoint=ENDPOINT,
+# api_key=API_KEY,
+# api_version="2024-02-15-preview"
+# )
+
+from langchain_openai import AzureChatOpenAI
+
+llm = AzureChatOpenAI(
+ azure_deployment="gpt4-o", # or your deployment
+ api_version="2024-02-15-preview", # or your api version
+ temperature=0,
+ max_tokens=None,
+ timeout=None,
+ max_retries=2,
+ # other params...
+)
+
+# system_message = """You are a ECE 120 AI teaching assistant who provides provides a helpful, and informative hints and answers unless it is a debugging or code question the the student asks and provides specific guidance to the student to learn more about the topic. Never the direct answer to the student when a question about debugging is asked but rather provide hints to guide the students in the right path.
+# You can use the following tools to look up relevant information:
+# - Search for course name. This includes just the course name and often the content and may not be relevant to your question.
+# - Search for course overview. This includes only the course overview and policies and sometimes this may not be relevant to your question.
+# - Search for information or answers from the course notes. If answer found here, return the section of the course notes you found the answer in, else check the textbook.
+# - Search for information or answers from the course textbook. If answer found here, return the section of the textbook you found the answer in.
+# """
+
+message = """You are the no-nonsense AI teaching assistant for ECE 120: Introduction to Computing. Your job is to guide students to answers, not spoon-feed them solutions. Adhere to these rules:
+
+1. NEVER provide direct code solutions or debugging fixes. Instead, offer conceptual explanations and point students to relevant resources.
+
+2. Use a tone that's direct, slightly intimidating and joking, and occasionally sarcastic - like a real ECE TA.
+
+3. Encourage independent thinking. Push students to derive answers themselves.
+
+4. For any question, use these information sources in order:
+ a) Course notes search
+ b) Textbook search
+ c) Course name search
+ d) Course overview search
+ e) Course logistics serarch
+ Always cite the specific section and page number of your source.
+
+5. If a student asks about course policies or logistics, refer them to the course overview.
+
+6. For conceptual questions, provide clear, detailed and helpful explanations with relevant examples from the course material.
+
+7. If a student is struggling, break down the problem into smaller steps and guide them through the thought process.
+
+8. When helping with debugging, follow these steps:
+ a) Identify the relevant Knowledge Components for the problem at hand.
+ b) Ask the student targeted questions about specific KCs to pinpoint their understanding.
+ c) Based on their responses, provide hints and explanations that focus on the relevant KCs.
+ d) Encourage the student to apply the KC-specific knowledge to debug their code.
+
+9. If more information is needed about the student's code, ask specific questions related to the relevant KCs. For example:
+ - "Can you show me the function where you're experiencing the issue?"
+ - "What data types are you using for your variables in this section?"
+ - "Have you checked for proper memory allocation and deallocation?"
+
+10. When providing hints, relate them to specific Knowledge Components:
+ - Syntax and Structure: "Review the syntax for [specific construct]. Are all your brackets and semicolons in the right places?"
+ - Memory Management: "Consider how you're allocating memory for this data structure. Are you freeing all allocated memory?"
+ - Data Types and Operations: "Think about the data types you're using. Are they appropriate for the operations you're performing?"
+ - Input/Output: "Check your I/O functions. Are you handling all possible input cases?"
+ - Debugging Techniques: "Try adding print statements before and after this section to track variable values."
+ - Code Organization: "Consider breaking this function into smaller, more manageable parts."
+
+11. Foster metacognitive skills by asking students to reflect on their problem-solving process:
+ - "What debugging steps have you taken so far?"
+ - "How did you approach solving this problem initially?"
+ - "What resources have you consulted before asking for help?"
+
+12. Adjust the level of hints based on the student's demonstrated understanding of relevant KCs:
+ - For beginners: Provide more detailed explanations and step-by-step guidance.
+ - For intermediate learners: Offer more targeted hints and encourage independent problem-solving.
+ - For advanced students: Challenge them with thought-provoking questions and minimal hints.
+
+13. When debugging or problem-solving, use the Knowledge Components Search tool to identify relevant areas of C programming knowledge. This tool will help you provide more targeted assistance based on the specific concepts involved in the student's question or issue.
+
+14. After using the Knowledge Components Search tool, incorporate the retrieved information into your response. Explain how the identified knowledge components relate to the student's problem and guide them towards applying this knowledge.
+
+Remember, your goal is to make students think, not to make their lives easier. Now go forth and toughen up these future engineers!
+"""
+
+# #Example:
+# User: Implement the function int isPrime(int n) in C.
+# AI: Start by defining the function signature in C. The function signature would look like this: int isPrime(int n) { ... }.
+# In the course notes for ECE 120, you can refer to the following sections to learn more about C programming:
+
+# Chapter 1.5: Programming Concepts and the C Language - This section introduces the C programming language and explains basic concepts in computer programming. It covers topics such as variables, operators, functions, statements, and program execution. (Page 23-30)
+# You can also refer to the textbook "Introduction to Computing Systems: From Bits and Gates to C and Beyond" by Yale N. Patt and Sanjay J. Patel. Here are some relevant sections from the textbook:
+
+# Chapter 11: Introduction to C/C++ Programming - This chapter introduces fundamental high-level programming constructs in C and C++. It covers variables, control structures, functions, arrays, pointers, recursion, and simple data structures. It also provides a problem-solving methodology for programming. (Page 406-450)
+# """
+
+system_message = SystemMessage(content=message)
+
+# def process_image_query(model, tokenizer, image, query):
+# # Convert image to RGB
+# image = image.convert('RGB')
+
+# # Prepare the message context
+# msgs = [{"role": "user", "content": query}]
+
+# # Set default parameters
+# params = {
+# 'sampling': True,
+# 'top_p': 0.8,
+# 'top_k': 100,
+# 'temperature': 0.7,
+# 'repetition_penalty': 1.05,
+# 'max_new_tokens': 896
+# }
+
+# ERROR_MSG = "Error, please retry"
+
+# # Generate the response
+# try:
+# answer = model.chat(
+# image=image,
+# msgs=msgs,
+# tokenizer=tokenizer,
+# **params
+# )
+
+# # Clean up the response
+# res = re.sub(r'(.*)', '', answer)
+# res = res.replace('', '')
+# res = res.replace('', '')
+# res = res.replace('', '')
+# answer = res.replace('', '')
+
+# return answer
+
+# except Exception as err:
+# print(err)
+# traceback.print_exc()
+# return ERROR_MSG
+
+def get_rag_agent():
+ class RunIDCallbackHandler(BaseCallbackHandler):
+ def __init__(self):
+ self.run_id = None
+
+ def on_chain_start(self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) -> None:
+ self.run_id = kwargs.get("run_id")
+
+ # Create callback handlers
+ stdout_handler = StdOutCallbackHandler()
+ run_id_handler = RunIDCallbackHandler()
+
+ model_name = "gpt-4"
+ encoding = tiktoken.encoding_for_model(model_name)
+
+ def get_tiktoken_length(text):
+ return len(encoding.encode(text))
+
+ llm.model_name = "gpt-4o"
+
+ agent = create_conversational_retrieval_agent(
+ llm,
+ tools,
+ system_message=system_message,
+ remember_intermediate_steps=True,
+ verbose=True,
+ callback_manager=None,
+ )
+
+ return agent
\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..29e27c6c1d7f4b2995854d1bbeb61916a9682c7d
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,164 @@
+accelerate==0.34.2
+aiofiles==23.2.1
+aiohappyeyeballs==2.4.1
+aiohttp==3.10.6
+aiosignal==1.3.1
+annotated-types==0.7.0
+anyio==4.6.0
+appnope==0.1.4
+asgiref==3.8.1
+asttokens==2.4.1
+attrs==24.2.0
+backoff==2.2.1
+bcrypt==4.2.0
+build==1.2.2
+cachetools==5.5.0
+certifi==2024.8.30
+charset-normalizer==3.3.2
+chroma-hnswlib==0.7.6
+chromadb==0.5.11
+click==8.1.7
+coloredlogs==15.0.1
+comm==0.2.2
+contourpy==1.3.0
+cycler==0.12.1
+dataclasses-json==0.6.7
+debugpy==1.8.6
+decorator==5.1.1
+Deprecated==1.2.14
+durationpy==0.7
+executing==2.1.0
+fastapi==0.115.0
+ffmpy==0.4.0
+filelock==3.16.1
+flatbuffers==24.3.25
+fonttools==4.54.1
+frozenlist==1.4.1
+fsspec==2024.9.0
+google-auth==2.35.0
+googleapis-common-protos==1.65.0
+gradio==4.44.0
+gradio_client==1.3.0
+grpcio==1.66.1
+h11==0.14.0
+httpcore==1.0.5
+httptools==0.6.1
+httpx==0.27.2
+huggingface-hub==0.25.1
+humanfriendly==10.0
+idna==3.10
+importlib_metadata==8.4.0
+importlib_resources==6.4.5
+ipykernel==6.29.5
+ipython==8.27.0
+jedi==0.19.1
+Jinja2==3.1.4
+jsonpatch==1.33
+jsonpointer==3.0.0
+jupyter_client==8.6.3
+jupyter_core==5.7.2
+kiwisolver==1.4.7
+kubernetes==31.0.0
+langchain==0.3.1
+langchain-chroma==0.1.4
+langchain-community==0.3.1
+langchain-core==0.3.6
+langchain-ollama==0.2.0
+langchain-text-splitters==0.3.0
+langsmith==0.1.129
+markdown-it-py==3.0.0
+MarkupSafe==2.1.5
+marshmallow==3.22.0
+matplotlib==3.9.2
+matplotlib-inline==0.1.7
+mdurl==0.1.2
+mmh3==5.0.1
+monotonic==1.6
+mpmath==1.3.0
+multidict==6.1.0
+mypy-extensions==1.0.0
+nest-asyncio==1.6.0
+networkx==3.3
+numpy==1.26.4
+oauthlib==3.2.2
+ollama==0.3.3
+onnxruntime==1.19.2
+opentelemetry-api==1.27.0
+opentelemetry-exporter-otlp-proto-common==1.27.0
+opentelemetry-exporter-otlp-proto-grpc==1.27.0
+opentelemetry-instrumentation==0.48b0
+opentelemetry-instrumentation-asgi==0.48b0
+opentelemetry-instrumentation-fastapi==0.48b0
+opentelemetry-proto==1.27.0
+opentelemetry-sdk==1.27.0
+opentelemetry-semantic-conventions==0.48b0
+opentelemetry-util-http==0.48b0
+orjson==3.10.7
+overrides==7.7.0
+packaging==24.1
+pandas==2.2.3
+parso==0.8.4
+pexpect==4.9.0
+pillow==10.4.0
+platformdirs==4.3.6
+posthog==3.6.6
+prompt_toolkit==3.0.48
+protobuf==4.25.5
+psutil==6.0.0
+ptyprocess==0.7.0
+pure_eval==0.2.3
+pyasn1==0.6.1
+pyasn1_modules==0.4.1
+pydantic==2.9.2
+pydantic-settings==2.5.2
+pydantic_core==2.23.4
+pydub==0.25.1
+Pygments==2.18.0
+pyparsing==3.1.4
+PyPika==0.48.9
+pyproject_hooks==1.1.0
+python-dateutil==2.9.0.post0
+python-dotenv==1.0.1
+python-multipart==0.0.10
+pytz==2024.2
+PyYAML==6.0.2
+pyzmq==26.2.0
+regex==2024.9.11
+requests==2.32.3
+requests-oauthlib==2.0.0
+rich==13.8.1
+rsa==4.9
+ruff==0.6.8
+safetensors==0.4.5
+semantic-version==2.10.0
+setuptools==75.1.0
+shellingham==1.5.4
+six==1.16.0
+sniffio==1.3.1
+SQLAlchemy==2.0.35
+stack-data==0.6.3
+starlette==0.38.6
+sympy==1.13.3
+tenacity==8.5.0
+tokenizers==0.20.0
+tomlkit==0.12.0
+torch==2.4.1
+torchvision==0.19.1
+tornado==6.4.1
+tqdm==4.66.5
+traitlets==5.14.3
+transformers==4.45.1
+typer==0.12.5
+typing-inspect==0.9.0
+typing_extensions==4.12.2
+tzdata==2024.2
+urllib3==2.2.3
+uvicorn==0.30.6
+uvloop==0.20.0
+watchfiles==0.24.0
+wcwidth==0.2.13
+websocket-client==1.8.0
+websockets==12.0
+wrapt==1.16.0
+yarl==1.12.1
+zipp==3.20.2
diff --git a/test-openai.ipynb b/test-openai.ipynb
new file mode 100644
index 0000000000000000000000000000000000000000..8377fa9d9555866e55f6313e8aba9c96c35dc73f
--- /dev/null
+++ b/test-openai.ipynb
@@ -0,0 +1,1098 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "1.51.2\n"
+ ]
+ }
+ ],
+ "source": [
+ "import openai\n",
+ "\n",
+ "print(openai.__version__)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/Users/nittinmurthi/Documents/VS_Code/120-AI-TA/ai-ta-env/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
+ " from .autonotebook import tqdm as notebook_tqdm\n"
+ ]
+ }
+ ],
+ "source": [
+ "import ollama\n",
+ "import re\n",
+ "from langchain_chroma import Chroma\n",
+ "from langchain_ollama.llms import OllamaLLM\n",
+ "from langchain_community.embeddings import OllamaEmbeddings\n",
+ "from langchain.agents.agent_toolkits import create_retriever_tool, create_conversational_retrieval_agent\n",
+ "from langchain.schema.messages import SystemMessage\n",
+ "from langsmith import Client\n",
+ "from PIL import Image\n",
+ "import torch\n",
+ "import numpy as np\n",
+ "from transformers import AutoTokenizer\n",
+ "import traceback\n",
+ "\n",
+ "from dotenv import find_dotenv, load_dotenv\n",
+ "\n",
+ "from langchain.callbacks import StdOutCallbackHandler\n",
+ "from langchain_core.callbacks import BaseCallbackHandler\n",
+ "from langchain_core.language_models import BaseLanguageModel\n",
+ "from langchain.tools import BaseTool\n",
+ "from typing import List, Dict, Any"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "AzureOpenAI"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "from openai import AzureOpenAI\n",
+ "\n",
+ "def get_resp(question):\n",
+ "\n",
+ " response = client.chat.completions.create(model=\"gpt4-o\", messages=[\n",
+ " {\n",
+ " \"role\": \"user\",\n",
+ " \"content\": [\n",
+ " {\"type\": \"text\", \"text\": question},\n",
+ " ],\n",
+ " }\n",
+ " ],\n",
+ " max_tokens=600,\n",
+ " )\n",
+ " return response.choices[0].message.content\n",
+ "\n",
+ "\n",
+ "API_KEY = 'a3babad21aee482798891f0e56f538f4' #gpt4o\n",
+ "ENDPOINT = 'https://invite-instance-openai.openai.azure.com/'\n",
+ "\n",
+ "client = AzureOpenAI(\n",
+ " azure_endpoint=ENDPOINT,\n",
+ " api_key=API_KEY,\n",
+ " api_version=\"2024-02-15-preview\"\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Hi there! How can I assist you today?\n"
+ ]
+ }
+ ],
+ "source": [
+ "response= get_resp(\"Hello\")\n",
+ "\n",
+ "print(response)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "os.environ[\"AZURE_OPENAI_ENDPOINT\"] = ENDPOINT\n",
+ "os.environ[\"AZURE_OPENAI_API_KEY\"] = API_KEY"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "AzureChatOpenAI"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from langchain_openai import AzureChatOpenAI\n",
+ "\n",
+ "llm = AzureChatOpenAI(\n",
+ " azure_deployment=\"gpt4-o\", # or your deployment\n",
+ " api_version=\"2024-02-15-preview\", # or your api version\n",
+ " temperature=0,\n",
+ " max_tokens=None,\n",
+ " timeout=None,\n",
+ " max_retries=2,\n",
+ " # other params...\n",
+ ")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "AIMessage(content=\"J'adore la programmation.\", additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 5, 'prompt_tokens': 31, 'total_tokens': 36, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_67802d9a6d', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {}}], 'finish_reason': 'stop', 'logprobs': None, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}, id='run-e039f13f-86ae-4ce1-b1e0-aaca20acaece-0', usage_metadata={'input_tokens': 31, 'output_tokens': 5, 'total_tokens': 36, 'input_token_details': {}, 'output_token_details': {}})"
+ ]
+ },
+ "execution_count": 9,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "messages = [\n",
+ " (\n",
+ " \"system\",\n",
+ " \"You are a helpful assistant that translates English to French. Translate the user sentence.\",\n",
+ " ),\n",
+ " (\"human\", \"I love programming.\"),\n",
+ "]\n",
+ "ai_msg = llm.invoke(messages)\n",
+ "ai_msg"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "J'adore la programmation.\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(ai_msg.content)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 15,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "from langchain.agents.agent_toolkits import create_retriever_tool, create_conversational_retrieval_agent\n",
+ "from langchain.tools import BaseTool\n",
+ "from langchain.schema.messages import SystemMessage\n",
+ "\n",
+ "system_message = \"\"\"You are the no-nonsense AI teaching assistant for ECE 120: Introduction to Computing. Your job is to guide students to answers, not spoon-feed them solutions. Adhere to these rules:\n",
+ "\n",
+ "1. NEVER provide direct code solutions or debugging fixes. Instead, offer conceptual explanations and point students to relevant resources.\n",
+ "\n",
+ "2. Use a tone that's direct, slightly intimidating and joking, and occasionally sarcastic - like a real ECE TA.\n",
+ "\n",
+ "3. Encourage independent thinking. Push students to derive answers themselves.\n",
+ "\n",
+ "4. For any question, use these information sources in order:\n",
+ " a) Course notes search\n",
+ " b) Textbook search\n",
+ " c) Course name search\n",
+ " d) Course overview search\n",
+ " e) Course logistics serarch\n",
+ " Always cite the specific section and page number of your source.\n",
+ "\n",
+ "5. If a student asks about course policies or logistics, refer them to the course overview.\n",
+ "\n",
+ "6. For conceptual questions, provide clear, detailed and helpful explanations with relevant examples from the course material.\n",
+ "\n",
+ "7. If a student is struggling, break down the problem into smaller steps and guide them through the thought process.\n",
+ "\n",
+ "8. When helping with debugging, follow these steps:\n",
+ " a) Identify the relevant Knowledge Components for the problem at hand.\n",
+ " b) Ask the student targeted questions about specific KCs to pinpoint their understanding.\n",
+ " c) Based on their responses, provide hints and explanations that focus on the relevant KCs.\n",
+ " d) Encourage the student to apply the KC-specific knowledge to debug their code.\n",
+ "\n",
+ "9. If more information is needed about the student's code, ask specific questions related to the relevant KCs. For example:\n",
+ " - \"Can you show me the function where you're experiencing the issue?\"\n",
+ " - \"What data types are you using for your variables in this section?\"\n",
+ " - \"Have you checked for proper memory allocation and deallocation?\"\n",
+ " \n",
+ "10. When providing hints, relate them to specific Knowledge Components:\n",
+ " - Syntax and Structure: \"Review the syntax for [specific construct]. Are all your brackets and semicolons in the right places?\"\n",
+ " - Memory Management: \"Consider how you're allocating memory for this data structure. Are you freeing all allocated memory?\"\n",
+ " - Data Types and Operations: \"Think about the data types you're using. Are they appropriate for the operations you're performing?\"\n",
+ " - Input/Output: \"Check your I/O functions. Are you handling all possible input cases?\"\n",
+ " - Debugging Techniques: \"Try adding print statements before and after this section to track variable values.\"\n",
+ " - Code Organization: \"Consider breaking this function into smaller, more manageable parts.\"\n",
+ "\n",
+ "11. Foster metacognitive skills by asking students to reflect on their problem-solving process:\n",
+ " - \"What debugging steps have you taken so far?\"\n",
+ " - \"How did you approach solving this problem initially?\"\n",
+ " - \"What resources have you consulted before asking for help?\"\n",
+ " \n",
+ "12. Adjust the level of hints based on the student's demonstrated understanding of relevant KCs:\n",
+ " - For beginners: Provide more detailed explanations and step-by-step guidance.\n",
+ " - For intermediate learners: Offer more targeted hints and encourage independent problem-solving.\n",
+ " - For advanced students: Challenge them with thought-provoking questions and minimal hints.\n",
+ "\n",
+ "13. When debugging or problem-solving, use the Knowledge Components Search tool to identify relevant areas of C programming knowledge. This tool will help you provide more targeted assistance based on the specific concepts involved in the student's question or issue.\n",
+ "\n",
+ "14. After using the Knowledge Components Search tool, incorporate the retrieved information into your response. Explain how the identified knowledge components relate to the student's problem and guide them towards applying this knowledge.\n",
+ "\n",
+ "Remember, your goal is to make students think, not to make their lives easier. Now go forth and toughen up these future engineers!\n",
+ "\"\"\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 17,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/var/folders/h3/7zpv9d657qqgj2ssw270yg100000gn/T/ipykernel_58018/4250712414.py:23: LangChainDeprecationWarning: The class `AzureOpenAIEmbeddings` was deprecated in LangChain 0.0.9 and will be removed in 1.0. An updated version of the class exists in the :class:`~langchain-openai package and should be used instead. To use it run `pip install -U :class:`~langchain-openai` and import as `from :class:`~langchain_openai import AzureOpenAIEmbeddings``.\n",
+ " embedding = AzureOpenAIEmbeddings(\n",
+ "/Users/nittinmurthi/Documents/VS_Code/120-AI-TA/ai-ta-env/lib/python3.12/site-packages/langchain_community/embeddings/openai.py:271: UserWarning: WARNING! dimensions is not default parameter.\n",
+ " dimensions was transferred to model_kwargs.\n",
+ " Please confirm that dimensions is what you intended.\n",
+ " warnings.warn(\n"
+ ]
+ },
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Type of embedding: \n",
+ "Shape of embedding: (1536,)\n",
+ "Dimension of embedding: 1536\n",
+ "First 5 values of embedding: [0.00519898782549085, -0.009385648470516627, -0.021263961399115013, -0.007625520928172164, 0.010479368589879032]\n"
+ ]
+ }
+ ],
+ "source": [
+ "#embedding = OllamaEmbeddings(model=\"nomic-embed-text\")\n",
+ "\n",
+ "from langchain_openai import AzureOpenAIEmbeddings\n",
+ "\n",
+ "import tiktoken\n",
+ "\n",
+ "model_name = \"gpt-3.5-turbo-16k\"\n",
+ "\n",
+ "encoding = tiktoken.encoding_for_model(model_name)\n",
+ "\n",
+ "def get_tiktoken_length(text):\n",
+ " return len(encoding.encode(text))\n",
+ "\n",
+ "from langchain.embeddings import AzureOpenAIEmbeddings\n",
+ "import numpy as np\n",
+ "import os\n",
+ "\n",
+ "# Set environment variables\n",
+ "os.environ[\"AZURE_OPENAI_API_KEY\"] = API_KEY\n",
+ "os.environ[\"AZURE_OPENAI_ENDPOINT\"] = ENDPOINT\n",
+ "\n",
+ "# Initialize the embedding model\n",
+ "embedding = AzureOpenAIEmbeddings(\n",
+ "# deployment=\"your-deployment-name\", # Replace with your actual deployment name\n",
+ " model=\"text-embedding-3-large\",\n",
+ " dimensions=1536,\n",
+ "# api_version=\"2024-02-15-preview\",\n",
+ " chunk_size=512,\n",
+ ")\n",
+ "\n",
+ "# Test text\n",
+ "test_text = \"This is a sample text to test the embedding function.\"\n",
+ "\n",
+ "# Generate embedding\n",
+ "result = embedding.embed_query(test_text)\n",
+ "\n",
+ "# Check the type and shape of the result\n",
+ "print(f\"Type of embedding: {type(result)}\")\n",
+ "print(f\"Shape of embedding: {np.array(result).shape}\")\n",
+ "\n",
+ "# Verify the dimension\n",
+ "print(f\"Dimension of embedding: {len(result)}\")\n",
+ "\n",
+ "# Print the first few values of the embedding\n",
+ "print(f\"First 5 values of embedding: {result[:5]}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 18,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n",
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n",
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n",
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n",
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n",
+ "⚠️ It looks like you upgraded from a version below 0.6 and could benefit from vacuuming your database. Run chromadb utils vacuum --help for more information.\n"
+ ]
+ }
+ ],
+ "source": [
+ "db_course_name = Chroma(persist_directory=\"chroma_db_course_name\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_course_name = db_course_name.as_retriever()\n",
+ "\n",
+ "db_course_overview = Chroma(persist_directory=\"chroma_db_course_overview\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_course_overview = db_course_overview.as_retriever()\n",
+ "\n",
+ "db_course_notes = Chroma(persist_directory=\"chroma_db_notes\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_course_notes = db_course_notes.as_retriever()\n",
+ "\n",
+ "db_course_textbook = Chroma(persist_directory=\"chroma_db_textbook\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_course_textbook = db_course_textbook.as_retriever()\n",
+ "\n",
+ "db_kc = Chroma(persist_directory=\"chroma_db_kc\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_kc = db_kc.as_retriever()\n",
+ "\n",
+ "db_course_logistics = Chroma(persist_directory=\"course-logistics-retriever\", embedding_function=embedding)\n",
+ "\n",
+ "retriever_course_logistics = db_course_logistics.as_retriever()\n",
+ "\n",
+ "# search = SearxSearchWrapper(searx_host=\"http://127.0.0.1:8888\", k=5)\n",
+ "\n",
+ "tools = [\n",
+ " create_retriever_tool(\n",
+ " retriever_course_name,\n",
+ " \"search_course_name\",\n",
+ " \"This includes just the course name.\",\n",
+ " ),\n",
+ " create_retriever_tool(\n",
+ " retriever_course_overview,\n",
+ " \"search_course_overview\",\n",
+ " \"Search for course overview. This includes the course overview and policies.\",\n",
+ " ),\n",
+ " create_retriever_tool(\n",
+ " retriever_course_notes,\n",
+ " \"search_course_notes\",\n",
+ " \"Search for information or answers from the course notes. This includes content and concepts related to the course This should be your primary choice for answering anny course-specific questions.\",\n",
+ " ),\n",
+ " create_retriever_tool(\n",
+ " retriever_course_textbook,\n",
+ " \"search_course_textbook\",\n",
+ " \"Search for information or answers from the course textbook. This includes content related to C programming and should be your first choice to answer any C programing related questions.\",\n",
+ " ),\n",
+ " create_retriever_tool(\n",
+ " retriever_kc,\n",
+ " \"search_knowledge_components\",\n",
+ " \"Search for relevant Knowledge Components (KCs) in C programming. Use this tool to identify specific areas of knowledge that the student might need to focus on for debugging and problem-solving.\",\n",
+ " ),\n",
+ " create_retriever_tool(\n",
+ " retriever_course_logistics,\n",
+ " \"search_course_logistics\",\n",
+ " \"Search for information about course logistics, schedules, policies, and other administrative details from the Canvas course page and related links. Use it to provide exact answers to any questions the student will have regarding the course itself.\",\n",
+ " ),\n",
+ "]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 16,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "model_with_tools = llm.bind_tools(tools)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 56,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "ContentString: Hello! How can I assist you today?\n",
+ "ToolCalls: []\n"
+ ]
+ }
+ ],
+ "source": [
+ "from langchain_core.messages import HumanMessage\n",
+ "\n",
+ "response = model_with_tools.invoke([HumanMessage(content=\"Hi!\")])\n",
+ "\n",
+ "print(f\"ContentString: {response.content}\")\n",
+ "print(f\"ToolCalls: {response.tool_calls}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 57,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "model_name = \"gpt-4\"\n",
+ "\n",
+ "encoding = tiktoken.encoding_for_model(model_name)\n",
+ "\n",
+ "\n",
+ "def get_tiktoken_length(text):\n",
+ " return len(encoding.encode(text))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "LLM: client= async_client= root_client= root_async_client= model_name='gpt-4o' temperature=0.0 model_kwargs={} openai_api_key=SecretStr('**********') disabled_params={'parallel_tool_calls': None} azure_endpoint='https://invite-instance-openai.openai.azure.com/' deployment_name='gpt4-o' openai_api_version='2024-02-15-preview' openai_api_type='azure'\n",
+ "LLM model name: gpt-4o\n",
+ "\n",
+ "\n",
+ "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
+ "\u001b[32;1m\u001b[1;3m\n",
+ "Invoking: `search_course_notes` with `{'query': 'state diagrams'}`\n",
+ "\n",
+ "\n",
+ "\u001b[0m\u001b[38;5;200m\u001b[1;3mCONTENTS v\n",
+ "2.7.2 Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74\n",
+ "2.8 Summary of Part 2 of the Course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76\n",
+ "3.1 Serialization and Finite State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\n",
+ "3.1.1 Serialization: General Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\n",
+ "3.1.2 Serialization: Comparator Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80\n",
+ "3.1.3 Finite State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82\n",
+ "3.1.4 Synchronous Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84\n",
+ "3.1.5 Ripple Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86\n",
+ "3.1.6 Timing Issues* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87\n",
+ "3.1.7 Machine Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87\n",
+ "3.2 Finite State Machine Design Examples, Part I . . . . . . . . . . . . . . . . . . . . . . . . . . . 89\n",
+ "\n",
+ "For speed, we make rough estimates in terms of the\n",
+ "amount of time it takes for a CMOS gate to change its\n",
+ "output once its input has changed. This amount of time\n",
+ "is called a gate delay . We can thus estimate our design’sZ1\n",
+ "Z0C0C1a comparator bit slice (first attempt)\n",
+ "A\n",
+ "B\n",
+ "speed by simply counting the maximum number of gates on any path fr om input to output. For this mea-\n",
+ "surement, using a NAND/NOR representation of the design is import ant to getting the right answer, but, as\n",
+ "we have discussed, the diagram above is equivalent on a gate-for-g ate basis. Here we have three gate delays\n",
+ "from the AandBinputs to the outputs (through the inverters). But when we conn ect multiple copies of\n",
+ "our bit slice logic together to form a comparator, as shown on the ne xt page, the delay from the AandB\n",
+ "inputs to the outputs is not as important as the delay from the C1andC0inputs to the outputs. The latter\n",
+ "delay adds to the total delay of our comparatoron a per-bit-slice b asis. Looking again at the diagram, notice\n",
+ "that we have only two gate delays from the C1andC0inputs to the outputs. The total delay for an N-bit\n",
+ "\n",
+ "2.7 Registers 75\n",
+ "The bit slice allows us to build N-bit shift registers by replicating\n",
+ "the slice and adding a fixed amount of “ glue logic .” For example,\n",
+ "the figure below represents a 4-bit bidirectional shift register\n",
+ "constructed in this way. The mux used for the SOoutput logic\n",
+ "is the glue logic needed in addition to the four bit slices. At each\n",
+ "rising clock edge, the action specified by C1C0is taken. When\n",
+ "C1C0= 00, the register holds its current value, with the register\n",
+ "value appearing on Q[3 : 0] and each flip-flop feeding its output\n",
+ "back into its input. For C1C0= 01, the shift register shifts left:\n",
+ "the serial input, SI, is fed into flip-flop 0, and Q3is passed to the\n",
+ "serial output, SO. Similarly, when C1C0= 11, the shift register\n",
+ "shifts right: SIis fed into flip-flop 3, and Q0is passed to SO.\n",
+ "Finally, the case C1C0= 10 causes all flip-flops to accept new\n",
+ "values from IN[3 : 0], effecting a parallel load.ii−1 i+1i\n",
+ "QQ QIN\n",
+ "CLK2C\n",
+ "D3 0 2 1\n",
+ "C1C0 meaning\n",
+ "00 retain current value\n",
+ "01shift left (low to high)\n",
+ "10load new value (from IN)\n",
+ "11shift right (high to low)\n",
+ "0 3 2 1IN3 IN2 IN1 IN0\n",
+ "Q Q Q Qi−1QiIN\n",
+ "1C\n",
+ "0C iQi−1QiIN\n",
+ "1C\n",
+ "0C iQi−1QiIN\n",
+ "1C\n",
+ "0C iQi−1QiIN\n",
+ "1C\n",
+ "0C iQ\n",
+ "bidirectional\n",
+ "shift register bitbidirectional\n",
+ "shift register bitbidirectional\n",
+ "shift register bitbidirectional\n",
+ "shift register bit\n",
+ "SOC1C0\n",
+ "CLKSI\n",
+ "1\n",
+ "0Qi+1Qi+1Qi+1Qi+1\n",
+ "Several specialized shift operations are used to support data man ipulation in modern processors (CPUs).\n",
+ "\n",
+ "The meaning of RTL\n",
+ "is slightly differ-\n",
+ "ent from the usual\n",
+ "interpretation of\n",
+ "high-level program-\n",
+ "ming languages,\n",
+ "however, in terms\n",
+ "of when the actions\n",
+ "happen. A list of\n",
+ "C statements is\n",
+ "generally executed\n",
+ "one at a time. In\n",
+ "contrast, the entire\n",
+ "list of RTL actionsstate actions (simultaneous) condition next state\n",
+ "WAIT IDX←0 (to read VALUES[0] inINIT) START INIT\n",
+ "START WAIT\n",
+ "INIT MIN←VALUES[IDX] (IDXis 0 in this state) (always) PREP\n",
+ "IDX←IDX+ 1\n",
+ "PREP A←MIN (always) COMPARE\n",
+ "B←VALUES[IDX]\n",
+ "CNT←0\n",
+ "COMPARE run serial comparator LAST COPY\n",
+ "LAST COMPARE\n",
+ "COPY THEN:MIN←VALUES[IDX] DONE WAIT\n",
+ "IDX←IDX+ 1 DONE PREP\u001b[0m\u001b[32;1m\u001b[1;3m\n",
+ "Invoking: `search_course_textbook` with `{'query': 'state diagrams'}`\n",
+ "\n",
+ "\n",
+ "\u001b[0m\u001b[36;1m\u001b[1;3m702 appendix C The Microarchitectureof the LC-3\n",
+ "To 18R\n",
+ "RR\n",
+ "To 18R RM[MAR]<−MDR16To 18[BEN]\n",
+ "PC<−PC+off900\n",
+ "122\n",
+ "To 18set CC1\n",
+ "To 18 DR<−SR1&OP2*\n",
+ "set CC\n",
+ "To 18\n",
+ "DR<−NOT(SR)\n",
+ "set CC\n",
+ "DR<−PC+off9BEN<−IR[11] & N + IR[10] & Z + IR[9] & P\n",
+ "[IR[15:12]]\n",
+ "[ACV]JSR\n",
+ "MAR<−MDR\n",
+ "set ACVMAR<−PC+off9JMPBR\n",
+ "set ACV\n",
+ "[ACV]\n",
+ "MAR<−MDR\n",
+ "set ACVMAR<−B+off6\n",
+ "set ACV\n",
+ "3\n",
+ "MAR<−PC+off9\n",
+ "set ACVTo 18PC<−BaseR\n",
+ "1012\n",
+ "4\n",
+ "21To 18\n",
+ "20\n",
+ "To 18[IR[11]]\n",
+ "PC<−PC+off11R7<−PC1101\n",
+ "PC<−BaseRR7<−PC0\n",
+ "1\n",
+ "0[ACV]\n",
+ "RTI1\n",
+ "33\n",
+ "MDR <− M\n",
+ "R28\n",
+ "30\n",
+ "IR <− MDR\n",
+ "32\n",
+ "MAR<−PC+off9\n",
+ "set ACV\n",
+ "DR<−MDR\n",
+ "set CC25\n",
+ "27\n",
+ "To 18MDR<−M[MAR]MAR<−PC+off9\n",
+ "set ACV\n",
+ "[ACV]10\n",
+ "17\n",
+ "R19\n",
+ "MDR<−SR\n",
+ "[ACV]7(See figure C.7)\n",
+ "(See figure C.7)To 8\n",
+ "To 15To 49\n",
+ "(See figure C.7)\n",
+ "0 1\n",
+ "To 480\n",
+ "To 571RMDR<−M[MAR]\n",
+ "RMDR<−M[MAR]To 5601\n",
+ "R 2901\n",
+ "To 615\n",
+ "9\n",
+ "14\n",
+ "2MAR<−B+off6\n",
+ "set ACV11\n",
+ "24\n",
+ "6\n",
+ "26 31\n",
+ "3523AND\n",
+ "DR<−SR1+OP2*To 13\n",
+ "ADD\n",
+ "LEA STR ST[INT]set ACVPC <− PC + 1MAR <− PC\n",
+ "\n",
+ "To 15To 49\n",
+ "(See figure C.7)\n",
+ "0 1\n",
+ "To 480\n",
+ "To 571RMDR<−M[MAR]\n",
+ "RMDR<−M[MAR]To 5601\n",
+ "R 2901\n",
+ "To 615\n",
+ "9\n",
+ "14\n",
+ "2MAR<−B+off6\n",
+ "set ACV11\n",
+ "24\n",
+ "6\n",
+ "26 31\n",
+ "3523AND\n",
+ "DR<−SR1+OP2*To 13\n",
+ "ADD\n",
+ "LEA STR ST[INT]set ACVPC <− PC + 1MAR <− PC\n",
+ "*OP2 may be SR2 or SEXT[imm5]LDRLD LDI STI\n",
+ "NOTTRAP18\n",
+ "NOTES\n",
+ "B+off6 : Base + SEXT[offset6]\n",
+ "PC+off9 : PC + SEXT[offset9]\n",
+ "(Addr=0xFE00)ACV=PC+off11 : PC + SEXT[offset11]\n",
+ "& PSR[15]To 60\n",
+ "Figure C.2 A state machine for the LC-3.\n",
+ "\n",
+ "704 appendix C The Microarchitectureof the LC-3\n",
+ "MEMORYOUTPUT INPUT\n",
+ "DSRDDR KBDR\n",
+ "ADDR. CTL.\n",
+ "LOGICGateMDR\n",
+ "MDR LD.MDR\n",
+ "INMUXMAR LD.MAR\n",
+ "2KBSRMIO.EN\n",
+ "R\n",
+ "MEM.ENR.W MIO.ENSEXT SEXT\n",
+ "SEXT\n",
+ "SEXT[5:0][8:0][10:0]+1GateMARMUX\n",
+ "16\n",
+ "161616\n",
+ "16\n",
+ "1616 1616\n",
+ "161616 16\n",
+ "16ALUBA\n",
+ "GateALU16SR2MUXPC\n",
+ "+\n",
+ "IRZEXT\n",
+ "R\n",
+ "NZP\n",
+ "LOGICSR2\n",
+ "OUTSR1\n",
+ "OUTREG\n",
+ "FILE\n",
+ "[7:0]\n",
+ "2PCMUX\n",
+ "LD.CCGatePC\n",
+ "LD.PC\n",
+ "LD.IRMARMUX\n",
+ "ALUK16\n",
+ "1616163\n",
+ "332\n",
+ "[4:0]\n",
+ "[5]0ADDR1MUX\n",
+ "2ADDR2MUXSR1 SR2LD.REGDR\n",
+ "CONTROL\n",
+ "Figure C.3 The LC-3 data path.\n",
+ "\n",
+ "Index 765\n",
+ "PSR, 657\n",
+ "Saved SSP, 317, 331, 345, 657\n",
+ "Saved USP, 317, 331, 345, 657\n",
+ "SP, 657\n",
+ "SR, 657\n",
+ "SR1, 657\n",
+ "SR2, 657\n",
+ "SSP, 657\n",
+ "trapvect8, 657\n",
+ "USP, 657\n",
+ "instruction pointer. Seeprogram counter (PC)\n",
+ "instruction register (IR), 125, 127, 130, 134\n",
+ "instructions\n",
+ "ADD, 128–129, 132, 151–153, 380, 656, 658\n",
+ "AND, 129, 151–153, 656, 659\n",
+ "in assembly language, 233–236\n",
+ "BR, 133–135, 162–164, 267, 656, 660\n",
+ "control, 128, 133, 135, 149, 161–170,\n",
+ "205–206, 683–684\n",
+ "data movement, 128, 133, 149, 155–161,\n",
+ "683–684\n",
+ "defined, 121, 127, 654\n",
+ "HALT, 137, 314\n",
+ "I/O, 317–318\n",
+ "JMP, 169, 266, 656, 661\n",
+ "JSR, 266–267, 336, 656, 662\n",
+ "JSRR, 267, 656, 662\n",
+ "JSR(R), 266–267\n",
+ "LD, 129, 156–157, 656, 663\n",
+ "LDI, 158, 350–352, 656, 664\n",
+ "LDR, 159–160, 656, 665\n",
+ "LEA, 154–155, 656, 666\n",
+ "NOT, 151, 152, 656, 667\n",
+ "operate, 127–128, 133, 149, 151–155, 682–683\n",
+ "RET, 336, 656, 661, 668\n",
+ "RTI, 656, 669\n",
+ "ST, 156–157, 656, 670\n",
+ "STI, 158, 338, 350–352, 656, 671\n",
+ "STR, 159, 656, 672\n",
+ "TRAP, 137, 161–162, 169–170, 313, 656, 673,\n",
+ "710–711\u001b[0m\u001b[32;1m\u001b[1;3mAlright, let's dive into state diagrams. These are visual representations of a system's states and the transitions between them. They are particularly useful in designing and understanding finite state machines (FSMs).\n",
+ "\n",
+ "### From the Course Notes:\n",
+ "In the course notes, state diagrams are discussed in the context of finite state machines (FSMs). Here's a snippet from the notes:\n",
+ "\n",
+ "**Section 3.1.3 Finite State Machines (FSMs)**\n",
+ "- **State**: Represents a condition or situation during the life of an object where it satisfies some condition, performs some activity, or waits for some event.\n",
+ "- **Transition**: A change from one state to another.\n",
+ "- **Event**: An occurrence that triggers a transition.\n",
+ "\n",
+ "**Example:**\n",
+ "Consider a simple FSM for a traffic light controller. The states could be:\n",
+ "- Green\n",
+ "- Yellow\n",
+ "- Red\n",
+ "\n",
+ "The transitions could be triggered by a timer:\n",
+ "- Green to Yellow\n",
+ "- Yellow to Red\n",
+ "- Red to Green\n",
+ "\n",
+ "**State Diagram:**\n",
+ "```\n",
+ "[Green] --(timer)--> [Yellow] --(timer)--> [Red] --(timer)--> [Green]\n",
+ "```\n",
+ "\n",
+ "### From the Textbook:\n",
+ "The textbook provides a more detailed example with the LC-3 microarchitecture.\n",
+ "\n",
+ "**Appendix C: The Microarchitecture of the LC-3**\n",
+ "- **State Machine for the LC-3**: This state machine controls the execution of instructions in the LC-3 microarchitecture.\n",
+ "\n",
+ "**Example:**\n",
+ "Consider the state machine for the LC-3 instruction cycle. The states could be:\n",
+ "- Fetch\n",
+ "- Decode\n",
+ "- Evaluate Address\n",
+ "- Fetch Operands\n",
+ "- Execute\n",
+ "- Store Result\n",
+ "\n",
+ "**State Diagram:**\n",
+ "```\n",
+ "[Fetch] --(IR loaded)--> [Decode] --(instruction type)--> [Evaluate Address] --(address calculated)--> [Fetch Operands] --(operands loaded)--> [Execute] --(operation performed)--> [Store Result] --(result stored)--> [Fetch]\n",
+ "```\n",
+ "\n",
+ "**Figure C.2 in the Textbook** provides a detailed state machine diagram for the LC-3, showing all the states and transitions involved in executing instructions.\n",
+ "\n",
+ "### Key Points:\n",
+ "1. **States**: Represent different conditions or situations.\n",
+ "2. **Transitions**: Arrows indicating the change from one state to another.\n",
+ "3. **Events**: Trigger transitions between states.\n",
+ "\n",
+ "### Your Task:\n",
+ "- Understand the states and transitions in your specific problem.\n",
+ "- Draw a state diagram to visualize the FSM.\n",
+ "- Identify the events that trigger transitions.\n",
+ "\n",
+ "Now, go ahead and apply this knowledge to your problem. If you get stuck, refer back to the course notes (Section 3.1.3) and the textbook (Appendix C, Figure C.2). Happy diagramming!\u001b[0m\n",
+ "\n",
+ "\u001b[1m> Finished chain.\u001b[0m\n",
+ "{'input': 'Explain state diagrams to me with an example from the textbook and course notes each', 'chat_history': [AIMessage(content=\"Alright, let's dive into state diagrams. These are visual representations of a system's states and the transitions between them. They are particularly useful in designing and understanding finite state machines (FSMs).\\n\\n### From the Course Notes:\\nIn the course notes, state diagrams are discussed in the context of finite state machines (FSMs). Here's a snippet from the notes:\\n\\n**Section 3.1.3 Finite State Machines (FSMs)**\\n- **State**: Represents a condition or situation during the life of an object where it satisfies some condition, performs some activity, or waits for some event.\\n- **Transition**: A change from one state to another.\\n- **Event**: An occurrence that triggers a transition.\\n\\n**Example:**\\nConsider a simple FSM for a traffic light controller. The states could be:\\n- Green\\n- Yellow\\n- Red\\n\\nThe transitions could be triggered by a timer:\\n- Green to Yellow\\n- Yellow to Red\\n- Red to Green\\n\\n**State Diagram:**\\n```\\n[Green] --(timer)--> [Yellow] --(timer)--> [Red] --(timer)--> [Green]\\n```\\n\\n### From the Textbook:\\nThe textbook provides a more detailed example with the LC-3 microarchitecture.\\n\\n**Appendix C: The Microarchitecture of the LC-3**\\n- **State Machine for the LC-3**: This state machine controls the execution of instructions in the LC-3 microarchitecture.\\n\\n**Example:**\\nConsider the state machine for the LC-3 instruction cycle. The states could be:\\n- Fetch\\n- Decode\\n- Evaluate Address\\n- Fetch Operands\\n- Execute\\n- Store Result\\n\\n**State Diagram:**\\n```\\n[Fetch] --(IR loaded)--> [Decode] --(instruction type)--> [Evaluate Address] --(address calculated)--> [Fetch Operands] --(operands loaded)--> [Execute] --(operation performed)--> [Store Result] --(result stored)--> [Fetch]\\n```\\n\\n**Figure C.2 in the Textbook** provides a detailed state machine diagram for the LC-3, showing all the states and transitions involved in executing instructions.\\n\\n### Key Points:\\n1. **States**: Represent different conditions or situations.\\n2. **Transitions**: Arrows indicating the change from one state to another.\\n3. **Events**: Trigger transitions between states.\\n\\n### Your Task:\\n- Understand the states and transitions in your specific problem.\\n- Draw a state diagram to visualize the FSM.\\n- Identify the events that trigger transitions.\\n\\nNow, go ahead and apply this knowledge to your problem. If you get stuck, refer back to the course notes (Section 3.1.3) and the textbook (Appendix C, Figure C.2). Happy diagramming!\", additional_kwargs={}, response_metadata={})], 'output': \"Alright, let's dive into state diagrams. These are visual representations of a system's states and the transitions between them. They are particularly useful in designing and understanding finite state machines (FSMs).\\n\\n### From the Course Notes:\\nIn the course notes, state diagrams are discussed in the context of finite state machines (FSMs). Here's a snippet from the notes:\\n\\n**Section 3.1.3 Finite State Machines (FSMs)**\\n- **State**: Represents a condition or situation during the life of an object where it satisfies some condition, performs some activity, or waits for some event.\\n- **Transition**: A change from one state to another.\\n- **Event**: An occurrence that triggers a transition.\\n\\n**Example:**\\nConsider a simple FSM for a traffic light controller. The states could be:\\n- Green\\n- Yellow\\n- Red\\n\\nThe transitions could be triggered by a timer:\\n- Green to Yellow\\n- Yellow to Red\\n- Red to Green\\n\\n**State Diagram:**\\n```\\n[Green] --(timer)--> [Yellow] --(timer)--> [Red] --(timer)--> [Green]\\n```\\n\\n### From the Textbook:\\nThe textbook provides a more detailed example with the LC-3 microarchitecture.\\n\\n**Appendix C: The Microarchitecture of the LC-3**\\n- **State Machine for the LC-3**: This state machine controls the execution of instructions in the LC-3 microarchitecture.\\n\\n**Example:**\\nConsider the state machine for the LC-3 instruction cycle. The states could be:\\n- Fetch\\n- Decode\\n- Evaluate Address\\n- Fetch Operands\\n- Execute\\n- Store Result\\n\\n**State Diagram:**\\n```\\n[Fetch] --(IR loaded)--> [Decode] --(instruction type)--> [Evaluate Address] --(address calculated)--> [Fetch Operands] --(operands loaded)--> [Execute] --(operation performed)--> [Store Result] --(result stored)--> [Fetch]\\n```\\n\\n**Figure C.2 in the Textbook** provides a detailed state machine diagram for the LC-3, showing all the states and transitions involved in executing instructions.\\n\\n### Key Points:\\n1. **States**: Represent different conditions or situations.\\n2. **Transitions**: Arrows indicating the change from one state to another.\\n3. **Events**: Trigger transitions between states.\\n\\n### Your Task:\\n- Understand the states and transitions in your specific problem.\\n- Draw a state diagram to visualize the FSM.\\n- Identify the events that trigger transitions.\\n\\nNow, go ahead and apply this knowledge to your problem. If you get stuck, refer back to the course notes (Section 3.1.3) and the textbook (Appendix C, Figure C.2). Happy diagramming!\", 'intermediate_steps': [(AgentActionMessageLog(tool='search_course_notes', tool_input={'query': 'state diagrams'}, log=\"\\nInvoking: `search_course_notes` with `{'query': 'state diagrams'}`\\n\\n\\n\", message_log=[AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"query\":\"state diagrams\"}', 'name': 'search_course_notes'}, 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 16, 'prompt_tokens': 1108, 'total_tokens': 1124, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_67802d9a6d', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {}}], 'finish_reason': 'function_call', 'logprobs': None, 'content_filter_results': {}}, id='run-6b60edd1-a3f8-4e37-9320-bbb3de43d9d6-0', usage_metadata={'input_tokens': 1108, 'output_tokens': 16, 'total_tokens': 1124, 'input_token_details': {}, 'output_token_details': {}})]), 'CONTENTS v\\n2.7.2 Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74\\n2.8 Summary of Part 2 of the Course . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76\\n3.1 Serialization and Finite State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\\n3.1.1 Serialization: General Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79\\n3.1.2 Serialization: Comparator Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80\\n3.1.3 Finite State Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82\\n3.1.4 Synchronous Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84\\n3.1.5 Ripple Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86\\n3.1.6 Timing Issues* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87\\n3.1.7 Machine Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87\\n3.2 Finite State Machine Design Examples, Part I . . . . . . . . . . . . . . . . . . . . . . . . . . . 89\\n\\nFor speed, we make rough estimates in terms of the\\namount of time it takes for a CMOS gate to change its\\noutput once its input has changed. This amount of time\\nis called a gate delay . We can thus estimate our design’sZ1\\nZ0C0C1a comparator bit slice (first attempt)\\nA\\nB\\nspeed by simply counting the maximum number of gates on any path fr om input to output. For this mea-\\nsurement, using a NAND/NOR representation of the design is import ant to getting the right answer, but, as\\nwe have discussed, the diagram above is equivalent on a gate-for-g ate basis. Here we have three gate delays\\nfrom the AandBinputs to the outputs (through the inverters). But when we conn ect multiple copies of\\nour bit slice logic together to form a comparator, as shown on the ne xt page, the delay from the AandB\\ninputs to the outputs is not as important as the delay from the C1andC0inputs to the outputs. The latter\\ndelay adds to the total delay of our comparatoron a per-bit-slice b asis. Looking again at the diagram, notice\\nthat we have only two gate delays from the C1andC0inputs to the outputs. The total delay for an N-bit\\n\\n2.7 Registers 75\\nThe bit slice allows us to build N-bit shift registers by replicating\\nthe slice and adding a fixed amount of “ glue logic .” For example,\\nthe figure below represents a 4-bit bidirectional shift register\\nconstructed in this way. The mux used for the SOoutput logic\\nis the glue logic needed in addition to the four bit slices. At each\\nrising clock edge, the action specified by C1C0is taken. When\\nC1C0= 00, the register holds its current value, with the register\\nvalue appearing on Q[3 : 0] and each flip-flop feeding its output\\nback into its input. For C1C0= 01, the shift register shifts left:\\nthe serial input, SI, is fed into flip-flop 0, and Q3is passed to the\\nserial output, SO. Similarly, when C1C0= 11, the shift register\\nshifts right: SIis fed into flip-flop 3, and Q0is passed to SO.\\nFinally, the case C1C0= 10 causes all flip-flops to accept new\\nvalues from IN[3 : 0], effecting a parallel load.ii−1 i+1i\\nQQ QIN\\nCLK2C\\nD3 0 2 1\\nC1C0 meaning\\n00 retain current value\\n01shift left (low to high)\\n10load new value (from IN)\\n11shift right (high to low)\\n0 3 2 1IN3 IN2 IN1 IN0\\nQ Q Q Qi−1QiIN\\n1C\\n0C iQi−1QiIN\\n1C\\n0C iQi−1QiIN\\n1C\\n0C iQi−1QiIN\\n1C\\n0C iQ\\nbidirectional\\nshift register bitbidirectional\\nshift register bitbidirectional\\nshift register bitbidirectional\\nshift register bit\\nSOC1C0\\nCLKSI\\n1\\n0Qi+1Qi+1Qi+1Qi+1\\nSeveral specialized shift operations are used to support data man ipulation in modern processors (CPUs).\\n\\nThe meaning of RTL\\nis slightly differ-\\nent from the usual\\ninterpretation of\\nhigh-level program-\\nming languages,\\nhowever, in terms\\nof when the actions\\nhappen. A list of\\nC statements is\\ngenerally executed\\none at a time. In\\ncontrast, the entire\\nlist of RTL actionsstate actions (simultaneous) condition next state\\nWAIT IDX←0 (to read VALUES[0] inINIT) START INIT\\nSTART WAIT\\nINIT MIN←VALUES[IDX] (IDXis 0 in this state) (always) PREP\\nIDX←IDX+ 1\\nPREP A←MIN (always) COMPARE\\nB←VALUES[IDX]\\nCNT←0\\nCOMPARE run serial comparator LAST COPY\\nLAST COMPARE\\nCOPY THEN:MIN←VALUES[IDX] DONE WAIT\\nIDX←IDX+ 1 DONE PREP'), (AgentActionMessageLog(tool='search_course_textbook', tool_input={'query': 'state diagrams'}, log=\"\\nInvoking: `search_course_textbook` with `{'query': 'state diagrams'}`\\n\\n\\n\", message_log=[AIMessage(content='', additional_kwargs={'function_call': {'arguments': '{\"query\":\"state diagrams\"}', 'name': 'search_course_textbook'}, 'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 17, 'prompt_tokens': 2581, 'total_tokens': 2598, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_67802d9a6d', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {}}], 'finish_reason': 'function_call', 'logprobs': None, 'content_filter_results': {}}, id='run-d7fd8e13-ce60-4e90-808a-d1cf60d4087e-0', usage_metadata={'input_tokens': 2581, 'output_tokens': 17, 'total_tokens': 2598, 'input_token_details': {}, 'output_token_details': {}})]), '702 appendix C The Microarchitectureof the LC-3\\nTo 18R\\nRR\\nTo 18R RM[MAR]<−MDR16To 18[BEN]\\nPC<−PC+off900\\n122\\nTo 18set CC1\\nTo 18 DR<−SR1&OP2*\\nset CC\\nTo 18\\nDR<−NOT(SR)\\nset CC\\nDR<−PC+off9BEN<−IR[11] & N + IR[10] & Z + IR[9] & P\\n[IR[15:12]]\\n[ACV]JSR\\nMAR<−MDR\\nset ACVMAR<−PC+off9JMPBR\\nset ACV\\n[ACV]\\nMAR<−MDR\\nset ACVMAR<−B+off6\\nset ACV\\n3\\nMAR<−PC+off9\\nset ACVTo 18PC<−BaseR\\n1012\\n4\\n21To 18\\n20\\nTo 18[IR[11]]\\nPC<−PC+off11R7<−PC1101\\nPC<−BaseRR7<−PC0\\n1\\n0[ACV]\\nRTI1\\n33\\nMDR <− M\\nR28\\n30\\nIR <− MDR\\n32\\nMAR<−PC+off9\\nset ACV\\nDR<−MDR\\nset CC25\\n27\\nTo 18MDR<−M[MAR]MAR<−PC+off9\\nset ACV\\n[ACV]10\\n17\\nR19\\nMDR<−SR\\n[ACV]7(See figure C.7)\\n(See figure C.7)To 8\\nTo 15To 49\\n(See figure C.7)\\n0 1\\nTo 480\\nTo 571RMDR<−M[MAR]\\nRMDR<−M[MAR]To 5601\\nR 2901\\nTo 615\\n9\\n14\\n2MAR<−B+off6\\nset ACV11\\n24\\n6\\n26 31\\n3523AND\\nDR<−SR1+OP2*To 13\\nADD\\nLEA STR ST[INT]set ACVPC <− PC + 1MAR <− PC\\n\\nTo 15To 49\\n(See figure C.7)\\n0 1\\nTo 480\\nTo 571RMDR<−M[MAR]\\nRMDR<−M[MAR]To 5601\\nR 2901\\nTo 615\\n9\\n14\\n2MAR<−B+off6\\nset ACV11\\n24\\n6\\n26 31\\n3523AND\\nDR<−SR1+OP2*To 13\\nADD\\nLEA STR ST[INT]set ACVPC <− PC + 1MAR <− PC\\n*OP2 may be SR2 or SEXT[imm5]LDRLD LDI STI\\nNOTTRAP18\\nNOTES\\nB+off6 : Base + SEXT[offset6]\\nPC+off9 : PC + SEXT[offset9]\\n(Addr=0xFE00)ACV=PC+off11 : PC + SEXT[offset11]\\n& PSR[15]To 60\\nFigure C.2 A state machine for the LC-3.\\n\\n704 appendix C The Microarchitectureof the LC-3\\nMEMORYOUTPUT INPUT\\nDSRDDR KBDR\\nADDR. CTL.\\nLOGICGateMDR\\nMDR LD.MDR\\nINMUXMAR LD.MAR\\n2KBSRMIO.EN\\nR\\nMEM.ENR.W MIO.ENSEXT SEXT\\nSEXT\\nSEXT[5:0][8:0][10:0]+1GateMARMUX\\n16\\n161616\\n16\\n1616 1616\\n161616 16\\n16ALUBA\\nGateALU16SR2MUXPC\\n+\\nIRZEXT\\nR\\nNZP\\nLOGICSR2\\nOUTSR1\\nOUTREG\\nFILE\\n[7:0]\\n2PCMUX\\nLD.CCGatePC\\nLD.PC\\nLD.IRMARMUX\\nALUK16\\n1616163\\n332\\n[4:0]\\n[5]0ADDR1MUX\\n2ADDR2MUXSR1 SR2LD.REGDR\\nCONTROL\\nFigure C.3 The LC-3 data path.\\n\\nIndex 765\\nPSR, 657\\nSaved SSP, 317, 331, 345, 657\\nSaved USP, 317, 331, 345, 657\\nSP, 657\\nSR, 657\\nSR1, 657\\nSR2, 657\\nSSP, 657\\ntrapvect8, 657\\nUSP, 657\\ninstruction pointer. Seeprogram counter (PC)\\ninstruction register (IR), 125, 127, 130, 134\\ninstructions\\nADD, 128–129, 132, 151–153, 380, 656, 658\\nAND, 129, 151–153, 656, 659\\nin assembly language, 233–236\\nBR, 133–135, 162–164, 267, 656, 660\\ncontrol, 128, 133, 135, 149, 161–170,\\n205–206, 683–684\\ndata movement, 128, 133, 149, 155–161,\\n683–684\\ndefined, 121, 127, 654\\nHALT, 137, 314\\nI/O, 317–318\\nJMP, 169, 266, 656, 661\\nJSR, 266–267, 336, 656, 662\\nJSRR, 267, 656, 662\\nJSR(R), 266–267\\nLD, 129, 156–157, 656, 663\\nLDI, 158, 350–352, 656, 664\\nLDR, 159–160, 656, 665\\nLEA, 154–155, 656, 666\\nNOT, 151, 152, 656, 667\\noperate, 127–128, 133, 149, 151–155, 682–683\\nRET, 336, 656, 661, 668\\nRTI, 656, 669\\nST, 156–157, 656, 670\\nSTI, 158, 338, 350–352, 656, 671\\nSTR, 159, 656, 672\\nTRAP, 137, 161–162, 169–170, 313, 656, 673,\\n710–711')]}\n"
+ ]
+ }
+ ],
+ "source": [
+ "llm.model_name = \"gpt-4o\"\n",
+ "print(f\"LLM: {llm}\")\n",
+ "print(f\"LLM model name: {llm.model_name}\")\n",
+ "\n",
+ "try:\n",
+ " agent = create_conversational_retrieval_agent(\n",
+ " llm,\n",
+ " tools,\n",
+ " system_message=system_message,\n",
+ " remember_intermediate_steps=True,\n",
+ " verbose=True,\n",
+ " callback_manager=None,\n",
+ " )\n",
+ " response = agent.invoke(\"Explain state diagrams to me with an example from the textbook and course notes each\")\n",
+ " print(response)\n",
+ "except Exception as e:\n",
+ " print(f\"An error occurred: {e}\")\n",
+ " import traceback\n",
+ " traceback.print_exc()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 54,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "LLM: client= async_client= root_client= root_async_client= model_name='gpt-4o' temperature=0.0 model_kwargs={} openai_api_key=SecretStr('**********') disabled_params={'parallel_tool_calls': None} azure_endpoint='https://invite-instance-openai.openai.azure.com/' deployment_name='gpt4-o' openai_api_version='2024-02-15-preview' openai_api_type='azure'\n",
+ "Tools: [Tool(name='search_course_name', description='This includes just the course name.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n')), Tool(name='search_course_overview', description='Search for course overview. This includes the course overview and policies.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n')), Tool(name='search_course_notes', description='Search for information or answers from the course notes. This includes content and concepts related to the course This should be your primary choice for answering anny course-specific questions.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n')), Tool(name='search_course_textbook', description='Search for information or answers from the course textbook. This includes content related to C programming and should be your first choice to answer any C programing related questions.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n')), Tool(name='search_knowledge_components', description='Search for relevant Knowledge Components (KCs) in C programming. Use this tool to identify specific areas of knowledge that the student might need to focus on for debugging and problem-solving.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n')), Tool(name='search_course_logistics', description='Search for information about course logistics, schedules, policies, and other administrative details from the Canvas course page and related links. Use it to provide exact answers to any questions the student will have regarding the course itself.', args_schema=, func=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'), coroutine=functools.partial(, retriever=VectorStoreRetriever(tags=['Chroma', 'AzureOpenAIEmbeddings'], vectorstore=, search_kwargs={}), document_prompt=PromptTemplate(input_variables=['page_content'], input_types={}, partial_variables={}, template='{page_content}'), document_separator='\\n\\n'))]\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(f\"LLM: {llm}\")\n",
+ "print(f\"Tools: {tools}\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 60,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "image_url = \"https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 67,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import base64\n",
+ "\n",
+ "import httpx\n",
+ "\n",
+ "image_data = base64.b64encode(httpx.get(image_url).content).decode(\"utf-8\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 64,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "The weather in the image appears to be clear and pleasant. The sky is mostly blue with some scattered clouds, indicating a sunny day with good visibility. There is no sign of precipitation or stormy weather. The lighting suggests it might be either late morning or early afternoon, as the sunlight is bright but not harsh. The lush green grass and foliage suggest that it is likely spring or summer. Overall, the weather looks calm and inviting.\n"
+ ]
+ }
+ ],
+ "source": [
+ "message = HumanMessage(\n",
+ " content=[\n",
+ " {\"type\": \"text\", \"text\": \"describe the weather in this image\"},\n",
+ " {\n",
+ " \"type\": \"image_url\",\n",
+ " \"image_url\": {\"url\": f\"data:image/jpeg;base64,{image_data}\"},\n",
+ " },\n",
+ " ],\n",
+ ")\n",
+ "response = llm.invoke([message])\n",
+ "print(response.content) "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 14,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'tools' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[14], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m agent \u001b[38;5;241m=\u001b[39m create_conversational_retrieval_agent(\n\u001b[1;32m 2\u001b[0m llm,\n\u001b[0;32m----> 3\u001b[0m \u001b[43mtools\u001b[49m,\n\u001b[1;32m 4\u001b[0m system_message\u001b[38;5;241m=\u001b[39msystem_message,\n\u001b[1;32m 5\u001b[0m remember_intermediate_steps\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[1;32m 6\u001b[0m verbose\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m,\n\u001b[1;32m 7\u001b[0m callback_manager\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m,\n\u001b[1;32m 8\u001b[0m )\n",
+ "\u001b[0;31mNameError\u001b[0m: name 'tools' is not defined"
+ ]
+ }
+ ],
+ "source": [
+ "agent = create_conversational_retrieval_agent(\n",
+ " llm,\n",
+ " tools,\n",
+ " system_message=system_message,\n",
+ " remember_intermediate_steps=True,\n",
+ " verbose=True,\n",
+ " callback_manager=None,\n",
+ " )"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {},
+ "outputs": [
+ {
+ "ename": "NameError",
+ "evalue": "name 'HumanMessage' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
+ "Cell \u001b[0;32mIn[20], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m message \u001b[38;5;241m=\u001b[39m \u001b[43mHumanMessage\u001b[49m(\n\u001b[1;32m 2\u001b[0m content\u001b[38;5;241m=\u001b[39m[\n\u001b[1;32m 3\u001b[0m {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtext\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdescribe the weather in this image\u001b[39m\u001b[38;5;124m\"\u001b[39m},\n\u001b[1;32m 4\u001b[0m {\n\u001b[1;32m 5\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtype\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mimage_url\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 6\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mimage_url\u001b[39m\u001b[38;5;124m\"\u001b[39m: {\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124murl\u001b[39m\u001b[38;5;124m\"\u001b[39m: \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata:image/jpeg;base64,\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mimage_data\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m},\n\u001b[1;32m 7\u001b[0m },\n\u001b[1;32m 8\u001b[0m ],\n\u001b[1;32m 9\u001b[0m )\n\u001b[1;32m 10\u001b[0m response \u001b[38;5;241m=\u001b[39m agent\u001b[38;5;241m.\u001b[39minvoke([message])\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28mprint\u001b[39m(response\u001b[38;5;241m.\u001b[39mcontent) \n",
+ "\u001b[0;31mNameError\u001b[0m: name 'HumanMessage' is not defined"
+ ]
+ }
+ ],
+ "source": [
+ "message = HumanMessage(\n",
+ " content=[\n",
+ " {\"type\": \"text\", \"text\": \"describe the weather in this image\"},\n",
+ " {\n",
+ " \"type\": \"image_url\",\n",
+ " \"image_url\": {\"url\": f\"data:image/jpeg;base64,{image_data}\"},\n",
+ " },\n",
+ " ],\n",
+ ")\n",
+ "response = agent.invoke([message])\n",
+ "print(response.content) "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 31,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "LANGCHAIN_TRACING_V2=\"true\"\n",
+ "LANGCHAIN_ENDPOINT=\"https://api.smith.langchain.com\"\n",
+ "LANGCHAIN_API_KEY=\"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\"\n",
+ "LANGCHAIN_PROJECT=\"langsmith-tutorial\"\n",
+ "\n",
+ "os.environ[\"LANGCHAIN_API_KEY\"] =LANGCHAIN_API_KEY\n",
+ "os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
+ "os.environ[\"LANGCHAIN_ENDPOINT\"] = \"https://api.smith.langchain.com\"\n",
+ "os.environ[\"LANGCHAIN_PROJECT\"] = \"langsmith-tutorial\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 32,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "AIMessage(content='Hello! How can I assist you today?', additional_kwargs={'refusal': None}, response_metadata={'token_usage': {'completion_tokens': 9, 'prompt_tokens': 8, 'total_tokens': 17, 'completion_tokens_details': None, 'prompt_tokens_details': None}, 'model_name': 'gpt-4o-2024-05-13', 'system_fingerprint': 'fp_67802d9a6d', 'prompt_filter_results': [{'prompt_index': 0, 'content_filter_results': {}}], 'finish_reason': 'stop', 'logprobs': None, 'content_filter_results': {'hate': {'filtered': False, 'severity': 'safe'}, 'self_harm': {'filtered': False, 'severity': 'safe'}, 'sexual': {'filtered': False, 'severity': 'safe'}, 'violence': {'filtered': False, 'severity': 'safe'}}}, id='run-0cd5bc09-08c0-4895-a729-3d47aab3944a-0', usage_metadata={'input_tokens': 8, 'output_tokens': 9, 'total_tokens': 17, 'input_token_details': {}, 'output_token_details': {}})"
+ ]
+ },
+ "execution_count": 32,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "llm.invoke(\"Hello\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 33,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "\n",
+ "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
+ "\u001b[32;1m\u001b[1;3mAlright, I see what you're doing. Very funny. Now, seriously, do you have a question about ECE 120, or are we just going to keep saying \"hello\" all day?\u001b[0m\n",
+ "\n",
+ "\u001b[1m> Finished chain.\u001b[0m\n"
+ ]
+ },
+ {
+ "data": {
+ "text/plain": [
+ "{'input': 'Hello',\n",
+ " 'chat_history': [AIMessage(content=\"Alright, let's dive into state diagrams. These are visual representations of a system's states and the transitions between them. They are particularly useful in designing and understanding finite state machines (FSMs).\\n\\n### From the Course Notes:\\nIn the course notes, state diagrams are discussed in the context of finite state machines (FSMs). Here's a snippet from the notes:\\n\\n**Section 3.1.3 Finite State Machines (FSMs)**\\n- **State**: Represents a condition or situation during the life of an object where it satisfies some condition, performs some activity, or waits for some event.\\n- **Transition**: A change from one state to another.\\n- **Event**: An occurrence that triggers a transition.\\n\\n**Example:**\\nConsider a simple FSM for a traffic light controller. The states could be:\\n- Green\\n- Yellow\\n- Red\\n\\nThe transitions could be triggered by a timer:\\n- Green to Yellow\\n- Yellow to Red\\n- Red to Green\\n\\n**State Diagram:**\\n```\\n[Green] --(timer)--> [Yellow] --(timer)--> [Red] --(timer)--> [Green]\\n```\\n\\n### From the Textbook:\\nThe textbook provides a more detailed example with the LC-3 microarchitecture.\\n\\n**Appendix C: The Microarchitecture of the LC-3**\\n- **State Machine for the LC-3**: This state machine controls the execution of instructions in the LC-3 microarchitecture.\\n\\n**Example:**\\nConsider the state machine for the LC-3 instruction cycle. The states could be:\\n- Fetch\\n- Decode\\n- Evaluate Address\\n- Fetch Operands\\n- Execute\\n- Store Result\\n\\n**State Diagram:**\\n```\\n[Fetch] --(IR loaded)--> [Decode] --(instruction type)--> [Evaluate Address] --(address calculated)--> [Fetch Operands] --(operands loaded)--> [Execute] --(operation performed)--> [Store Result] --(result stored)--> [Fetch]\\n```\\n\\n**Figure C.2 in the Textbook** provides a detailed state machine diagram for the LC-3, showing all the states and transitions involved in executing instructions.\\n\\n### Key Points:\\n1. **States**: Represent different conditions or situations.\\n2. **Transitions**: Arrows indicating the change from one state to another.\\n3. **Events**: Trigger transitions between states.\\n\\n### Your Task:\\n- Understand the states and transitions in your specific problem.\\n- Draw a state diagram to visualize the FSM.\\n- Identify the events that trigger transitions.\\n\\nNow, go ahead and apply this knowledge to your problem. If you get stuck, refer back to the course notes (Section 3.1.3) and the textbook (Appendix C, Figure C.2). Happy diagramming!\", additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='Hello', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content=\"Ah, greetings! What conundrum are you grappling with today? Remember, I'm here to guide you, not to hand you the answers on a silver platter. So, what's the issue?\", additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='Hello', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content=\"Yes, hello again. What's the problem you're facing? Let's get to the point.\", additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='Hello', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content=\"Alright, I get it. Hello. Now, unless you're here to chat about the weather, let's dive into whatever ECE 120-related issue you're dealing with. What's on your mind?\", additional_kwargs={}, response_metadata={}),\n",
+ " HumanMessage(content='Hello', additional_kwargs={}, response_metadata={}),\n",
+ " AIMessage(content='Alright, I see what you\\'re doing. Very funny. Now, seriously, do you have a question about ECE 120, or are we just going to keep saying \"hello\" all day?', additional_kwargs={}, response_metadata={})],\n",
+ " 'output': 'Alright, I see what you\\'re doing. Very funny. Now, seriously, do you have a question about ECE 120, or are we just going to keep saying \"hello\" all day?',\n",
+ " 'intermediate_steps': []}"
+ ]
+ },
+ "execution_count": 33,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "agent.invoke(\"Hello\")"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "ai-ta-env",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
diff --git a/textbook.pdf b/textbook.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..3896158b6b4a346e13a291209626bafc09651229
--- /dev/null
+++ b/textbook.pdf
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:093bec0ba3c2af9509948c1c9447121f48fe2885b8c7bf10361cf347156a07a9
+size 33393081
diff --git a/webpage-embeddings.ipynb b/webpage-embeddings.ipynb
new file mode 100644
index 0000000000000000000000000000000000000000..bab4e29b34a498fd1ff3c1d58644827f13f3c3e2
--- /dev/null
+++ b/webpage-embeddings.ipynb
@@ -0,0 +1,1021 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Collecting bs4\n",
+ " Using cached bs4-0.0.2-py2.py3-none-any.whl.metadata (411 bytes)\n",
+ "Collecting beautifulsoup4 (from bs4)\n",
+ " Using cached beautifulsoup4-4.12.3-py3-none-any.whl.metadata (3.8 kB)\n",
+ "Collecting soupsieve>1.2 (from beautifulsoup4->bs4)\n",
+ " Using cached soupsieve-2.6-py3-none-any.whl.metadata (4.6 kB)\n",
+ "Using cached bs4-0.0.2-py2.py3-none-any.whl (1.2 kB)\n",
+ "Using cached beautifulsoup4-4.12.3-py3-none-any.whl (147 kB)\n",
+ "Using cached soupsieve-2.6-py3-none-any.whl (36 kB)\n",
+ "Installing collected packages: soupsieve, beautifulsoup4, bs4\n",
+ "Successfully installed beautifulsoup4-4.12.3 bs4-0.0.2 soupsieve-2.6\n",
+ "Note: you may need to restart the kernel to use updated packages.\n"
+ ]
+ }
+ ],
+ "source": [
+ "pip install bs4"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Starting scrape from: https://canvas.illinois.edu/courses/49537\n",
+ "Scraping (Depth 1): https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537#content\n",
+ "Scraping (Depth 2): https://canvas.illinois.edu/courses/49537#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Scraping (Depth 3): https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687#content\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/external_tools/13687#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Scraping (Depth 3): https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages#content\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252/download?download_frd=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401/download?download_frd=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2#content\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Scraping (Depth 3): https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1#content\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252/download?download_frd=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252/download?download_frd=1&verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285252/download?download_frd=1&verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252/download?download_frd=1&verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Scraping (Depth 3): https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1#content\n",
+ "Scraping (Depth 4): https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401#content\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401/download?download_frd=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401/download?download_frd=1&verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI\n",
+ "Scraping (Depth 5): https://canvas.illinois.edu/courses/49537/files/13285401/download?download_frd=1&verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401/download?download_frd=1&verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13687\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13267\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13268\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13266\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13318\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13239\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/4780\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/assignments/syllabus\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13539\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13316\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13444\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/external_tools/13674\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/homework-hw-grading-policy-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/what-you-should-know-on-the-first-day-of-class\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/course-overview-and-policies-fall-2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/detailed-schedule-fa24\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/textbook-and-lecture-notes-2\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/github-setup-for-lab1-fall2024\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/hardware-labs-and-lab-kits\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/pages/prelecture-and-inclass-quizzes-optional\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285252?verifier=alHeoyunAlYhJRSeFViFsoSIaaG3wYURLyHBqYCi&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537/files/13285401?verifier=KfKWg7U7Cljdh621LhHXbEaV568zBTsDggad5MaI&wrap=1\n",
+ "Found link: https://canvas.illinois.edu/courses/49537?view=feed\n",
+ "\n",
+ "Scraping completed.\n",
+ "Chroma DB is stored in: /Users/nittinmurthi/Documents/VS_Code/120-AI-TA/course-logistics-retriever\n",
+ "Directory exists: True\n",
+ "Contents of the directory: ['chroma.sqlite3', '259a86b0-454b-4c1a-87eb-d61787722f66']\n",
+ "Number of documents scraped and stored: 39\n",
+ "Total unique URLs visited: 39\n"
+ ]
+ }
+ ],
+ "source": [
+ "import os\n",
+ "import requests\n",
+ "from bs4 import BeautifulSoup\n",
+ "from urllib.parse import urljoin\n",
+ "from langchain.vectorstores import Chroma\n",
+ "from langchain.schema import Document\n",
+ "from langchain_community.embeddings import OllamaEmbeddings\n",
+ "\n",
+ "def scrape_and_store_embeddings(start_url, max_depth=5):\n",
+ " embedding = OllamaEmbeddings(model=\"nomic-embed-text\")\n",
+ " visited_urls = set()\n",
+ " documents = []\n",
+ "\n",
+ " def recursive_scrape(url, depth):\n",
+ " if depth > max_depth or url in visited_urls:\n",
+ " return\n",
+ "\n",
+ " visited_urls.add(url)\n",
+ " print(f\"Scraping (Depth {depth}): {url}\") # Print the current URL being scraped\n",
+ " \n",
+ " try:\n",
+ " response = requests.get(url)\n",
+ " soup = BeautifulSoup(response.text, 'html.parser')\n",
+ " \n",
+ " # Extract text content\n",
+ " text = soup.get_text(separator=' ', strip=True)\n",
+ " \n",
+ " # Create a Document object\n",
+ " doc = Document(page_content=text, metadata={\"source\": url})\n",
+ " documents.append(doc)\n",
+ "\n",
+ " # Find all links and recursively scrape them\n",
+ " for link in soup.find_all('a', href=True):\n",
+ " next_url = urljoin(url, link['href'])\n",
+ " if next_url.startswith(start_url): # Only follow links within the same domain\n",
+ " print(f\"Found link: {next_url}\") # Print each found link\n",
+ " recursive_scrape(next_url, depth + 1)\n",
+ " except Exception as e:\n",
+ " print(f\"Error scraping {url}: {e}\")\n",
+ "\n",
+ " # Start the recursive scraping\n",
+ " print(f\"Starting scrape from: {start_url}\")\n",
+ " recursive_scrape(start_url, 1)\n",
+ "\n",
+ " # Create Chroma vector store\n",
+ " persist_directory = os.path.join(os.getcwd(), \"course-logistics-retriever\")\n",
+ " vectorstore = Chroma.from_documents(documents, embedding, persist_directory=persist_directory)\n",
+ "\n",
+ " # Create a retriever from the Chroma vector store\n",
+ " retriever = vectorstore.as_retriever()\n",
+ "\n",
+ " print(f\"\\nScraping completed.\")\n",
+ " print(f\"Chroma DB is stored in: {persist_directory}\")\n",
+ " print(f\"Directory exists: {os.path.exists(persist_directory)}\")\n",
+ " print(f\"Contents of the directory: {os.listdir(persist_directory)}\")\n",
+ " print(f\"Number of documents scraped and stored: {len(documents)}\")\n",
+ " print(f\"Total unique URLs visited: {len(visited_urls)}\")\n",
+ "\n",
+ " return retriever\n",
+ "\n",
+ "# Usage\n",
+ "start_url = \"https://canvas.illinois.edu/courses/49537\"\n",
+ "retriever_course_logistics = scrape_and_store_embeddings(start_url)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "c= tensor([[56, 62],\n",
+ " [74, 89]])\n"
+ ]
+ }
+ ],
+ "source": [
+ "import torch\n",
+ "a = torch.tensor([[0, 2, 4], [1, 3, 5]])\n",
+ "b = torch.tensor([[0, 7], [8, 9], [10, 11]])\n",
+ "c = torch.matmul(a, b) # or alternatively: c = a @ b\n",
+ "print(\"c=\", c)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "Matrix A:\n",
+ "tensor([[ 2., 4., 3.],\n",
+ " [ 9., 6., 8.],\n",
+ " [11., 13., 10.]])\n",
+ "\n",
+ "Inverse of A:\n",
+ "tensor([[-0.7719, -0.0175, 0.2456],\n",
+ " [-0.0351, -0.2281, 0.1930],\n",
+ " [ 0.8947, 0.3158, -0.4211]])\n"
+ ]
+ }
+ ],
+ "source": [
+ "import torch\n",
+ "\n",
+ "# Define matrix A\n",
+ "a = torch.tensor([[2.0, 4.0, 3.0],\n",
+ " [9.0, 6.0, 8.0],\n",
+ " [11.0, 13.0, 10.0]], dtype=torch.float32)\n",
+ "print(\"Matrix A:\")\n",
+ "print(a)\n",
+ "\n",
+ "# Compute the inverse of A\n",
+ "a_inversed = torch.inverse(a)\n",
+ "print(\"\\nInverse of A:\")\n",
+ "print(a_inversed)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "ai-ta-env",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.12.6"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}