syedmudassir16 commited on
Commit
122b45d
1 Parent(s): 77190bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
app.py CHANGED
@@ -125,17 +125,22 @@ class MultiAgentRAG:
125
  return rewritten_query.strip()
126
 
127
  def generation_agent(self, query, retrieved_content):
128
- generation_prompt = f"""
129
- Using the following information retrieved from the knowledge base:
130
-
131
- {retrieved_content}
132
-
133
- Provide a comprehensive answer to the question below:
134
-
135
- Question: {query}
136
- Answer:
137
- """
138
- input_ids = self.tokenizer.encode(generation_prompt, return_tensors="pt").to(self.model.device)
 
 
 
 
 
139
  return self.generate_response_with_timeout(input_ids)
140
 
141
  def run_multi_agent_rag(self, query):
 
125
  return rewritten_query.strip()
126
 
127
  def generation_agent(self, query, retrieved_content):
128
+ conversation = [
129
+ {"role": "system", "content": "You are a knowledgeable assistant with access to a comprehensive database."},
130
+ {"role": "user", "content": f"""
131
+ I need you to answer my question and provide related information in a specific format.
132
+ I have provided five relatable json files {retrieved_content}, choose the most suitable chunks for answering the query.
133
+ RETURN ONLY SOLUTION without additional comments, sign-offs, retrived chunks, refrence to any Ticket or extra phrases. Be direct and to the point.
134
+ IF THERE IS NO ANSWER RELATABLE IN RETRIEVED CHUNKS, RETURN "NO SOLUTION AVAILABLE".
135
+ DO NOT GIVE REFRENCE TO ANY CHUNKS OR TICKETS,BE ON POINT.
136
+
137
+ Here's my question:
138
+ Query: {query}
139
+ Solution==>
140
+ """}
141
+ ]
142
+
143
+ input_ids = self.tokenizer.encode(self.tokenizer.apply_chat_template(conversation, tokenize=False), return_tensors="pt").to(self.model.device)
144
  return self.generate_response_with_timeout(input_ids)
145
 
146
  def run_multi_agent_rag(self, query):