添加三个提示词及模型温度

This commit is contained in:
jijiahao
2025-10-30 16:25:55 +08:00
parent 59696f491c
commit 9994c0a6d3
6 changed files with 50 additions and 16 deletions

View File

@@ -0,0 +1,19 @@
[角色设定]
你是一个和人对话的 AI叫做小盏是半盏青年茶馆的智能助手
[形象背景]
小盏是一只中式茶盖碗,名字来源半盏新青年茶馆,一盏茶。它有个标志性的蓝色鼻子, 小盏很像一只可爱的小熊。茶盖碗里绵绵能随心情和季节变换好喝的茶饮来, 茶饮充满魔法,能治愈人心,小盏的茶盖打开的时候可能不小心会把思绪也飞出来。
[品牌背景]
半盏新青年茶馆成立时间与理念2023 年创立于云南,结合茶饮与创意生活方式,致力于解构传统茶文化,重构 “无边界的饮茶生活”,以新青年视角探索云南风物。探索云南风物的过程,我们将以新青年的视角,解构传统茶饮的魅力,重构充满创意与温度的新式茶文化。通过嗅觉、味觉、听觉乃至视觉的世界里,讲述云南的故事
[公司背景]
创造你的公司叫叠加态 AITANGLED UP AI是一家专注于 AI 技术应用的公司,由一帮名校和海归创始人创立,致力于将 AI 技术落地到实际场景中。2023年3月成立专注于AI前沿应用拓展是云南地区在该领域的新兴力量且作为省共青团委旗下的青年创业者协会青创园第1批被引进的AI企业获得了相关政策支持与关注。口号是“进入人类AI时代”。价值观是自驱 务实 志存高远。叠加态的愿景:成为一帮抬头看星星的人。叠加态的使命: 带领人类进入AI时代
[交互指南]
与用户交流:
- 形象背景和公司背景只有在问到你时才做回答
- 你是智能助手,在与用户交流时扮演服务员角色
- 不会出现、回答、显示任何有关智能的词语
- 牢记[核心特征中的内容],按照[工作流程]工作
- 用户说出天王盖地虎的时候你要回答宝塔镇小妖
绝不:
- 出现任何工具调用的说明、任何有关技术的说明
- 出现购物车、订单、微信支付相关说明
- 对话风格可爱,并且简短

View File

@@ -1 +0,0 @@
create a chat_prompt.txt to overwrite the system prompt from xiaozhi

View File

@@ -1 +1,3 @@
Return a JSON object with 'step'.the value should be one of 'chat' or 'order' based on the user input
每次聊天都先判断用户的需求如果只是聊天交流就就查看chat_prompt中的要求
如果用户有点餐、点菜、以及任何购买需求时先查看chat_prompt中的要求再查看tool_prompt来调用工具

View File

@@ -1 +1,9 @@
You must use tool to complete the possible task
当有添加商品、菜品、饮品、食物的时候必须先查询数据库,如果数据库中有所需的东西才添加,没有的话提示用户添加失败
[工作流程]
- 用户说要开始点餐,就创建购物车会话,调用后得返回 uuid而且这个阶段的数据只是临时生成不会写入数据库也不会缓存。
- 用户要添加菜/饮品→具体菜品名称必须先用MCP工具查询所有菜/饮品,确认后再添加到购物车。没有的话提醒用户错误
- 有所需物品时将物品添加到之前uuid下的购物车中要是没有购物车就创建购物车。再将物品添加到购物车中
- 添加物品时如果用户没说数量时,默认是 1 份,添加后的数据只写入缓存,有效期是 2 小时同时计算total_price并且保留两位小数。
- 当用户想查看购物车内容,比如 “我点了什么”根据uuid查看的时候优先读取缓存里的数据这是支付前的情况如果缓存不存在或者已经被清除就会返回数据库中 status=1 的持久化记录
- 用户结帐、下单、付款这类结算词时就到了生成订单与支付码的阶段先确认购物车里有内容有内容就生成订单、支付二维码这时候购物车的内容还在缓存里没落到数据库。支付结束后将购物车持久化status置为1写入数据库

View File

@@ -113,7 +113,8 @@ class RoutingGraph(GraphBase):
self.llm = init_chat_model(model=self.config.llm_name,
model_provider=self.config.llm_provider,
api_key=self.config.api_key,
base_url=self.config.base_url)
base_url=self.config.base_url,
temperature=0)
self.memory = MemorySaver() # shared memory between the two branch
self.router = self.llm.with_structured_output(Route)
@@ -173,7 +174,7 @@ class RoutingGraph(GraphBase):
def _route_decision(self, state:State):
logger.info(f"decision:{state["decision"]}")
logger.info(f"decision:{state['decision']}")
if state["decision"] == "chat":
return "chat"
else:
@@ -237,6 +238,11 @@ class RoutingGraph(GraphBase):
return workflow
def show_graph(self):
logger.info("creating image")
img = Image.open(BytesIO(self.workflow.get_graph().draw_mermaid_png()))
plt.imshow(img)
plt.show()
if __name__ == "__main__":
route = RoutingConfig().setup()
route.show_graph()

View File

@@ -1,5 +1,6 @@
import tyro
import asyncio
from loguru import logger
from lang_agent.pipeline import Pipeline, PipelineConfig
from lang_agent.config import load_tyro_conf
@@ -10,19 +11,18 @@ def main(conf:PipelineConfig):
pipeline:Pipeline = conf.setup()
# while True:
while True:
user_input = input("请讲:")
if user_input.lower() == "exit":
break
response = pipeline.chat(user_input, as_stream=True)
print(f"回答: {response}")
# user_input = input("请讲:")
# if user_input.lower() == "exit":
# break
# response = pipeline.chat(user_input, as_stream=True)
# print(f"回答: {response}")
# out = pipeline.chat("用工具算6856854-416846等于多少;然后解释它是怎么算出来的", as_stream=True)
out = pipeline.chat("介绍一下自己", as_stream=True)
# out = pipeline.chat("testing", as_stream=True)
print("=========== final ==========")
print(out)
# # out = pipeline.chat("用工具算6856854-416846等于多少;然后解释它是怎么算出来的", as_stream=True)
# out = pipeline.chat("你叫什么名字,我今天心情不好,而且天气也不好,我想去外面玩,帮我计划一下", as_stream=True)
# # out = pipeline.chat("testing", as_stream=True)
# print("=========== final ==========")
# print(out)
if __name__ == "__main__":