junaid17 commited on
Commit
7f8e290
·
verified ·
1 Parent(s): 2e019bc

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +6 -17
tools.py CHANGED
@@ -78,7 +78,7 @@ def get_retriever():
78
 
79
 
80
  # =========================
81
- # RAG TOOL
82
  # =========================
83
 
84
  def create_rag_tool():
@@ -102,22 +102,11 @@ def create_rag_tool():
102
  if not docs:
103
  return "No relevant information found in the uploaded document."
104
 
 
105
  context = "\n\n".join(d.page_content for d in docs)
106
-
107
- return f"""
108
- You are given extracted content from a document.
109
-
110
- Your task:
111
- - Summarize the content clearly
112
- - Use bullet points where appropriate
113
- - Keep formatting clean and readable
114
- - Do NOT repeat unnecessary text
115
- - Do NOT mention that this came from a document
116
-
117
- DOCUMENT CONTENT:
118
- {context}
119
- """
120
-
121
 
122
  return rag_search
123
 
@@ -270,4 +259,4 @@ def get_weather(city: str) -> dict:
270
  "wind_dir": data["current"]["wind_dir"],
271
  }
272
  except Exception as e:
273
- return {"error": str(e)}
 
78
 
79
 
80
  # =========================
81
+ # RAG TOOL (FIXED!)
82
  # =========================
83
 
84
  def create_rag_tool():
 
102
  if not docs:
103
  return "No relevant information found in the uploaded document."
104
 
105
+ # 🔥 FIXED: Just return the content, NOT the prompt template
106
  context = "\n\n".join(d.page_content for d in docs)
107
+
108
+ # Return clean context for the LLM to use
109
+ return context
 
 
 
 
 
 
 
 
 
 
 
 
110
 
111
  return rag_search
112
 
 
259
  "wind_dir": data["current"]["wind_dir"],
260
  }
261
  except Exception as e:
262
+ return {"error": str(e)}