Fixed Google Colab link in week 3 day 4, and latest week 8 updates
This commit is contained in:
151
week8_wip/day4.ipynb
Normal file
151
week8_wip/day4.ipynb
Normal file
@@ -0,0 +1,151 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "80d683d9-9e92-44ae-af87-a413ca84db21",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import os\n",
|
||||
"from twilio.rest import Client\n",
|
||||
"from dotenv import load_dotenv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "5ba769cc-5301-4810-b01f-cab584cfb3b3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"load_dotenv()\n",
|
||||
"os.environ['TWILIO_ACCOUNT_SID'] = os.getenv('TWILIO_ACCOUNT_SID', 'your-sid-if-not-using-env')\n",
|
||||
"os.environ['TWILIO_AUTH_TOKEN'] = os.getenv('TWILIO_AUTH_TOKEN', 'your-auth-if-not-using-env')\n",
|
||||
"os.environ['MY_PHONE_NUMBER'] = os.getenv('MY_PHONE_NUMBER', 'your-phone-if-not-using-env')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "761e6460-d201-4f69-ba31-a641a059e47d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"ME_FROM = 'whatsapp:+14155238886'\n",
|
||||
"ME_TO = f\"whatsapp:+1{os.environ['MY_PHONE_NUMBER']}\""
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "f77f8b08-6c92-47e2-9dd0-3ddaf01beb07",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"account_sid = os.environ['TWILIO_ACCOUNT_SID']\n",
|
||||
"auth_token = os.environ['TWILIO_AUTH_TOKEN']\n",
|
||||
"client = Client(account_sid, auth_token)\n",
|
||||
"\n",
|
||||
"message = client.messages.create(\n",
|
||||
" from_=ME_FROM,\n",
|
||||
" body='hello, me!',\n",
|
||||
" to=ME_TO\n",
|
||||
")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6794a7de-352f-46d2-8451-ff79c9654b31",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from agents.messaging_agent import MessagingAgent"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "e05cc427-3d2c-4792-ade1-d356f95a82a9",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"agent = MessagingAgent()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "5ec518f5-dae4-44b1-a185-d7eaf853ec00",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"agent.message(\"Hi!!\")"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "57b3a014-0b15-425a-a29b-6fefc5006dee",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"import chromadb\n",
|
||||
"DB = \"products_vectorstore\"\n",
|
||||
"client = chromadb.PersistentClient(path=DB)\n",
|
||||
"collection = client.get_or_create_collection('products')\n",
|
||||
"from agents.planning_agent import PlanningAgent"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a5c31c39-e357-446e-9cec-b4775c298941",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"planner = PlanningAgent(collection)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "d9ac771b-ea12-41c0-a7ce-05f12e27ad9e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"planner.plan()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "70200a3c-64fb-4c34-bdd8-57aaf009ec60",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3 (ipykernel)",
|
||||
"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.11.10"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user