微信扫码
添加专属顾问
我要投稿
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+中大型企业
2026-02-05
当AI能替你干活,什么能力决定你不可替代?
2026-02-03
Claude Code 创始人亲授:10 条进阶秘籍(附 12 条工作流 Prompt 清单)
2026-01-31
全网首发!一张通往“人类禁区”的船票,手把手教你把 AI 送进 Moltbook
2026-01-30
ESLint创始人揭秘:用AI角色扮演编程,效率飙升
2026-01-30
谷歌官方推出!10 个 Gem 提示词,附详细Gem自律助手创建流程
2026-01-30
Skill手搓“自动化PPT神器”,不写一行代码
2026-01-29
简单的AGENTS.md竟然完胜复杂Skills,Vercel实测
2026-01-25
Claude Code 最佳实践:50 个实用技巧
2025-11-14
2025-12-03
2025-12-26
2025-12-17
2026-01-18
2025-11-27
2025-11-09
2026-01-04
2025-11-30
2026-01-07
2026-02-05
2026-01-21
2026-01-16
2026-01-13
2026-01-05
2025-12-22
2025-12-14
2025-12-03