bainskarman commited on
Commit
751f053
·
verified ·
1 Parent(s): 4f13fd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -94,6 +94,23 @@ def similarity_search(query, chunks, method="Cosine", index=None, k=5):
94
  distances, indices = index.search(query_embedding, k)
95
  return [(chunks[i], 1 - distances[0][j]) for j, i in enumerate(indices[0])]
96
  return []
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97
 
98
  # Streamlit App
99
  def main():
 
94
  distances, indices = index.search(query_embedding, k)
95
  return [(chunks[i], 1 - distances[0][j]) for j, i in enumerate(indices[0])]
96
  return []
97
+
98
+ DEFAULT_SYSTEM_PROMPTS = {
99
+ "Multi-Query": """You are an AI language model assistant. Your task is to generate five
100
+ different versions of the given user question to retrieve relevant documents from a vector
101
+ database. By generating multiple perspectives on the user question, your goal is to help
102
+ the user overcome some of the limitations of the distance-based similarity search.
103
+ Provide these alternative questions separated by newlines. Original question: {question}""",
104
+ "RAG Fusion": """You are an AI language model assistant. Your task is to combine multiple
105
+ queries into a single, refined query to improve retrieval accuracy. Original question: {question}""",
106
+ "Decomposition": """You are an AI language model assistant. Your task is to break down
107
+ the given user question into simpler sub-questions. Provide these sub-questions separated
108
+ by newlines. Original question: {question}""",
109
+ "Step Back": """You are an AI language model assistant. Your task is to refine the given
110
+ user question by taking a step back and asking a more general question. Original question: {question}""",
111
+ "HyDE": """You are an AI language model assistant. Your task is to generate a hypothetical
112
+ document that would be relevant to the given user question. Original question: {question}""",
113
+ }
114
 
115
  # Streamlit App
116
  def main():