728x90
반응형
-
할루시네이션 발생 시 답변의 신뢰성이 중요하며, Groundless Check로 확인 가능.
Upstage에서 제공하는 Groundedness Check 기능
- solor 1 mini 모델에서 사용 가능 https://developers.upstage.ai/docs/apis/groundedness-check
from openai import OpenAI
client = OpenAI(
api_key="UPSTAGE_API_KEY",
base_url="https://api.upstage.ai/v1/solar"
)
# Chatbot 답변이 틀렸는지, 맞았는지에 대한 답변을 response에 받음
response = client.chat.completions.create(
model="solar-1-mini-groundedness-check" # "groundedness-check" 기능 호출(필수),
messages=[
{
"role": "user",
"content": "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."
} # 사용자 질문 내용(필수)
,
{
"role": "assistant",
"content": "Mauna Kea is 5,207.3 meters tall."
} # ai 답변 내용(필수)
]
)
print(response) # 틀렸다.라고 뜰 것임 = notGrounded (or Grounded(맞다) or notSure(모르겠다))
- 답변 예시:
{
"id": "c43ecfa6-31a9-4884-a920-a5f44fb727df",
"object": "chat.completion",
"created": 1710338020,
"model": "solar-1-mini-groundedness-check-240502",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "notGrounded"
},
"logprobs": null,
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 132,
"completion_tokens": 3,
"total_tokens": 135
},
"system_fingerprint": ""
}
728x90
반응형
'기술공부 > LLM' 카테고리의 다른 글
RAG ChatBot 만들기: Upstage, Solar LLM (0) | 2024.06.28 |
---|---|
Customized ChatGPT 만들기: 개인 비서 (0) | 2024.06.28 |
LLM, RAG (0) | 2024.05.03 |
오픈소스 LLM(Llama2): 파인튜닝 (0) | 2024.04.17 |
Ollama (0) | 2024.04.17 |