Add week8 contributions

This commit is contained in:
lisekarimi
2025-06-05 16:42:02 +02:00
parent 5782ca2b43
commit 141216e8f7
13 changed files with 12066 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
import modal
from agents.base_agent import Agent
class FTPriceAgent(Agent):
"""
An Agent that runs the fine-tuned LLM that's running remotely on Modal
"""
name = "FTPrice Agent"
color = Agent.RED
def __init__(self):
"""
Set up this Agent by creating an instance of the modal class
"""
self.log("FTPrice Agent is initializing - connecting to modal")
Pricer = modal.Cls.from_name("llm-ft-pricer", "Pricer") # 1st API call: to fetch Pricer (remote class)
self.pricer = Pricer()
self.log("FTPrice 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("FTPrice Agent is calling remote fine-tuned model")
result = self.pricer.price.remote(description) # 2nd API call: to run the price method in the remote Pricer class
self.log(f"FTPrice Agent completed - predicting ${result:.2f}")
return result