Download app/config.py from acpcchatbotadmin/acpcchatbot_testing_first: direct link, hf CLI and curl.
- Browser
- Download file 2.58 kB
-
https://huggingface.co/spaces/acpcchatbotadmin/acpcchatbot_testing_first/resolve/main/app/config.py
- Command line
-
hf download hf://spaces/acpcchatbotadmin/acpcchatbot_testing_first/app/config.py
-
curl -L -o config.py https://huggingface.co/spaces/acpcchatbotadmin/acpcchatbot_testing_first/resolve/main/app/config.py
2.58 kB
| import os | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| class Settings: | |
| # OpenAI / OpenRouter | |
| openai_api_key: str = os.getenv("OPENROUTER_API_KEY") | |
| openai_api_base: str = "https://openrouter.ai/api/v1" | |
| # Qdrant | |
| qdrant_url: str = os.getenv("QDRANT_URL") | |
| qdrant_api_key: str = os.getenv("QDRANT_API_KEY") | |
| collection_name: str = os.getenv("COLLECTION_NAME", "ld_chatbot_main") | |
| vector_name: str = os.getenv("VECTOR_NAME", "text-dense") # Named vector field | |
| # Models | |
| embedding_model: str = os.getenv("EMBEDDING_MODEL", "text-embedding-3-small") | |
| llm_model: str = os.getenv("LLM_MODEL", "gpt-4o") | |
| reranker_model: str = os.getenv("RERANKER_MODEL", "rerank-english-v3.0") | |
| # Cohere | |
| cohere_api_key: str = os.getenv("COHERE_API_KEY", "") | |
| # Sarvam | |
| sarvam_api_key: str = os.getenv("SARVAM_API_KEY", "") | |
| sarvam_api_url: str = "https://api.sarvam.ai/speech-to-text" | |
| # Langfuse | |
| langfuse_public_key: str = os.getenv("LANGFUSE_PUBLIC_KEY", "") | |
| langfuse_secret_key: str = os.getenv("LANGFUSE_SECRET_KEY", "") | |
| langfuse_host: str = os.getenv("LANGFUSE_HOST", "https://cloud.langfuse.com") | |
| # Retrieval parameters | |
| retrieval_top_k: int = int(os.getenv("RETRIEVAL_TOP_K", "15")) | |
| rerank_top_n: int = int(os.getenv("RERANK_TOP_N", "5")) | |
| # Agent parameters | |
| max_retrieval_retries: int = int(os.getenv("MAX_RETRIEVAL_RETRIES", "2")) | |
| confidence_threshold: float = float(os.getenv("CONFIDENCE_THRESHOLD", "0.2")) | |
| # Memory / session | |
| max_conversation_messages: int = int(os.getenv("MAX_CONVERSATION_MESSAGES", "20")) | |
| max_context_tokens: int = int(os.getenv("MAX_CONTEXT_TOKENS", "6000")) | |
| session_ttl_minutes: int = int(os.getenv("SESSION_TTL_MINUTES", "30")) | |
| # Security | |
| ingest_api_key: str = os.getenv("INGEST_API_KEY", "") | |
| allowed_origins: list[str] = [ | |
| o.strip() | |
| for o in os.getenv("ALLOWED_ORIGINS", "http://localhost:5173,http://localhost:3000").split(",") | |
| if o.strip() | |
| ] | |
| # Chunk parameters (for ingestion — must match existing collection) | |
| chunk_size: int = 512 | |
| chunk_overlap: int = 64 | |
| # Fallback response (never LLM-generated) | |
| fallback_response: str = ( | |
| "I don't have specific information about that in my current knowledge base. " | |
| "For accurate and up-to-date information, please visit the official ACPC Gujarat website: " | |
| "https://acpc.gujarat.gov.in/ or contact the ACPC helpline." | |
| ) | |
| settings = Settings() |