SattamALMU commited on
Commit
bf62d86
1 Parent(s): c9bcfeb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -6,6 +6,8 @@ import pandas as pd
6
  import faiss
7
  import pickle
8
  from sentence_transformers import SentenceTransformer
 
 
9
  embedding_model = SentenceTransformer('nomic-ai/nomic-embed-text-v1.5', trust_remote_code=True)
10
  openai.api_key = os.getenv("OPENAI_API_KEY")
11
  db_index = faiss.read_index("db_index.faiss")
@@ -50,16 +52,20 @@ def search(query):
50
  def generate_answer(query):
51
  prompt = f"""
52
  Based on the following query from a user, please generate a detailed answer based on the context
53
- focusing on which is the best based on the query. You should respond as a news and politician expert agent conversing with the
54
  user in a nice cordial way. If the query question is not in the context say I don't know, and always provide the url as the source of the information.
55
- Remove the special characters and (/n ), and make the output clean and concise.
 
56
  ###########
57
  query:
58
  "{query}"
 
59
  ########
 
60
  context:"
61
  "{search(query)}"
62
  #####
 
63
  Return in Markdown format with each hotel highlighted.
64
  """
65
 
 
6
  import faiss
7
  import pickle
8
  from sentence_transformers import SentenceTransformer
9
+
10
+
11
  embedding_model = SentenceTransformer('nomic-ai/nomic-embed-text-v1.5', trust_remote_code=True)
12
  openai.api_key = os.getenv("OPENAI_API_KEY")
13
  db_index = faiss.read_index("db_index.faiss")
 
52
  def generate_answer(query):
53
  prompt = f"""
54
  Based on the following query from a user, please generate a detailed answer based on the context
55
+ focusing on which is the best based on the query. You should responsd as you are a news and politician expert agent and are conversing with the
56
  user in a nice cordial way. If the query question is not in the context say I don't know, and always provide the url as the source of the information.
57
+ Remove the special characters and (/n ) , make the output clean and concise.
58
+
59
  ###########
60
  query:
61
  "{query}"
62
+
63
  ########
64
+
65
  context:"
66
  "{search(query)}"
67
  #####
68
+
69
  Return in Markdown format with each hotel highlighted.
70
  """
71