sagar008 commited on
Commit
37b6f9c
·
verified ·
1 Parent(s): 2b2ba3d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -2
main.py CHANGED
@@ -125,8 +125,8 @@ async def chat_with_document(data: ChatInput):
125
  if not retriever:
126
  return {"error": "Failed to create retriever or document not found"}
127
 
128
- # Get relevant chunks based on similarity
129
- relevant_chunks = retriever.get_relevant_documents(data.message)
130
 
131
  if not relevant_chunks:
132
  return {
@@ -168,6 +168,7 @@ async def chat_with_document(data: ChatInput):
168
  print(f"❌ Chat error: {e}")
169
  return {"error": f"Chat failed: {str(e)}"}
170
 
 
171
  @app.get("/debug_pinecone/{document_id}")
172
  async def debug_pinecone_storage(document_id: str):
173
  """Debug what's actually stored in Pinecone for a document"""
 
125
  if not retriever:
126
  return {"error": "Failed to create retriever or document not found"}
127
 
128
+ # FIX 1: Use invoke instead of deprecated get_relevant_documents
129
+ relevant_chunks = await retriever.ainvoke(data.message)
130
 
131
  if not relevant_chunks:
132
  return {
 
168
  print(f"❌ Chat error: {e}")
169
  return {"error": f"Chat failed: {str(e)}"}
170
 
171
+
172
  @app.get("/debug_pinecone/{document_id}")
173
  async def debug_pinecone_storage(document_id: str):
174
  """Debug what's actually stored in Pinecone for a document"""