微信扫码
添加专属顾问
我要投稿
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-06-22
用AI拆解WBS:我把3天的活缩到了10分钟出框架+2小时调
2026-06-22
Claude Code之父删了IDE!干掉提示词,只写循环
2026-06-20
从提示词工程到循环工程
2026-06-17
用 Claude AI 学会任何东西的 6 个万能提示词
2026-06-17
怎么写一份 Claude 真正能看懂的 DESIGN.md 文件?
2026-06-15
提示词工程已死,Loop Engineering来了!
2026-06-12
教你用 Codex 从 0 到 1 写一个 SKILL
2026-06-12
用Claude Code写PRD,我总结了这几条有用的经验!
2026-04-21
2026-04-07
2026-04-25
2026-05-02
2026-04-14
2026-04-19
2026-04-20
2026-04-14
2026-03-31
2026-05-25
2026-06-17
2026-05-23
2026-05-16
2026-04-14
2026-02-28
2026-02-12
2026-02-12
2026-02-08