Upstage 紮實性檢查
本筆記本涵蓋如何開始使用 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)