Initial commit: RAG MCP Server with relationship graph
Features: - Vector search with Pinecone + Vertex AI embeddings - Document relationships (link, unlink, related, graph) - Auto-link with LLM analysis - Intelligent merge with Gemini Modular structure: - clients/: Pinecone, Vertex AI - tools/: core, relations, stats - utils/: validation, logging Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
27
clients/pinecone.py
Normal file
27
clients/pinecone.py
Normal file
@@ -0,0 +1,27 @@
|
||||
"""Pinecone client singleton."""
|
||||
from pinecone import Pinecone
|
||||
from config import PINECONE_API_KEY, PINECONE_INDEX_NAME
|
||||
from utils.logging import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
# Pinecone singleton
|
||||
_pc_client = None
|
||||
_index = None
|
||||
|
||||
def get_index():
|
||||
"""
|
||||
Get Pinecone index instance (singleton pattern).
|
||||
|
||||
Returns:
|
||||
Pinecone index instance
|
||||
"""
|
||||
global _pc_client, _index
|
||||
|
||||
if _index is None:
|
||||
logger.info("Initializing Pinecone client")
|
||||
_pc_client = Pinecone(api_key=PINECONE_API_KEY)
|
||||
_index = _pc_client.Index(PINECONE_INDEX_NAME)
|
||||
logger.info(f"Connected to Pinecone index: {PINECONE_INDEX_NAME}")
|
||||
|
||||
return _index
|
||||
Reference in New Issue
Block a user