GFiaMon commited on
Commit
0cfaa67
Β·
1 Parent(s): 689788f

debugging: library versions and add a traceback for pinecone

Browse files
requirements.txt CHANGED
@@ -43,12 +43,12 @@ langchain>=0.3.0,<0.4.0
43
  langchain-community>=0.3.0,<0.4.0
44
  langchain-core>=0.3.80,<0.4.0
45
  langchain-openai>=0.3.0,<0.4.0
46
- langchain-pinecone>=0.2.0,<0.3.0
47
  langchain-text-splitters>=0.3.0,<0.4.0
48
  langchain-mcp-adapters>=0.1.14,<0.2.0
49
  langgraph>=0.2.0,<0.3.0
50
- openai>=2.0.0,<3.0.0
51
- pinecone-client>=6.0.0
52
  tiktoken>=0.10.0,<1.0.0
53
  mcp>=1.0.0
54
 
 
43
  langchain-community>=0.3.0,<0.4.0
44
  langchain-core>=0.3.80,<0.4.0
45
  langchain-openai>=0.3.0,<0.4.0
46
+ langchain-pinecone==0.2.13
47
  langchain-text-splitters>=0.3.0,<0.4.0
48
  langchain-mcp-adapters>=0.1.14,<0.2.0
49
  langgraph>=0.2.0,<0.3.0
50
+ openai>=2.0.0
51
+ pinecone-client==6.0.0
52
  tiktoken>=0.10.0,<1.0.0
53
  mcp>=1.0.0
54
 
src/retrievers/pinecone.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  from pinecone import Pinecone, ServerlessSpec
3
  from langchain_pinecone import PineconeVectorStore
4
  from src.config.settings import Config
@@ -43,6 +44,46 @@ class PineconeManager:
43
 
44
  self.index = self.pc.Index(self.index_name)
45
  self.embeddings = get_embedding_model()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  def upsert_documents(self, documents, namespace=None):
48
  """
 
1
  import os
2
+ import traceback
3
  from pinecone import Pinecone, ServerlessSpec
4
  from langchain_pinecone import PineconeVectorStore
5
  from src.config.settings import Config
 
44
 
45
  self.index = self.pc.Index(self.index_name)
46
  self.embeddings = get_embedding_model()
47
+
48
+ # Run startup diagnostics
49
+ self.run_diagnostics()
50
+
51
+ def run_diagnostics(self):
52
+ """Run connectivity and functionality tests."""
53
+ print("\nπŸ” Running Pinecone & Embedding Diagnostics...")
54
+
55
+ # Test 1: Data Plane
56
+ try:
57
+ print(f"Testing connection to index '{self.index_name}'...")
58
+ stats = self.index.describe_index_stats()
59
+ print(f"βœ… Data Plane Verified. Total vectors: {stats.total_vector_count}")
60
+ except Exception as e:
61
+ print(f"❌ Data Plane Failed: {e}")
62
+ traceback.print_exc()
63
+
64
+ # Test 2: Embedding Model
65
+ try:
66
+ print("πŸ§ͺ Testing Embedding Model (OpenAI)...")
67
+ # Simple test query
68
+ emb = self.embeddings.embed_query("test connectivity")
69
+ print(f"βœ… Embedding Model Verified. Dimension: {len(emb)}")
70
+ except Exception as e:
71
+ print(f"❌ Embedding Model Failed: {e}")
72
+ traceback.print_exc()
73
+
74
+ # Test 3: VectorStore Integration
75
+ try:
76
+ print("πŸ”— Testing LangChain Integration...")
77
+ # Just initialize to check imports and config
78
+ PineconeVectorStore(
79
+ index_name=self.index_name,
80
+ embedding=self.embeddings,
81
+ pinecone_api_key=self.api_key
82
+ )
83
+ print("βœ… LangChain Integration Verified (Initialization)")
84
+ except Exception as e:
85
+ print(f"❌ LangChain Integration Failed: {e}")
86
+ traceback.print_exc()
87
 
88
  def upsert_documents(self, documents, namespace=None):
89
  """
src/tools/general.py CHANGED
@@ -12,6 +12,7 @@ from typing import List, Dict, Any, Optional
12
  from datetime import datetime
13
  import uuid
14
  import requests
 
15
  from langchain.tools import tool
16
  from langchain_core.documents import Document
17
 
@@ -101,6 +102,7 @@ def search_meetings(query: str, max_results: int = 5, meeting_id: Optional[str]
101
  return "".join(result_parts)
102
 
103
  except Exception as e:
 
104
  return f"Error searching meetings: {str(e)}"
105
 
106
 
@@ -158,6 +160,7 @@ def get_meeting_metadata(meeting_id: str) -> str:
158
  return "\n".join(result_parts)
159
 
160
  except Exception as e:
 
161
  return f"Error retrieving meeting metadata: {str(e)}"
162
 
163
 
@@ -228,6 +231,7 @@ def list_recent_meetings(limit: int = 10) -> str:
228
  return "\n".join(result_parts)
229
 
230
  except Exception as e:
 
231
  return f"Error listing meetings: {str(e)}"
232
 
233
 
@@ -409,6 +413,7 @@ def import_notion_to_pinecone(query: str) -> str:
409
  return upsert_text_to_pinecone.invoke({"text": full_content, "title": title, "source": "Notion"})
410
 
411
  except Exception as e:
 
412
  return f"❌ Import failed: {str(e)}"
413
 
414
 
@@ -491,6 +496,7 @@ def create_notion_page(title: str, content: str) -> str:
491
  return f"❌ Failed to create Notion page: {resp.status_code} - {resp.text}"
492
 
493
  except Exception as e:
 
494
  return f"❌ Error creating page: {str(e)}"
495
 
496
 
@@ -573,4 +579,5 @@ def upsert_text_to_pinecone(text: str, title: str, source: str = "Manual Entry",
573
  f" - Extracted Speakers: {', '.join(speaker_mapping.values()) if speaker_mapping else 'None'}")
574
 
575
  except Exception as e:
 
576
  return f"❌ Error saving to Pinecone: {str(e)}"
 
12
  from datetime import datetime
13
  import uuid
14
  import requests
15
+ import traceback
16
  from langchain.tools import tool
17
  from langchain_core.documents import Document
18
 
 
102
  return "".join(result_parts)
103
 
104
  except Exception as e:
105
+ traceback.print_exc()
106
  return f"Error searching meetings: {str(e)}"
107
 
108
 
 
160
  return "\n".join(result_parts)
161
 
162
  except Exception as e:
163
+ traceback.print_exc()
164
  return f"Error retrieving meeting metadata: {str(e)}"
165
 
166
 
 
231
  return "\n".join(result_parts)
232
 
233
  except Exception as e:
234
+ traceback.print_exc()
235
  return f"Error listing meetings: {str(e)}"
236
 
237
 
 
413
  return upsert_text_to_pinecone.invoke({"text": full_content, "title": title, "source": "Notion"})
414
 
415
  except Exception as e:
416
+ traceback.print_exc()
417
  return f"❌ Import failed: {str(e)}"
418
 
419
 
 
496
  return f"❌ Failed to create Notion page: {resp.status_code} - {resp.text}"
497
 
498
  except Exception as e:
499
+ traceback.print_exc()
500
  return f"❌ Error creating page: {str(e)}"
501
 
502
 
 
579
  f" - Extracted Speakers: {', '.join(speaker_mapping.values()) if speaker_mapping else 'None'}")
580
 
581
  except Exception as e:
582
+ traceback.print_exc()
583
  return f"❌ Error saving to Pinecone: {str(e)}"