微信扫码
添加专属顾问
我要投稿
01。
概述
02。
安装使用
安装
pip install prompt-poet
基础使用
import os
import getpass
from prompt_poet import Prompt
from langchain import ChatOpenAI
# Uncomment if you need to set OPENAI_API_KEY.
# os.environ["OPENAI_API_KEY"] = getpass.getpass()
raw_template = """
- name: system instructions
role: system
content: |
Your name is {{ character_name }} and you are meant to be helpful and never harmful to humans.
- name: user query
role: user
content: |
{{ username}}: {{ user_query }}
- name: response
role: user
content: |
{{ character_name }}:
"""
template_data = {
"character_name": "Character Assistant",
"username": "Jeff",
"user_query": "Can you help me with my homework?"
}
prompt = Prompt(
raw_template=raw_template,
template_data=template_data
)
model = ChatOpenAI(model="gpt-4o-mini")
response = model.invoke(prompt.messages)
03。
Prompt 模板
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费POC验证,效果达标后再合作。零风险落地应用大模型,已交付160+中大型企业
2025-12-31
面向生产环境的 LLM Prompt 优化:缓存、结构、自动优化与基准测试
2025-12-31
AI快速搭建web自动化测试项目实践
2025-12-31
别再纠结用 Skill 还是 Subagent 了,这一篇讲透 Claude Code 的「分身术」
2025-12-30
你的AI总是答非所问?试试这个被99%的人忽略的提示词技巧
2025-12-30
Anthropic 官方最简单的一个 skill,确藏着最高级的提示词技巧
2025-12-29
Prompt 里的那个 `{}`,可能是你系统的最大漏洞,别把用户输入直接拼进 Prompt
2025-12-28
从零开始的Claude Skill 实操指南:手把手教你使用Claude Skills
2025-12-27
让 Claude Code Skills 100%生效的NB技巧
2025-10-09
2025-11-14
2025-10-21
2025-10-13
2025-12-03
2025-12-17
2025-10-30
2025-11-09
2025-11-27
2025-11-30
2025-12-22
2025-12-14
2025-12-03
2025-12-02
2025-11-29
2025-09-05
2025-08-25
2025-06-17