prompt-poet 参考使用
主要是一个简单的功能体验,包含了include 以及简单的jinja2 逻辑判断
模版定义
- app.yaml.j2
{% include 'system_instruction.yml.j2' %}
- name: system demo
role: system
content: |
you are a system user
{% if username =="dalong" %}
- name: system audio
role: system
content: |
you are a system audio user
{% endif %}
- system_instruction.yml.j2
- name: system demo
role: system
content: |
demo contents
- 应用使用
from prompt_poet import Prompt
template_data = {
"character_name": "Character Assistant",
"username": "dalong",
}
prompt = Prompt(
template_path="app.yaml.j2",
template_data=template_data
)
print(prompt.messages)
- 效果
说明
基于prompt-poet的提示词模版管理机制上还是比较灵活的,值得尝试下,同时还提供了一个模版registry 的功能,后边可以详细研究下源码
参考资料
https://github.com/character-ai/prompt-poet/issues/18
https://github.com/character-ai/prompt-poet
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2020-09-29 QRGen 一个灵活简单的java 二维码生成jar 包
2020-09-29 token模式请求图片资源
2020-09-29 扩展自定义spring boot prometheus metrics
2020-09-29 Managing PostgreSQL users and roles
2019-09-29 Cortex Architecture
2019-09-29 cortex 水平扩展试用
2019-09-29 cortex 基本试用