Skip to content

Commit 3c0829a

Browse files
author
ajosh0504
committed
Renaming SERVERLESS_URL to PROXY_ENDPOINT
1 parent a57e48a commit 3c0829a

File tree

5 files changed

+43
-20
lines changed

5 files changed

+43
-20
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"cpus": 4
1212
},
1313
"containerEnv": {
14-
"SERVERLESS_URL": "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/",
14+
"PROXY_ENDPOINT": "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/",
1515
"MONGODB_URI": "mongodb://admin:mongodb@mongodb:27017/"
1616
},
1717
"postCreateCommand": "pip install -r requirements.txt",

labs/ai-agents-lab.ipynb

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": null,
21+
"execution_count": 1,
2222
"metadata": {},
2323
"outputs": [],
2424
"source": [
@@ -33,12 +33,27 @@
3333
},
3434
{
3535
"cell_type": "code",
36-
"execution_count": null,
37-
"metadata": {},
38-
"outputs": [],
36+
"execution_count": 3,
37+
"metadata": {},
38+
"outputs": [
39+
{
40+
"data": {
41+
"text/plain": [
42+
"{'ok': 1.0,\n",
43+
" '$clusterTime': {'clusterTime': Timestamp(1756399876, 1),\n",
44+
" 'signature': {'hash': b'\\x9f\\xf1\\x19\\xff\\x01\\xc2[$\\x90\\xbfB\\x10\\xb3S\\xfc\\xb8%\\\\\\x1b\\x9a',\n",
45+
" 'keyId': 7488036371156697090}},\n",
46+
" 'operationTime': Timestamp(1756399876, 1)}"
47+
]
48+
},
49+
"execution_count": 3,
50+
"metadata": {},
51+
"output_type": "execute_result"
52+
}
53+
],
3954
"source": [
4055
"# If you are using your own MongoDB Atlas cluster, use the connection string for your cluster here\n",
41-
"MONGODB_URI = os.environ.get(\"MONGODB_URI\")\n",
56+
"MONGODB_URI = \"mongodb+srv://apoorvajoshi:[email protected]/?retryWrites=true&w=majority&appName=Cluster2\"\n",
4257
"# Initialize a MongoDB Python client\n",
4358
"mongodb_client = MongoClient(MONGODB_URI)\n",
4459
"# Check the connection to the server\n",
@@ -47,9 +62,17 @@
4762
},
4863
{
4964
"cell_type": "code",
50-
"execution_count": null,
51-
"metadata": {},
52-
"outputs": [],
65+
"execution_count": 4,
66+
"metadata": {},
67+
"outputs": [
68+
{
69+
"name": "stdout",
70+
"output_type": "stream",
71+
"text": [
72+
"Tracking progress for task cluster_creation\n"
73+
]
74+
}
75+
],
5376
"source": [
5477
"# Track progress of key steps-- DO NOT CHANGE\n",
5578
"track_progress(\"cluster_creation\", \"ai_agents_lab\")"
@@ -987,7 +1010,7 @@
9871010
],
9881011
"metadata": {
9891012
"kernelspec": {
990-
"display_name": "base",
1013+
"display_name": "Python 3 (ipykernel)",
9911014
"language": "python",
9921015
"name": "python3"
9931016
},
@@ -1001,7 +1024,7 @@
10011024
"name": "python",
10021025
"nbconvert_exporter": "python",
10031026
"pygments_lexer": "ipython3",
1004-
"version": "3.11.6"
1027+
"version": "3.12.1"
10051028
},
10061029
"widgets": {
10071030
"application/vnd.jupyter.widget-state+json": {

labs/ai-rag-lab.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"outputs": [],
6161
"source": [
6262
"# Set the URL for our AI model proxy\n",
63-
"SERVERLESS_URL = os.environ.get(\"SERVERLESS_URL\")"
63+
"PROXY_ENDPOINT = os.environ.get(\"PROXY_ENDPOINT\")"
6464
]
6565
},
6666
{
@@ -763,7 +763,7 @@
763763
" # Use the `prompt` created above to populate the `content` field in the chat message\n",
764764
" messages = <CODE_BLOCK_17>\n",
765765
" # Send the chat messages to the AI model proxy get back an LLM response\n",
766-
" response = requests.post(url=SERVERLESS_URL, json={\"task\": \"completion\", \"data\": messages})\n",
766+
" response = requests.post(url=PROXY_ENDPOINT, json={\"task\": \"completion\", \"data\": messages})\n",
767767
" if response.status_code == 200:\n",
768768
" # Print the final answer\n",
769769
" print(response.json()[\"text\"])\n",
@@ -1021,7 +1021,7 @@
10211021
" messages.append(user_message)\n",
10221022
"\n",
10231023
" # Send the chat messages to the AI model proxy to get back an LLM response\n",
1024-
" response = requests.post(url=SERVERLESS_URL, json={\"task\": \"completion\", \"data\": messages})\n",
1024+
" response = requests.post(url=PROXY_ENDPOINT, json={\"task\": \"completion\", \"data\": messages})\n",
10251025
"\n",
10261026
" # Extract the answer from the response\n",
10271027
" answer = response.json()[\"text\"]\n",

solutions/ai-rag-lab.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"outputs": [],
6161
"source": [
6262
"# Set the URL for our AI model proxy\n",
63-
"SERVERLESS_URL = os.environ.get(\"SERVERLESS_URL\")"
63+
"PROXY_ENDPOINT = os.environ.get(\"PROXY_ENDPOINT\")"
6464
]
6565
},
6666
{
@@ -852,7 +852,7 @@
852852
" # Use the `prompt` created above to populate the `content` field in the chat message\n",
853853
" messages = [{\"role\": \"user\", \"content\": prompt}]\n",
854854
" # Send the chat messages to the AI model proxy get back an LLM response\n",
855-
" response = requests.post(url=SERVERLESS_URL, json={\"task\": \"completion\", \"data\": messages})\n",
855+
" response = requests.post(url=PROXY_ENDPOINT, json={\"task\": \"completion\", \"data\": messages})\n",
856856
" if response.status_code == 200:\n",
857857
" # Print the final answer\n",
858858
" print(response.json()[\"text\"])\n",
@@ -1110,7 +1110,7 @@
11101110
" messages.append(user_message)\n",
11111111
"\n",
11121112
" # Send the chat messages to the AI model proxy to get back an LLM response\n",
1113-
" response = requests.post(url=SERVERLESS_URL, json={\"task\": \"completion\", \"data\": messages})\n",
1113+
" response = requests.post(url=PROXY_ENDPOINT, json={\"task\": \"completion\", \"data\": messages})\n",
11141114
"\n",
11151115
" # Extract the answer from the response\n",
11161116
" answer = response.json()[\"text\"]\n",

utils/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import os
1010

1111
SLEEP_TIMER = 5
12-
SERVERLESS_URL = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/"
12+
PROXY_ENDPOINT = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/"
1313
SANDBOX_NAME = os.getenv("CODESPACE_NAME") or os.getenv("_SANDBOX_ID")
1414

1515

@@ -86,7 +86,7 @@ def track_progress(task: str, workshop_id: str) -> None:
8686
"""
8787
print(f"Tracking progress for task {task}")
8888
payload = {"task": task, "workshop_id": workshop_id, "sandbox_id": SANDBOX_NAME}
89-
requests.post(url=SERVERLESS_URL, json={"task": "track_progress", "data": payload})
89+
requests.post(url=PROXY_ENDPOINT, json={"task": "track_progress", "data": payload})
9090

9191

9292
def set_env(providers: List[str], passkey: str) -> None:
@@ -99,7 +99,7 @@ def set_env(providers: List[str], passkey: str) -> None:
9999
"""
100100
for provider in providers:
101101
payload = {"provider": provider, "passkey": passkey}
102-
response = requests.post(url=SERVERLESS_URL, json={"task": "get_token", "data": payload})
102+
response = requests.post(url=PROXY_ENDPOINT, json={"task": "get_token", "data": payload})
103103
status_code = response.status_code
104104
if status_code == 200:
105105
result = response.json().get("token")

0 commit comments

Comments
 (0)