-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
80 lines (67 loc) · 2.01 KB
/
config.py
File metadata and controls
80 lines (67 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""
Configuration management for LLM Playground.
"""
import os
from pathlib import Path
# Project directories
PROJECT_ROOT = Path(__file__).parent
LOGS_DIR = PROJECT_ROOT / "logs"
EXPERIMENTS_DIR = PROJECT_ROOT / "experiments"
# Ensure directories exist
LOGS_DIR.mkdir(exist_ok=True)
EXPERIMENTS_DIR.mkdir(exist_ok=True)
# Default model settings
DEFAULT_PROVIDER = "ollama"
DEFAULT_MODEL = "llama2"
DEFAULT_TEMPERATURE = 0.7
DEFAULT_MAX_TOKENS = 256
DEFAULT_TOP_P = 0.9
# Ollama settings
OLLAMA_BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")
# OpenAI settings (optional)
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
# Logging settings
LOG_TO_FILE = True
LOG_TO_CONSOLE = False
LOG_FORMAT = "json" # "json" or "csv"
# UI settings (for Streamlit)
APP_TITLE = "🚀 LLM Playground"
APP_DESCRIPTION = """
Experiment with Large Language Models and understand their behavior.
Select a model, adjust parameters, and observe how they affect outputs.
All interactions are logged for later analysis.
"""
# Available experiments
EXPERIMENTS = {
"zero_shot": {
"name": "Zero-Shot Prompting",
"description": "Test model's ability to perform tasks without examples",
},
"few_shot": {
"name": "Few-Shot Prompting",
"description": "Compare performance with and without examples",
},
"temperature": {
"name": "Temperature Effects",
"description": "See how temperature affects creativity and determinism",
},
"context_window": {
"name": "Context Window Analysis",
"description": "Test behavior with varying prompt lengths",
},
"prompt_sensitivity": {
"name": "Prompt Sensitivity",
"description": "Observe how small changes affect outputs",
},
}
# Sampling parameter ranges
TEMPERATURE_RANGE = (0.0, 2.0)
TEMPERATURE_STEP = 0.1
TOP_P_RANGE = (0.0, 1.0)
TOP_P_STEP = 0.05
MAX_TOKENS_RANGE = (1, 2048)
MAX_TOKENS_DEFAULT = 256
# Cost tracking (for OpenAI)
TRACK_COSTS = True
# Performance
REQUEST_TIMEOUT = 300 # seconds