微信扫码
添加专属顾问
我要投稿
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-05-27
AI 新闻小助手 100% 纯提示词实践
2025-05-26
驯服 AI 代理:Google研究员提出11 个让它更聪明的提示技巧
2025-05-25
Augment官方:11种提示词技巧,打造更出色的AI编程智能体
2025-05-24
我用Dify把飞书表格的「AI提示词库」打包成了MCP Server给AI使用和管理
2025-05-23
人力资源提示词:培训开班讲话稿
2025-05-21
让 AI 更懂你的需求!一文看懂如何在 Trae IDE 中巧用上下文
2025-05-19
90%的人写不好提示词,都是因为踩了这三个坑!
2025-05-19
智能即压缩。但prompt能力的关键,是敢于啰嗦。
2025-02-01
2024-09-18
2025-01-08
2024-08-23
2024-07-26
2025-01-17
2024-12-26
2024-08-23
2024-07-02
2024-10-17
2025-04-21
2025-03-31
2025-03-29
2025-03-17
2025-02-06
2025-01-10
2024-12-25
2024-11-20