from agent import Glm, KeyWordPrompt class Agent: _instance = None def __new__(cls): if not cls._instance: cls._instance = super(Agent, cls).__new__(cls) cls._instance._initialized = False return cls._instance def __init__(self): if not self._initialized: self.glm = Glm() self._initialized = True def brand_key_word_judgement(self, brandname, title): self.glm.set_modelname("glm-4-plus") prompt = KeyWordPrompt.EXTRACT_INFO_FROM_TITLE + f""" 请根据上述逻辑,分析以下商品标题,并输出结果: 商品标题:{brandname} 给定的引流品牌:{title}""" response = self.glm.text_response(prompt) return response.content if __name__ == "__main__": agent = Agent() agent.brand_key_word_judgement("【防泼水】荷叶风衣连帽加绒外套防风外套保暖户外运动服女外套", "李宁")