Spaces:
Running
Running
Paul Magee
feedback system added that stores relevant responses. need to add a dbase next to store feedback responses at scale.
ad3ba0d
""" | |
Configuration settings for the chatbot application. | |
Loads from environment variables with sensible defaults. | |
""" | |
import os | |
from dotenv import load_dotenv | |
# Load environment variables from .env file if it exists | |
load_dotenv() | |
# App Information | |
APP_NAME = os.getenv("APP_NAME", "Paul's Document Chatbot") | |
PRIMARY_COLOR = os.getenv("PRIMARY_COLOR", "#7E56C2") # Purple-ish | |
SECONDARY_COLOR = os.getenv("SECONDARY_COLOR", "#4CAF50") # Green-ish | |
# Paths | |
DATA_DIR = os.getenv("DATA_DIR", "data") | |
INDEX_DIR = os.getenv("INDEX_DIR", "index") | |
# LLM Configuration | |
ANTHROPIC_API_KEY = os.getenv("ANTHROPIC_API_KEY") | |
LLM_MODEL = os.getenv("LLM_MODEL", "claude-3-7-sonnet-20250219") | |
LLM_TEMPERATURE = float(os.getenv("LLM_TEMPERATURE", "0.1")) | |
LLM_MAX_TOKENS = int(os.getenv("LLM_MAX_TOKENS", "2048")) | |
# Embedding Configuration | |
EMBEDDING_MODEL = os.getenv("EMBEDDING_MODEL", "sentence-transformers/all-MiniLM-L6-v2") | |
EMBEDDING_DEVICE = os.getenv("EMBEDDING_DEVICE", "cpu") | |
EMBEDDING_BATCH_SIZE = int(os.getenv("EMBEDDING_BATCH_SIZE", "8")) | |
# Document Processing Configuration | |
CHUNK_SIZE = int(os.getenv("CHUNK_SIZE", "1024")) | |
CHUNK_OVERLAP = int(os.getenv("CHUNK_OVERLAP", "100")) | |
# Database Configuration (for future use) | |
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///chatbot.db") | |
# Debug and logging | |
DEBUG = os.getenv("DEBUG", "False").lower() == "true" | |
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") | |
# Function to get configuration as a dictionary | |
def get_chatbot_config(): | |
"""Return chatbot configuration as a dictionary""" | |
return { | |
"model": LLM_MODEL, | |
"temperature": LLM_TEMPERATURE, | |
"max_tokens": LLM_MAX_TOKENS, | |
"embedding_model": EMBEDDING_MODEL, | |
"device": EMBEDDING_DEVICE, | |
"embed_batch_size": EMBEDDING_BATCH_SIZE, | |
"chunk_size": CHUNK_SIZE, | |
"chunk_overlap": CHUNK_OVERLAP, | |
} |