From the uDemy course on LLM engineering.
https://www.udemy.com/course/llm-engineering-master-ai-and-large-language-models
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1004 B
30 lines
1004 B
import modal |
|
from agents.agent import Agent |
|
|
|
|
|
class SpecialistAgent(Agent): |
|
""" |
|
An Agent that runs our fine-tuned LLM that's running remotely on Modal |
|
""" |
|
|
|
name = "Specialist Agent" |
|
color = Agent.RED |
|
|
|
def __init__(self): |
|
""" |
|
Set up this Agent by creating an instance of the modal class |
|
""" |
|
self.log("Specialist Agent is initializing - connecting to modal") |
|
#DEL: Pricer = modal.Cls.lookup("pricer-service", "Pricer") |
|
Pricer = modal.Cls.from_name("pricer-service", "Pricer") |
|
self.pricer = Pricer() |
|
self.log("Specialist Agent is ready") |
|
|
|
def price(self, description: str) -> float: |
|
""" |
|
Make a remote call to return the estimate of the price of this item |
|
""" |
|
self.log("Specialist Agent is calling remote fine-tuned model") |
|
result = self.pricer.price.remote(description) |
|
self.log(f"Specialist Agent completed - predicting ${result:.2f}") |
|
return result
|
|
|