Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -71,23 +71,23 @@ embeddings = HuggingFaceEmbeddings(model_name="nomic-ai/nomic-embed-text-v1-abla
|
|
71 |
db = FAISS.load_local("gym_vector_db", embeddings,allow_dangerous_deserialization=True)
|
72 |
db_retriever = db.as_retriever(search_type="similarity",search_kwargs={"k": 4})
|
73 |
|
74 |
-
prompt_template = """This is a chat template and you are the gym trainer, your primary objective is to provide accurate and concise information related to gym, workout, bodybuilding based on the user's questions. Do not generate your own questions and answers. You will adhere strictly to the instructions provided, offering relevant context from the knowledge base while avoiding unnecessary details. Your responses will be brief, to the point, and in compliance with the established format. If a question falls outside the given context, rely on your own knowledge base to generate an appropriate response. You will prioritize the user's query and refrain from posing additional questions and do not repeat the prompt template and the things that you have said already.
|
75 |
QUESTION: {question}
|
76 |
CONTEXT: {context}
|
77 |
-
CHAT HISTORY: {chat_history}
|
78 |
-
|
|
|
79 |
"""
|
80 |
|
81 |
prompt = PromptTemplate(template=prompt_template,
|
82 |
input_variables=['question', 'context', 'chat_history'])
|
83 |
|
84 |
llm = Together(
|
85 |
-
model="
|
86 |
temperature=0.7,
|
87 |
-
max_tokens=
|
88 |
top_k=1,
|
89 |
together_api_key=os.environ['T_API']
|
90 |
-
)
|
91 |
|
92 |
qa = ConversationalRetrievalChain.from_llm(
|
93 |
llm=llm,
|
|
|
71 |
db = FAISS.load_local("gym_vector_db", embeddings,allow_dangerous_deserialization=True)
|
72 |
db_retriever = db.as_retriever(search_type="similarity",search_kwargs={"k": 4})
|
73 |
|
74 |
+
prompt_template = """<s>[INST]This is a chat template and you are the gym trainer, your primary objective is to provide accurate and concise information related to gym, workout, bodybuilding based on the user's questions. Do not generate your own questions and answers. You will adhere strictly to the instructions provided, offering relevant context from the knowledge base while avoiding unnecessary details. Your responses will be brief, to the point, and in compliance with the established format. If a question falls outside the given context, rely on your own knowledge base to generate an appropriate response. You will prioritize the user's query and refrain from posing additional questions and do not repeat the prompt template and the things that you have said already.
|
75 |
QUESTION: {question}
|
76 |
CONTEXT: {context}
|
77 |
+
CHAT HISTORY: {chat_history}[/INST]
|
78 |
+
ASSISTANT:
|
79 |
+
</s>
|
80 |
"""
|
81 |
|
82 |
prompt = PromptTemplate(template=prompt_template,
|
83 |
input_variables=['question', 'context', 'chat_history'])
|
84 |
|
85 |
llm = Together(
|
86 |
+
model="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
87 |
temperature=0.7,
|
88 |
+
max_tokens=1024,
|
89 |
top_k=1,
|
90 |
together_api_key=os.environ['T_API']
|
|
|
91 |
|
92 |
qa = ConversationalRetrievalChain.from_llm(
|
93 |
llm=llm,
|