UpstageGroundednessCheck
这个笔记本介绍了如何使用Upstage接地检查模型入门。
安装
安装langchain-upstage个包。
pip install -U langchain-upstage
环境设置
请设置以下环境变量:
UPSTAGE_API_KEY: 你的Upstage API密钥来自Upstage开发文档。
import os
os.environ["UPSTAGE_API_KEY"] = "YOUR_API_KEY"
用法
初始化 UpstageGroundednessCheck 类。
from langchain_upstage import UpstageGroundednessCheck
groundedness_check = UpstageGroundednessCheck()
API 参考:UpstageGroundednessCheck
使用run方法检查输入文本的合理性。
request_input = {
"context": "Mauna Kea is an inactive volcano on the island of Hawai'i. Its peak is 4,207.3 m above sea level, making it the highest point in Hawaii and second-highest peak of an island on Earth.",
"answer": "Mauna Kea is 5,207.3 meters tall.",
}
response = groundedness_check.invoke(request_input)
print(response)