Update main.py
Browse files
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 |
-
#
|
129 |
-
relevant_chunks = retriever.
|
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"""
|