Graph_RAG / backend /app /core /constants.py
Aigenthix's picture
Upload 2585 files
711f785 verified
Raw
History Blame Contribute Delete
2.88 kB
"""Application constants and enums"""
from enum import Enum
class VectorDBType(str, Enum):
"""Supported vector database types"""
CHROMA = "chroma"
PINECONE = "pinecone"
WEAVIATE = "weaviate"
QDRANT = "qdrant"
class EmbeddingProvider(str, Enum):
"""Supported embedding providers"""
HUGGINGFACE = "huggingface"
GROQ = "groq"
class TokenizerType(str, Enum):
"""Supported tokenizer types"""
TIKTOKEN = "tiktoken"
HUGGINGFACE = "huggingface"
class DocumentType(str, Enum):
"""Supported document types"""
PDF = "pdf"
CSV = "csv"
TEXT = "text"
class GroqModel(str, Enum):
"""Available Groq models"""
LLAMA_31_8B = "llama-3.1-8b-instant"
LLAMA_33_70B = "llama-3.3-70b-versatile"
GPT_OSS_120B = "openai/gpt-oss-120b"
GPT_OSS_20B = "openai/gpt-oss-20b"
GROQ_MODELS = [
{"id": "llama-3.1-8b-instant", "name": "Llama 3.1 8B (Fast)", "context_window": 8000},
{"id": "llama-3.3-70b-versatile", "name": "Llama 3.3 70B (Versatile)", "context_window": 8000},
{"id": "openai/gpt-oss-120b", "name": "OpenAI GPT-OSS 120B", "context_window": 4000},
{"id": "openai/gpt-oss-20b", "name": "OpenAI GPT-OSS 20B", "context_window": 4000},
]
EMBEDDING_MODELS = [
{"id": "all-MiniLM-L6-v2", "name": "MiniLM (Small, Fast)", "dimension": 384},
{"id": "all-mpnet-base-v2", "name": "MPNet (Large, Accurate)", "dimension": 768},
]
VECTOR_DBS = [
{"id": "chroma", "name": "Chroma (Local)", "type": "local"},
{"id": "pinecone", "name": "Pinecone (Cloud)", "type": "cloud"},
{"id": "weaviate", "name": "Weaviate (Self-hosted)", "type": "hybrid"},
{"id": "qdrant", "name": "Qdrant (Self-hosted)", "type": "local"},
]
TOKENIZERS = [
{"id": "tiktoken", "name": "TikToken (OpenAI Standard)"},
{"id": "huggingface", "name": "HuggingFace (Model-specific)"},
]
# RAG Configuration Defaults
DEFAULT_CHUNK_SIZE = 512
DEFAULT_CHUNK_OVERLAP = 50
DEFAULT_RETRIEVAL_TOP_K = 5
DEFAULT_GENERATION_TEMPERATURE = 0.7
# File upload limits
MAX_FILE_SIZE = 52428800 # 50 MB
ALLOWED_EXTENSIONS = {".pdf", ".csv", ".txt"}
# RAG Pipeline Steps
RAG_STEPS = [
"document_retrieval",
"context_assembly",
"prompt_construction",
"llm_generation",
"post_processing",
]
# RAG Modes
class RAGMode(str, Enum):
"""RAG operation modes"""
SIMPLE = "simple" # Direct retrieval + generation
AGENTIC = "agentic" # Multi-step agent with tool use
GRAPH = "graph" # Graph-based knowledge representation
RAG_MODES = [
{"id": "simple", "name": "Simple RAG", "description": "Direct retrieval and generation", "icon": "📄"},
{"id": "agentic", "name": "Agentic RAG", "description": "Multi-step reasoning with tools", "icon": "🤖"},
{"id": "graph", "name": "Graph RAG", "description": "Knowledge graph-based retrieval", "icon": "🕸️"},
]