\n",
" \n",
- " \n",
+ " \n",
" | \n",
" \n",
" Important Note - Please read me\n",
@@ -41,7 +41,7 @@
"\n",
" \n",
" \n",
- " \n",
+ " \n",
" | \n",
" \n",
" Reminder about the resources page\n",
@@ -610,7 +610,7 @@
"\n",
" \n",
" \n",
- " \n",
+ " \n",
" | \n",
" \n",
" Before you continue\n",
@@ -646,7 +646,7 @@
"\n",
" \n",
" \n",
- " \n",
+ " \n",
" | \n",
" \n",
" Business relevance\n",
@@ -667,7 +667,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": ".venv",
+ "display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -681,7 +681,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.9.6"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/community-contributions/day1-with-3way.ipynb b/week2/community-contributions/day1-with-3way.ipynb
index 5681e64..2cf96ba 100644
--- a/week2/community-contributions/day1-with-3way.ipynb
+++ b/week2/community-contributions/day1-with-3way.ipynb
@@ -641,7 +641,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/community-contributions/day2.ipynb b/week2/community-contributions/day2.ipynb
index f39ffae..05d02bf 100644
--- a/week2/community-contributions/day2.ipynb
+++ b/week2/community-contributions/day2.ipynb
@@ -466,7 +466,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/community-contributions/day4.ipynb b/week2/community-contributions/day4.ipynb
index f1ef198..9c51459 100644
--- a/week2/community-contributions/day4.ipynb
+++ b/week2/community-contributions/day4.ipynb
@@ -292,7 +292,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/community-contributions/task1.ipynb b/week2/community-contributions/task1.ipynb
index 9ca08a3..2758f89 100644
--- a/week2/community-contributions/task1.ipynb
+++ b/week2/community-contributions/task1.ipynb
@@ -315,7 +315,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/day1.ipynb b/week2/day1.ipynb
index dda6516..fe515bc 100644
--- a/week2/day1.ipynb
+++ b/week2/day1.ipynb
@@ -104,8 +104,8 @@
"outputs": [],
"source": [
"# import for google\n",
- "# in rare cases, this seems to give an error on some systems. Please reach out to me if this happens,\n",
- "# or you can feel free to skip Gemini - it's the lowest priority of the frontier models that we use\n",
+ "# in rare cases, this seems to give an error on some systems, or even crashes the kernel\n",
+ "# If this happens to you, simply ignore this cell - I give an alternative approach for using Gemini later\n",
"\n",
"import google.generativeai"
]
@@ -148,14 +148,22 @@
"metadata": {},
"outputs": [],
"source": [
- "# Connect to OpenAI, Anthropic and Google\n",
- "# All 3 APIs are similar\n",
- "# Having problems with API files? You can use openai = OpenAI(api_key=\"your-key-here\") and same for claude\n",
- "# Having problems with Google Gemini setup? Then just skip Gemini; you'll get all the experience you need from GPT and Claude.\n",
+ "# Connect to OpenAI, Anthropic\n",
"\n",
"openai = OpenAI()\n",
"\n",
- "claude = anthropic.Anthropic()\n",
+ "claude = anthropic.Anthropic()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "425ed580-808d-429b-85b0-6cba50ca1d0c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# This is the set up code for Gemini\n",
+ "# Having problems with Google Gemini setup? Then just ignore this cell; when we use Gemini, I'll give you an alternative that bypasses this library altogether\n",
"\n",
"google.generativeai.configure()"
]
@@ -308,7 +316,9 @@
"metadata": {},
"outputs": [],
"source": [
- "# The API for Gemini has a slightly different structure\n",
+ "# The API for Gemini has a slightly different structure.\n",
+ "# I've heard that on some PCs, this Gemini code causes the Kernel to crash.\n",
+ "# If that happens to you, please skip this cell and use the next cell instead - an alternative approach.\n",
"\n",
"gemini = google.generativeai.GenerativeModel(\n",
" model_name='gemini-1.5-flash',\n",
@@ -318,6 +328,28 @@
"print(response.text)"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "49009a30-037d-41c8-b874-127f61c4aa3a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "# As an alternative way to use Gemini that bypasses Google's python API library,\n",
+ "# Google has recently released new endpoints that means you can use Gemini via the client libraries for OpenAI!\n",
+ "\n",
+ "gemini_via_openai_client = OpenAI(\n",
+ " api_key=google_api_key, \n",
+ " base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\"\n",
+ ")\n",
+ "\n",
+ "response = gemini_via_openai_client.chat.completions.create(\n",
+ " model=\"gemini-1.5-flash\",\n",
+ " messages=prompts\n",
+ ")\n",
+ "print(response.choices[0].message.content)"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
@@ -534,7 +566,7 @@
"\n",
"Try creating a 3-way, perhaps bringing Gemini into the conversation! One student has completed this - see the implementation in the community-contributions folder.\n",
"\n",
- "Try doing this yourself before you look at the solutions.\n",
+ "Try doing this yourself before you look at the solutions. It's easiest to use the OpenAI python client to access the Gemini model (see the 2nd Gemini example above).\n",
"\n",
"## Additional exercise\n",
"\n",
@@ -584,7 +616,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/day2.ipynb b/week2/day2.ipynb
index 4c63192..bf5367f 100644
--- a/week2/day2.ipynb
+++ b/week2/day2.ipynb
@@ -186,6 +186,7 @@
"source": [
"# Adding share=True means that it can be accessed publically\n",
"# A more permanent hosting is available using a platform called Spaces from HuggingFace, which we will touch on next week\n",
+ "# NOTE: Some Anti-virus software and Corporate Firewalls might not like you using share=True. If you're at work on on a work network, I suggest skip this test.\n",
"\n",
"gr.Interface(fn=shout, inputs=\"textbox\", outputs=\"textbox\", flagging_mode=\"never\").launch(share=True)"
]
@@ -565,7 +566,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/day3.ipynb b/week2/day3.ipynb
index 2be75a4..e9d0348 100644
--- a/week2/day3.ipynb
+++ b/week2/day3.ipynb
@@ -296,7 +296,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/day4.ipynb b/week2/day4.ipynb
index 06c3904..811d116 100644
--- a/week2/day4.ipynb
+++ b/week2/day4.ipynb
@@ -44,7 +44,12 @@
" print(\"OpenAI API Key not set\")\n",
" \n",
"MODEL = \"gpt-4o-mini\"\n",
- "openai = OpenAI()"
+ "openai = OpenAI()\n",
+ "\n",
+ "# As an alternative, if you'd like to use Ollama instead of OpenAI\n",
+ "# Check that Ollama is running for you locally (see week1/day2 exercise) then uncomment these next 2 lines\n",
+ "# MODEL = \"llama3.2\"\n",
+ "# openai = OpenAI(base_url='http://localhost:11434/v1', api_key='ollama')\n"
]
},
{
@@ -249,7 +254,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/day5.ipynb b/week2/day5.ipynb
index 22124b3..3453ccb 100644
--- a/week2/day5.ipynb
+++ b/week2/day5.ipynb
@@ -296,7 +296,7 @@
"id": "f4975b87-19e9-4ade-a232-9b809ec75c9a",
"metadata": {},
"source": [
- "## Audio\n",
+ "## Audio (NOTE - Audio is optional for this course - feel free to skip Audio if it causes trouble!)\n",
"\n",
"And let's make a function talker that uses OpenAI's speech model to generate Audio\n",
"\n",
@@ -410,12 +410,14 @@
"source": [
"# For Windows users\n",
"\n",
- "## if you get a permissions error writing to a temp file, then this code should work instead.\n",
+ "## First try the Mac version above, but if you get a permissions error writing to a temp file, then this code should work instead.\n",
"\n",
"A collaboration between students Mark M. and Patrick H. and Claude got this resolved!\n",
"\n",
"Below are 3 variations - hopefully one of them will work on your PC. If not, message me please!\n",
"\n",
+ "And for Mac people - all 3 of the below work on my Mac too - please try these if the Mac version gave you problems.\n",
+ "\n",
"## PC Variation 1"
]
},
@@ -695,7 +697,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week2/week2 EXERCISE.ipynb b/week2/week2 EXERCISE.ipynb
index 99d83cb..d97f5cb 100644
--- a/week2/week2 EXERCISE.ipynb
+++ b/week2/week2 EXERCISE.ipynb
@@ -43,7 +43,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week3/day1.ipynb b/week3/day1.ipynb
index b1bea54..2d76b3d 100644
--- a/week3/day1.ipynb
+++ b/week3/day1.ipynb
@@ -41,7 +41,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week3/day2.ipynb b/week3/day2.ipynb
index 9c4e01f..eab737e 100644
--- a/week3/day2.ipynb
+++ b/week3/day2.ipynb
@@ -41,7 +41,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week3/day3.ipynb b/week3/day3.ipynb
index 535f3ac..03c847e 100644
--- a/week3/day3.ipynb
+++ b/week3/day3.ipynb
@@ -37,7 +37,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week3/day4.ipynb b/week3/day4.ipynb
index 3cbd556..13aac73 100644
--- a/week3/day4.ipynb
+++ b/week3/day4.ipynb
@@ -31,7 +31,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week3/day5.ipynb b/week3/day5.ipynb
index 70690f7..d068f79 100644
--- a/week3/day5.ipynb
+++ b/week3/day5.ipynb
@@ -43,7 +43,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week4/day3.ipynb b/week4/day3.ipynb
index 481e869..69188c4 100644
--- a/week4/day3.ipynb
+++ b/week4/day3.ipynb
@@ -505,13 +505,13 @@
"outputs": [],
"source": [
"def execute_python(code):\n",
- " try:\n",
- " output = io.StringIO()\n",
- " sys.stdout = output\n",
- " exec(code)\n",
- " finally:\n",
- " sys.stdout = sys.__stdout__\n",
- " return output.getvalue()"
+ " try:\n",
+ " output = io.StringIO()\n",
+ " sys.stdout = output\n",
+ " exec(code)\n",
+ " finally:\n",
+ " sys.stdout = sys.__stdout__\n",
+ " return output.getvalue()"
]
},
{
@@ -581,14 +581,6 @@
"\n",
"ui.launch(inbrowser=True)"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "77a80857-4632-4de8-a28f-b614bcbe2f40",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -607,7 +599,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week4/day4.ipynb b/week4/day4.ipynb
index ea195fa..722a233 100644
--- a/week4/day4.ipynb
+++ b/week4/day4.ipynb
@@ -696,7 +696,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week4/optimized b/week4/optimized
index 526d5b0..c7745a1 100755
Binary files a/week4/optimized and b/week4/optimized differ
diff --git a/week4/optimized.cpp b/week4/optimized.cpp
index bdc9d5b..365cbee 100644
--- a/week4/optimized.cpp
+++ b/week4/optimized.cpp
@@ -1,51 +1,72 @@
#include
-#include
+#include
#include
+#include
#include
-// Function to generate random numbers using Mersenne Twister
-std::mt19937 gen(42);
+using namespace std;
+using namespace chrono;
+
+class LCG {
+private:
+ uint64_t value;
+ static const uint64_t a = 1664525;
+ static const uint64_t c = 1013904223;
+ static const uint64_t m = 1ULL << 32;
+
+public:
+ LCG(uint64_t seed) : value(seed) {}
+
+ uint64_t next() {
+ value = (a * value + c) % m;
+ return value;
+ }
+};
+
+int64_t max_subarray_sum(int n, uint64_t seed, int min_val, int max_val) {
+ LCG lcg(seed);
+ vector random_numbers(n);
+ for (int i = 0; i < n; ++i) {
+ random_numbers[i] = lcg.next() % (max_val - min_val + 1) + min_val;
+ }
+
+ int64_t max_sum = numeric_limits::min();
+ int64_t current_sum = 0;
+ int64_t min_sum = 0;
-// Function to calculate maximum subarray sum
-int max_subarray_sum(int n, int min_val, int max_val) {
- std::uniform_int_distribution<> dis(min_val, max_val);
- int max_sum = std::numeric_limits::min();
- int current_sum = 0;
for (int i = 0; i < n; ++i) {
- current_sum += dis(gen);
- if (current_sum > max_sum) {
- max_sum = current_sum;
- }
- if (current_sum < 0) {
- current_sum = 0;
- }
+ current_sum += random_numbers[i];
+ max_sum = max(max_sum, current_sum - min_sum);
+ min_sum = min(min_sum, current_sum);
}
+
return max_sum;
}
-// Function to calculate total maximum subarray sum
-int total_max_subarray_sum(int n, int initial_seed, int min_val, int max_val) {
- gen.seed(initial_seed);
- int total_sum = 0;
+int64_t total_max_subarray_sum(int n, uint64_t initial_seed, int min_val, int max_val) {
+ int64_t total_sum = 0;
+ LCG lcg(initial_seed);
for (int i = 0; i < 20; ++i) {
- total_sum += max_subarray_sum(n, min_val, max_val);
+ uint64_t seed = lcg.next();
+ total_sum += max_subarray_sum(n, seed, min_val, max_val);
}
return total_sum;
}
int main() {
- int n = 10000; // Number of random numbers
- int initial_seed = 42; // Initial seed for the Mersenne Twister
- int min_val = -10; // Minimum value of random numbers
- int max_val = 10; // Maximum value of random numbers
-
- // Timing the function
- auto start_time = std::chrono::high_resolution_clock::now();
- int result = total_max_subarray_sum(n, initial_seed, min_val, max_val);
- auto end_time = std::chrono::high_resolution_clock::now();
-
- std::cout << "Total Maximum Subarray Sum (20 runs): " << result << std::endl;
- std::cout << "Execution Time: " << std::setprecision(6) << std::fixed << std::chrono::duration(end_time - start_time).count() << " seconds" << std::endl;
+ const int n = 10000;
+ const uint64_t initial_seed = 42;
+ const int min_val = -10;
+ const int max_val = 10;
+
+ auto start_time = high_resolution_clock::now();
+ int64_t result = total_max_subarray_sum(n, initial_seed, min_val, max_val);
+ auto end_time = high_resolution_clock::now();
+
+ auto duration = duration_cast(end_time - start_time);
+
+ cout << "Total Maximum Subarray Sum (20 runs): " << result << endl;
+ cout << "Execution Time: " << fixed << setprecision(6) << duration.count() / 1e6 << " seconds" << endl;
return 0;
}
\ No newline at end of file
diff --git a/week5/community-contributions/day3 - extended for Obsidian files and separate ingestion.ipynb b/week5/community-contributions/day3 - extended for Obsidian files and separate ingestion.ipynb
index 2230c68..161eb8d 100644
--- a/week5/community-contributions/day3 - extended for Obsidian files and separate ingestion.ipynb
+++ b/week5/community-contributions/day3 - extended for Obsidian files and separate ingestion.ipynb
@@ -388,7 +388,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/community-contributions/day4 - taking advantage of separate ingestion.ipynb b/week5/community-contributions/day4 - taking advantage of separate ingestion.ipynb
index 188bc8a..bb16478 100644
--- a/week5/community-contributions/day4 - taking advantage of separate ingestion.ipynb
+++ b/week5/community-contributions/day4 - taking advantage of separate ingestion.ipynb
@@ -421,7 +421,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day1.ipynb b/week5/day1.ipynb
index 1ccdd33..f4bc48e 100644
--- a/week5/day1.ipynb
+++ b/week5/day1.ipynb
@@ -256,7 +256,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day2.ipynb b/week5/day2.ipynb
index 824c75b..8c19368 100644
--- a/week5/day2.ipynb
+++ b/week5/day2.ipynb
@@ -169,14 +169,6 @@
" print(chunk)\n",
" print(\"_________\")"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "6965971c-fb97-482c-a497-4e81a0ac83df",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
"metadata": {
@@ -195,7 +187,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day3.ipynb b/week5/day3.ipynb
index a092bbb..764f13c 100644
--- a/week5/day3.ipynb
+++ b/week5/day3.ipynb
@@ -352,7 +352,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day4.5.ipynb b/week5/day4.5.ipynb
index 13de8d7..a02b9cd 100644
--- a/week5/day4.5.ipynb
+++ b/week5/day4.5.ipynb
@@ -214,7 +214,9 @@
"source": [
"## Visualizing the Vector Store\n",
"\n",
- "Let's take a minute to look at the documents and their embedding vectors to see what's going on."
+ "Let's take a minute to look at the documents and their embedding vectors to see what's going on.\n",
+ "\n",
+ "(As a sidenote, what we're really looking at here is the distribution of the Vectors generated by OpenAIEmbeddings, retrieved from FAISS. So there's no surprise that they look the same whether they are \"from\" FAISS or Chroma.)"
]
},
{
@@ -326,6 +328,17 @@
"print(result[\"answer\"])"
]
},
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "987dadc5-5d09-4059-8f2e-733d66ecc696",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)\n",
+ "conversation_chain = ConversationalRetrievalChain.from_llm(llm=llm, retriever=retriever, memory=memory)"
+ ]
+ },
{
"cell_type": "markdown",
"id": "bbbcb659-13ce-47ab-8a5e-01b930494964",
@@ -387,7 +400,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day4.ipynb b/week5/day4.ipynb
index d3d1ad0..43aa358 100644
--- a/week5/day4.ipynb
+++ b/week5/day4.ipynb
@@ -404,7 +404,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week5/day5.ipynb b/week5/day5.ipynb
index 141b518..5c29d40 100644
--- a/week5/day5.ipynb
+++ b/week5/day5.ipynb
@@ -50,7 +50,8 @@
"import numpy as np\n",
"import plotly.graph_objects as go\n",
"from langchain.memory import ConversationBufferMemory\n",
- "from langchain.chains import ConversationalRetrievalChain"
+ "from langchain.chains import ConversationalRetrievalChain\n",
+ "from langchain.embeddings import HuggingFaceEmbeddings"
]
},
{
@@ -147,6 +148,10 @@
"\n",
"embeddings = OpenAIEmbeddings()\n",
"\n",
+ "# If you would rather use the free Vector Embeddings from HuggingFace sentence-transformers\n",
+ "# Then uncomment this line instead\n",
+ "# embeddings = HuggingFaceEmbeddings(model_name=\"sentence-transformers/all-MiniLM-L6-v2\")\n",
+ "\n",
"# Delete if already exists\n",
"\n",
"if os.path.exists(db_name):\n",
@@ -289,6 +294,9 @@
"# create a new Chat with OpenAI\n",
"llm = ChatOpenAI(temperature=0.7, model_name=MODEL)\n",
"\n",
+ "# Alternative - if you'd like to use Ollama locally, uncomment this line instead\n",
+ "# llm = ChatOpenAI(temperature=0.7, model_name='llama3.2', base_url='http://localhost:11434/v1', api_key='ollama')\n",
+ "\n",
"# set up the conversation memory for the chat\n",
"memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True)\n",
"\n",
@@ -427,7 +435,7 @@
"metadata": {},
"outputs": [],
"source": [
- "view = gr.ChatInterface(chat).launch()"
+ "view = gr.ChatInterface(chat, type=\"messages\").launch(inbrowser=True)"
]
},
{
@@ -465,7 +473,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week6/day1.ipynb b/week6/day1.ipynb
index 0d50223..c424656 100644
--- a/week6/day1.ipynb
+++ b/week6/day1.ipynb
@@ -419,7 +419,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/agents/messaging_agent.py b/week8/agents/messaging_agent.py
index 70e74d0..7494703 100644
--- a/week8/agents/messaging_agent.py
+++ b/week8/agents/messaging_agent.py
@@ -1,10 +1,11 @@
import os
-from twilio.rest import Client
+# from twilio.rest import Client
from agents.deals import Opportunity
import http.client
import urllib
from agents.agent import Agent
+# Uncomment the Twilio lines if you wish to use Twilio
DO_TEXT = False
DO_PUSH = True
@@ -26,7 +27,7 @@ class MessagingAgent(Agent):
auth_token = os.getenv('TWILIO_AUTH_TOKEN', 'your-auth-if-not-using-env')
self.me_from = os.getenv('TWILIO_FROM', 'your-phone-number-if-not-using-env')
self.me_to = os.getenv('MY_PHONE_NUMBER', 'your-phone-number-if-not-using-env')
- self.client = Client(account_sid, auth_token)
+ # self.client = Client(account_sid, auth_token)
self.log("Messaging Agent has initialized Twilio")
if DO_PUSH:
self.pushover_user = os.getenv('PUSHOVER_USER', 'your-pushover-user-if-not-using-env')
diff --git a/week8/day1.ipynb b/week8/day1.ipynb
index 4e5f0ab..0836b59 100644
--- a/week8/day1.ipynb
+++ b/week8/day1.ipynb
@@ -317,7 +317,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day2.0.ipynb b/week8/day2.0.ipynb
index d93b1f3..27424e6 100644
--- a/week8/day2.0.ipynb
+++ b/week8/day2.0.ipynb
@@ -264,7 +264,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day2.1.ipynb b/week8/day2.1.ipynb
index 0b29b76..fac26d8 100644
--- a/week8/day2.1.ipynb
+++ b/week8/day2.1.ipynb
@@ -174,7 +174,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day2.2.ipynb b/week8/day2.2.ipynb
index 6ef641b..f55ae2a 100644
--- a/week8/day2.2.ipynb
+++ b/week8/day2.2.ipynb
@@ -166,7 +166,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day2.3.ipynb b/week8/day2.3.ipynb
index 5b2b970..bb9a217 100644
--- a/week8/day2.3.ipynb
+++ b/week8/day2.3.ipynb
@@ -391,7 +391,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day2.4.ipynb b/week8/day2.4.ipynb
index 6333ae6..7d357e2 100644
--- a/week8/day2.4.ipynb
+++ b/week8/day2.4.ipynb
@@ -400,7 +400,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day3.ipynb b/week8/day3.ipynb
index 01936d3..9effc96 100644
--- a/week8/day3.ipynb
+++ b/week8/day3.ipynb
@@ -227,7 +227,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day4.ipynb b/week8/day4.ipynb
index 26d6132..4cd5d8f 100644
--- a/week8/day4.ipynb
+++ b/week8/day4.ipynb
@@ -133,7 +133,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/day5.ipynb b/week8/day5.ipynb
index 400a11e..e30130d 100644
--- a/week8/day5.ipynb
+++ b/week8/day5.ipynb
@@ -133,12 +133,32 @@
"And now we'll move to the price_is_right.py code, followed by price_is_right_final.py"
]
},
+ {
+ "cell_type": "markdown",
+ "id": "d783af8a-08a8-4e59-886a-7ca32f16bcf5",
+ "metadata": {},
+ "source": [
+ "# Running the final product\n",
+ "\n",
+ "## Just hit shift + enter in the next cell, and let the deals flow in!!"
+ ]
+ },
{
"cell_type": "code",
"execution_count": null,
"id": "48506465-1c7a-433f-a665-b277a8b4665c",
"metadata": {},
"outputs": [],
+ "source": [
+ "!python price_is_right_final.py"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d468291f-abe2-4fd7-97a6-43c714292973",
+ "metadata": {},
+ "outputs": [],
"source": []
}
],
@@ -158,7 +178,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.11.10"
+ "version": "3.11.11"
}
},
"nbformat": 4,
diff --git a/week8/memory.json b/week8/memory.json
index 2fb4bd1..8705760 100644
--- a/week8/memory.json
+++ b/week8/memory.json
@@ -16,5 +16,23 @@
},
"estimate": 930.8824204895075,
"discount": 225.88242048950747
+ },
+ {
+ "deal": {
+ "product_description": "The Insignia Class F30 Series NS-55F301NA25 is a 55\" 4K HDR UHD Smart TV with a native resolution of 3840x2160. Featuring HDR support, it enhances color and contrast for a more dynamic viewing experience. The TV integrates seamlessly with Amazon Fire TV, working with both Amazon Alexa and Google Home for voice control. It offers three HDMI ports for multiple device connections, making it a perfect entertainment hub for your living space.",
+ "price": 200.0,
+ "url": "https://www.dealnews.com/products/Insignia/Insignia-Class-F30-Series-NS-55-F301-NA25-55-4-K-HDR-LED-UHD-Smart-TV/467523.html?iref=rss-f1912"
+ },
+ "estimate": 669.1921927283588,
+ "discount": 469.1921927283588
+ },
+ {
+ "deal": {
+ "product_description": "The Samsung 27-Cu. Ft. Mega Capacity 3-Door French Door Counter Depth Refrigerator combines style with spacious organization. This model features a dual auto ice maker, which ensures you always have ice on hand, and adjustable shelves that provide versatile storage options for your groceries. Designed with a sleek, fingerprint resistant finish, it not only looks modern but also simplifies cleaning. With its generous capacity, this refrigerator is perfect for large households or those who love to entertain.",
+ "price": 1299.0,
+ "url": "https://www.dealnews.com/products/Samsung/Samsung-27-Cu-Ft-Mega-Capacity-3-Door-French-Door-Counter-Depth-Refrigerator/454702.html?iref=rss-c196"
+ },
+ "estimate": 2081.647127763905,
+ "discount": 782.6471277639048
}
]
\ No newline at end of file
| | | |