Spaces:
Running
Running
Create config.py
Browse files
config.py
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration file for RS Studies MCP Server
|
| 3 |
+
Customize these settings based on your local setup.
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import os
|
| 7 |
+
import torch
|
| 8 |
+
|
| 9 |
+
class Config:
|
| 10 |
+
"""Configuration settings for the RS Studies MCP Server"""
|
| 11 |
+
|
| 12 |
+
# Server Information
|
| 13 |
+
SERVER_NAME = "rs-studies-mcp"
|
| 14 |
+
SERVER_DESCRIPTION = "RS Studies Knowledge Base MCP Server"
|
| 15 |
+
SERVER_VERSION = "1.0.0"
|
| 16 |
+
|
| 17 |
+
# Model path - adjust if your model is in a different location
|
| 18 |
+
MODEL_PATH = "google/embeddinggemma-300m"
|
| 19 |
+
|
| 20 |
+
# ChromaDB path - relative to the base directory
|
| 21 |
+
CHROMADB_PATH = os.path.join(BASE_DIR, "chromadb_data")
|
| 22 |
+
|
| 23 |
+
# Collection name in ChromaDB
|
| 24 |
+
COLLECTION_NAME = "rs_studies_embeddings"
|
| 25 |
+
|
| 26 |
+
# Search Configuration
|
| 27 |
+
DEFAULT_NUM_RESULTS = 5
|
| 28 |
+
MAX_NUM_RESULTS = 50
|
| 29 |
+
DEFAULT_CONTEXT_SIZE = 3
|
| 30 |
+
MAX_CONTEXT_SIZE = 10
|
| 31 |
+
|
| 32 |
+
# Valid source filters based on your data structure
|
| 33 |
+
VALID_SOURCES = [
|
| 34 |
+
'rs_stkege_01', # RS trading system documentation
|
| 35 |
+
'cheenai_meet_full', # Chennai meetup transcripts
|
| 36 |
+
'QnAYoutubeChannel' # Q&A discussions
|
| 37 |
+
]
|
| 38 |
+
|
| 39 |
+
# Device configuration
|
| 40 |
+
@staticmethod
|
| 41 |
+
def get_device():
|
| 42 |
+
"""Get the best available device for inference"""
|
| 43 |
+
if torch.cuda.is_available():
|
| 44 |
+
return "cuda"
|
| 45 |
+
else:
|
| 46 |
+
return "cpu"
|
| 47 |
+
|
| 48 |
+
# Embedding configuration
|
| 49 |
+
EMBEDDING_BATCH_SIZE = 32
|
| 50 |
+
|
| 51 |
+
# Create a default config instance
|
| 52 |
+
config = Config()
|
| 53 |
+
|
| 54 |
+
class ProdConfig(Config):
|
| 55 |
+
"""Production configuration with optimized settings"""
|
| 56 |
+
MAX_NUM_RESULTS = 50
|
| 57 |
+
EMBEDDING_BATCH_SIZE = 64
|
| 58 |
+
|
| 59 |
+
# Environment-based configuration selection
|
| 60 |
+
def get_config(env="default"):
|
| 61 |
+
"""Get configuration based on environment"""
|
| 62 |
+
return ProdConfig()
|