isam0 commited on
Commit
220ea84
·
verified ·
1 Parent(s): 2ccb81f

Update app/config.py

Browse files
Files changed (1) hide show
  1. app/config.py +12 -24
app/config.py CHANGED
@@ -1,39 +1,27 @@
1
- """
2
- Configuration for Nur Brain Service
3
- """
4
  import os
5
  from functools import lru_cache
6
  from pydantic_settings import BaseSettings
7
 
8
-
9
  class Settings(BaseSettings):
10
- """Application settings loaded from environment variables."""
11
-
12
- # Service Info
13
- service_name: str = "Nur Brain"
14
- version: str = "1.0.0"
15
- debug: bool = False
16
 
17
- # Security
18
- nur_internal_key: str
19
 
20
- # LLM Configuration
21
- model_path: str = "/app/models/llama-3-8b-instruct.Q4_K_M.gguf"
 
 
 
 
22
  model_n_ctx: int = 4096
23
- model_n_threads: int = 4
24
- model_n_gpu_layers: int = 0 # Set to higher value if GPU available
25
-
26
- # Generation defaults
27
- default_max_tokens: int = 512
28
- default_temperature: float = 0.7
29
- default_top_p: float = 0.9
30
 
31
  class Config:
32
  env_file = ".env"
33
- env_file_encoding = "utf-8"
34
-
35
 
36
  @lru_cache()
37
  def get_settings() -> Settings:
38
- """Get cached settings instance."""
39
  return Settings()
 
 
 
 
1
  import os
2
  from functools import lru_cache
3
  from pydantic_settings import BaseSettings
4
 
 
5
  class Settings(BaseSettings):
6
+ service_name: str = "Nur Brain (HF)"
7
+ version: str = "2.0.0-Parallel"
 
 
 
 
8
 
9
+ # Security Key (Set this in HF Settings -> Variables & Secrets)
10
+ nur_internal_key: str = os.getenv("NUR_INTERNAL_KEY", "default_insecure_key")
11
 
12
+ # Model Auto-Download Settings
13
+ repo_id: str = "NousResearch/Meta-Llama-3-8B-Instruct-GGUF"
14
+ filename: str = "Meta-Llama-3-8B-Instruct-Q4_K_M.gguf"
15
+ model_path: str = "" # Will be set dynamically after download
16
+
17
+ # Performance Settings
18
  model_n_ctx: int = 4096
19
+ model_n_threads: int = 4 # Max CPU cores on HF Free
20
+ model_n_parallel: int = 8 # Allows 8 concurrent requests
 
 
 
 
 
21
 
22
  class Config:
23
  env_file = ".env"
 
 
24
 
25
  @lru_cache()
26
  def get_settings() -> Settings:
 
27
  return Settings()