from shopfront_agent.shop_kb import ShopfrontKB from shopfront_agent.openai_module import OpenAIClient import os import json class ShopfrontAgentTools: def __init__(self, openai_api_key=None): self.kb = ShopfrontKB() self.llm = OpenAIClient(api_key=openai_api_key or os.getenv("OPENAI_API_KEY")) def generate_layout_plan(self, niche: str) -> str: prompt = f""" User Niche: {niche} Knowledge Base Components: {json.dumps(self.kb.get_all_components(), indent=2)} Please propose a high-level shopfront layout plan for this niche. Focus on how the components should be arranged to maximize conversion and engagement for {niche}. """ return self.llm.chat(prompt) def audit_shopfront(self, description: str) -> str: prompt = f""" Shopfront Description: {description} UX Patterns: {json.dumps(self.kb.ux_patterns, indent=2)} SEO Best Practices: {json.dumps(self.kb.seo_best_practices, indent=2)} Please perform an expert audit of this shopfront description. Identify strengths, weaknesses, and provide 3 high-impact improvement suggestions. """ return self.llm.chat(prompt)