Updated modal with API changes - thank you to student Sayak
This commit is contained in:
@@ -15,7 +15,7 @@ class SpecialistAgent(Agent):
|
|||||||
Set up this Agent by creating an instance of the modal class
|
Set up this Agent by creating an instance of the modal class
|
||||||
"""
|
"""
|
||||||
self.log("Specialist Agent is initializing - connecting to modal")
|
self.log("Specialist Agent is initializing - connecting to modal")
|
||||||
Pricer = modal.Cls.lookup("pricer-service", "Pricer")
|
Pricer = modal.Cls.from_name("pricer-service", "Pricer")
|
||||||
self.pricer = Pricer()
|
self.pricer = Pricer()
|
||||||
self.log("Specialist Agent is ready")
|
self.log("Specialist Agent is ready")
|
||||||
|
|
||||||
|
|||||||
@@ -185,6 +185,9 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"# This import may give a deprecation warning about adding local Python modules to the Image\n",
|
||||||
|
"# That warning can be safely ignored. You may get the same warning in other places, too..\n",
|
||||||
|
"\n",
|
||||||
"from llama import app, generate"
|
"from llama import app, generate"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -259,7 +262,8 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"!modal deploy pricer_service"
|
"# You can also run \"modal deploy -m pricer_service\" at the command line in an activated environment\n",
|
||||||
|
"!modal deploy -m pricer_service"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -269,7 +273,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"pricer = modal.Function.lookup(\"pricer-service\", \"price\")"
|
"pricer = modal.Function.from_name(\"pricer-service\", \"price\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -279,6 +283,8 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
|
"# This can take a while! We'll use faster approaches shortly\n",
|
||||||
|
"\n",
|
||||||
"pricer.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")"
|
"pricer.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -290,6 +296,7 @@
|
|||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"# You can also run \"modal deploy -m pricer_service2\" at the command line in an activated environment\n",
|
"# You can also run \"modal deploy -m pricer_service2\" at the command line in an activated environment\n",
|
||||||
|
"\n",
|
||||||
"!modal deploy -m pricer_service2"
|
"!modal deploy -m pricer_service2"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -300,22 +307,12 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"Pricer = modal.Cls.lookup(\"pricer-service\", \"Pricer\")\n",
|
"Pricer = modal.Cls.from_name(\"pricer-service\", \"Pricer\")\n",
|
||||||
"pricer = Pricer()\n",
|
"pricer = Pricer()\n",
|
||||||
"reply = pricer.price.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")\n",
|
"reply = pricer.price.remote(\"Quadcast HyperX condenser mic, connects via usb-c to your computer for crystal clear audio\")\n",
|
||||||
"print(reply)"
|
"print(reply)"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "c29b8c58-4cb7-44b0-ab7e-6469d3a318e8",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"!pip install --upgrade modal"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"id": "9c1b1451-6249-4462-bf2d-5937c059926c",
|
"id": "9c1b1451-6249-4462-bf2d-5937c059926c",
|
||||||
@@ -390,7 +387,7 @@
|
|||||||
"name": "python",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.11.11"
|
"version": "3.11.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"nbformat": 4,
|
"nbformat": 4,
|
||||||
|
|||||||
Reference in New Issue
Block a user