微信扫码
添加专属顾问
我要投稿
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-06-11
撒娇、威胁对大模型都没用?顶级科研团队2000次实验,14种常用prompt技巧谁是强神谁是狼!撬动大模型能力杠杆,秘诀都在这了
2025-06-10
沃顿商学院重磅Prompt报告:别再对AI"循循善诱"了!我们在错误地使用它!
2025-06-08
一年前的提示词技巧已经落伍了?Anthropic CPO 揭秘7个AI协作新玩法
2025-06-08
从“一句话需求”到“专家级指令”:手把手教你用 Prompt 搞定高考作文
2025-06-07
写 Prompt 真的好难?你只是没用对方法—— AI提示词通关指南
2025-06-05
AI 提示工程秘籍?程序员真正需要的其实只有这三招!
2025-06-04
一句提示词,把普普通通的markdown文档变成精美PPT
2025-06-02
你还在随便写提示词?顶级AI公司的“提示词秘笈”告诉你:这事没那么简单!
2025-03-17
2025-03-22
2025-03-25
2025-03-17
2025-05-09
2025-03-22
2025-06-02
2025-03-31
2025-04-07
2025-05-25
2025-04-21
2025-03-31
2025-03-29
2025-03-17
2025-02-06
2025-01-10
2024-12-25
2024-11-20