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:
38
config.py
Normal file
38
config.py
Normal file
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
Configuration module for RAG system.
|
||||
Handles environment variable loading, validation, and constants.
|
||||
"""
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
# Constants
|
||||
MAX_CONTENT_LENGTH = 50000
|
||||
MAX_TAG_LENGTH = 100
|
||||
MAX_GRAPH_NODES = 100
|
||||
REQUEST_TIMEOUT = int(os.getenv("REQUEST_TIMEOUT", "30"))
|
||||
AUTO_LINK_THRESHOLD = float(os.getenv("AUTO_LINK_THRESHOLD", "0.75"))
|
||||
AUTO_LINK_TOP_K = int(os.getenv("AUTO_LINK_TOP_K", "5"))
|
||||
|
||||
# Environment variables
|
||||
PROJECT_ID = os.getenv("GOOGLE_CLOUD_PROJECT", "hypnotic-tenure-swz46")
|
||||
LOCATION = os.getenv("GOOGLE_CLOUD_LOCATION", "us-central1")
|
||||
VERTEX_API_KEY = os.getenv("VERTEX_API_KEY")
|
||||
PINECONE_API_KEY = os.getenv("PINECONE_API_KEY")
|
||||
PINECONE_INDEX_NAME = os.getenv("PINECONE_INDEX_NAME", "memory-index")
|
||||
|
||||
# Server settings
|
||||
FASTMCP_HOST = os.getenv("FASTMCP_HOST", "0.0.0.0")
|
||||
FASTMCP_PORT = int(os.getenv("FASTMCP_PORT", "8000"))
|
||||
|
||||
def validate_env() -> None:
|
||||
"""Validate required environment variables are present."""
|
||||
required = ["VERTEX_API_KEY", "PINECONE_API_KEY", "PINECONE_INDEX_NAME"]
|
||||
missing = [k for k in required if not os.getenv(k)]
|
||||
if missing:
|
||||
raise RuntimeError(f"필수 환경 변수가 없습니다: {missing}")
|
||||
|
||||
# Validate on import
|
||||
validate_env()
|
||||
Reference in New Issue
Block a user