大语言模型提示模板与输出解析的深度探索
1. 提示模板预览与示例选择
1.1 预览格式化模板
我们可以通过以下代码预览格式化模板:
print(prompt.format(input="What is the capital of Australia?"))
输出示例如下:
Question: What is the largest planet in our solar system?
Answer: Jupiter is the largest planet in our solar system.
Question: Who painted the Mona Lisa?
Answer: The Mona Lisa was painted by Leonardo da Vinci.
Question: What is the currency of Japan?
Answer: The currency of Japan is the Japanese yen.
Question: What is the capital of Australia?
1.2 示例选择器(可选步骤)
当有大量示例时,可以使用示例选择器。以下代码初始化了一个基于长度的示例选择器 LengthBasedExampleSelector :
from langchain.prompts impor
超级会员免费看
订阅专栏 解锁全文
1100

被折叠的 条评论
为什么被折叠?



