# 3. 프롬프트에 레퍼런스 문서 정보와 사용자 쿼리 정보 입력
llm = HuggingFaceHub(repo_id="mistralai/Mixtral-8x7B-Instruct-v0.1",
model_kwargs={'temperature': 0.6, 'max_length': 100})
chat_model = ChatHuggingFace(llm=llm)
** 원하는 허깅페이스 repo를 찾으면 된다.
3) 프롬프트 작성
TemplateError: Conversation roles must alternate user/assistant/user/assistant/...
Mixtral의 경우 User/ Assistant / User/ Assistant / ... 순으로 주어져야 하므로 기존 튜토리얼의 방식대로 하면 오류가 발생한다. 따라서 아래의 프롬프트 템플릿을 만들고 전달해줘야 한다.
prompt = f"""
Context information is below.
---------------------
title : {reference['title']}
{reference['text']}
---------------------
Your role is to answer the Query based on the context information provided.
You must base your answer solely on the context information and regardless of your own knowledge, and you must include the title information in your answer.
Answer the Query.
Query: {query}
Answer:
"""