Skip to content

Commit f13200a

Browse files
committed
Update to use Voyage
1 parent a5a0e2a commit f13200a

File tree

8 files changed

+2235
-2033
lines changed

8 files changed

+2235
-2033
lines changed

notebooks/ai-agents-lab.ipynb

Lines changed: 1012 additions & 984 deletions
Large diffs are not rendered by default.

notebooks/langgraph_basics_agents.ipynb

Lines changed: 50 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,27 @@
3434
"cell_type": "code",
3535
"execution_count": 1,
3636
"metadata": {},
37-
"outputs": [],
38-
"source": [
39-
"import os, json\n",
40-
"from pymongo import MongoClient"
37+
"outputs": [
38+
{
39+
"ename": "ModuleNotFoundError",
40+
"evalue": "No module named 'pymongo'",
41+
"output_type": "error",
42+
"traceback": [
43+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
44+
"\u001b[31mModuleNotFoundError\u001b[39m Traceback (most recent call last)",
45+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[1]\u001b[39m\u001b[32m, line 3\u001b[39m\n\u001b[32m 1\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mos\u001b[39;00m\n\u001b[32m 2\u001b[39m \u001b[38;5;28;01mimport\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01msys\u001b[39;00m\n\u001b[32m----> \u001b[39m\u001b[32m3\u001b[39m \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01mpymongo\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[38;5;28;01mimport\u001b[39;00m MongoClient\n\u001b[32m 5\u001b[39m \u001b[38;5;66;03m# Add parent directory to path to import from utils\u001b[39;00m\n\u001b[32m 6\u001b[39m sys.path.append(os.path.join(os.path.dirname(os.getcwd())))\n",
46+
"\u001b[31mModuleNotFoundError\u001b[39m: No module named 'pymongo'"
47+
]
48+
}
49+
],
50+
"source": [
51+
"import os\n",
52+
"import sys\n",
53+
"from pymongo import MongoClient\n",
54+
"\n",
55+
"# Add parent directory to path to import from utils\n",
56+
"sys.path.append(os.path.join(os.path.dirname(os.getcwd())))\n",
57+
"from utils import track_progress, set_env"
4158
]
4259
},
4360
{
@@ -47,13 +64,35 @@
4764
"outputs": [],
4865
"source": [
4966
"# If you are using your own MongoDB Atlas cluster, use the connection string for your cluster here\n",
50-
"MONGODB_URI = os.environ.get(\"MONGODB_URI\")\n",
67+
"MONGODB_URI = os.environ.get(\"MONGODB_URI\")\n",
5168
"# Initialize a MongoDB Python client\n",
5269
"mongodb_client = MongoClient(MONGODB_URI)\n",
5370
"# Check the connection to the server\n",
5471
"mongodb_client.admin.command(\"ping\")"
5572
]
5673
},
74+
{
75+
"cell_type": "code",
76+
"execution_count": null,
77+
"metadata": {},
78+
"outputs": [],
79+
"source": [
80+
"# Set the LLM provider and passkey provided by your workshop instructor\n",
81+
"# NOTE: LLM_PROVIDER can be set to one of \"aws\"/ \"microsoft\" / \"google\"\n",
82+
"LLM_PROVIDER = \"aws\"\n",
83+
"PASSKEY = \"replace-with-passkey\""
84+
]
85+
},
86+
{
87+
"cell_type": "code",
88+
"execution_count": null,
89+
"metadata": {},
90+
"outputs": [],
91+
"source": [
92+
"# Obtain API keys from our AI model proxy and set them as environment variables-- DO NOT CHANGE\n",
93+
"set_env([LLM_PROVIDER,\"voyageai\"], PASSKEY)"
94+
]
95+
},
5796
{
5897
"cell_type": "markdown",
5998
"metadata": {},
@@ -106,31 +145,18 @@
106145
"### Pick an LLM provider of your choice below"
107146
]
108147
},
109-
{
110-
"cell_type": "code",
111-
"execution_count": 6,
112-
"metadata": {},
113-
"outputs": [],
114-
"source": [
115-
"SERVERLESS_URL = os.environ.get(\"SERVERLESS_URL\")\n",
116-
"# Can be one of \"aws\", \"google\" or \"microsoft\"\n",
117-
"LLM_PROVIDER = \"aws\""
118-
]
119-
},
120148
{
121149
"cell_type": "code",
122150
"execution_count": null,
123151
"metadata": {},
124152
"outputs": [],
125153
"source": [
126154
"from langchain_core.load import load\n",
127-
"import requests\n",
155+
"from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
156+
"from utils import get_llm\n",
128157
"\n",
129-
"# Obtain the Langchain LLM object from our serverless endpoint\n",
130-
"llm_dict = requests.post(\n",
131-
" url=SERVERLESS_URL, json={\"task\": \"get_llm\", \"data\": LLM_PROVIDER}\n",
132-
").json()\n",
133-
"llm = load(llm_dict[\"llm\"], secrets_map=llm_dict[\"secrets_map\"])"
158+
"# Obtain the Langchain LLM object using the `get_llm` function from the `utils`` module.\n",
159+
"llm = get_llm(LLM_PROVIDER)"
134160
]
135161
},
136162
{
@@ -1741,7 +1767,7 @@
17411767
],
17421768
"metadata": {
17431769
"kernelspec": {
1744-
"display_name": "venv",
1770+
"display_name": "Python 3",
17451771
"language": "python",
17461772
"name": "python3"
17471773
},
@@ -1755,7 +1781,7 @@
17551781
"name": "python",
17561782
"nbconvert_exporter": "python",
17571783
"pygments_lexer": "ipython3",
1758-
"version": "3.11.11"
1784+
"version": "3.11.6"
17591785
}
17601786
},
17611787
"nbformat": 4,

notebooks/utils/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

notebooks/utils/utils.py

Lines changed: 0 additions & 84 deletions
This file was deleted.

0 commit comments

Comments
 (0)