Update app.py
Browse files
app.py
CHANGED
@@ -44,7 +44,9 @@ def get_top_k(query_embedding, embeddings, documents, k=3):
|
|
44 |
prompt_template = """
|
45 |
You are the helpful assistant representing the company Philip Morris.
|
46 |
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
47 |
-
|
|
|
|
|
48 |
|
49 |
Context:
|
50 |
{context}
|
@@ -75,7 +77,7 @@ with gr.Blocks() as demo:
|
|
75 |
|
76 |
def respond(message, chat_history):
|
77 |
message_embedding = list(embedding_model.embed([message]))[0]
|
78 |
-
result_docs = get_top_k(message_embedding, embeddings, texts, k=
|
79 |
|
80 |
human_message = HumanMessage(
|
81 |
content=PROMPT.format(context=result_docs, question=message)
|
|
|
44 |
prompt_template = """
|
45 |
You are the helpful assistant representing the company Philip Morris.
|
46 |
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
47 |
+
Use the following pieces of context to answer the question at the end.
|
48 |
+
Think step by step in your answer.
|
49 |
+
Only answer the given question.
|
50 |
|
51 |
Context:
|
52 |
{context}
|
|
|
77 |
|
78 |
def respond(message, chat_history):
|
79 |
message_embedding = list(embedding_model.embed([message]))[0]
|
80 |
+
result_docs = get_top_k(message_embedding, embeddings, texts, k=2)
|
81 |
|
82 |
human_message = HumanMessage(
|
83 |
content=PROMPT.format(context=result_docs, question=message)
|