-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
149 lines (128 loc) · 6.94 KB
/
Copy pathconfig.py
File metadata and controls
149 lines (128 loc) · 6.94 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
"""
Configuration for the Notion AI CRM Copilot.
Loads environment variables, validates API keys, and provides
all configurable thresholds and property mappings.
"""
import os
from dotenv import load_dotenv
load_dotenv()
class Config:
"""Central configuration — all magic numbers and settings live here."""
# --- API Keys ---
NOTION_API_KEY: str = os.getenv("NOTION_API_KEY", "")
NOTION_DATABASE_ID: str = os.getenv("NOTION_DATABASE_ID", "")
CLAUDE_API_KEY: str = os.getenv("CLAUDE_API_KEY", "")
CLAUDE_MODEL: str = os.getenv("CLAUDE_MODEL", "claude-sonnet-4-5-20250929")
# --- Priority Thresholds ---
HIGH_ICP_MIN: int = int(os.getenv("HIGH_ICP_MIN", "75"))
HIGH_RECENCY_MAX: int = int(os.getenv("HIGH_RECENCY_MAX", "10"))
LOW_ICP_MAX: int = int(os.getenv("LOW_ICP_MAX", "40"))
LOW_STALE_DAYS: int = int(os.getenv("LOW_STALE_DAYS", "45"))
STALE_DAYS_THRESHOLD: int = int(os.getenv("STALE_DAYS_THRESHOLD", "14"))
# --- Slack Notifications ---
SLACK_WEBHOOK_URL: str = os.getenv("SLACK_WEBHOOK_URL", "")
SLACK_ENABLED: bool = os.getenv("SLACK_ENABLED", "false").lower() in ("true", "1", "yes")
# --- Web Research ---
BRAVE_SEARCH_API_KEY: str = os.getenv("BRAVE_SEARCH_API_KEY", "")
WEB_RESEARCH_ENABLED: bool = os.getenv("WEB_RESEARCH_ENABLED", "true").lower() in ("true", "1", "yes")
WEB_RESEARCH_TIMEOUT: int = int(os.getenv("WEB_RESEARCH_TIMEOUT", "10"))
WEB_RESEARCH_DELAY: float = float(os.getenv("WEB_RESEARCH_DELAY", "1.0"))
WEB_RESEARCH_MAX_PAGES: int = int(os.getenv("WEB_RESEARCH_MAX_PAGES", "3"))
WEB_RESEARCH_WATERFALL: str = os.getenv("WEB_RESEARCH_WATERFALL", "website,brave")
WEB_RESEARCH_TARGET_CHARS: int = int(os.getenv("WEB_RESEARCH_TARGET_CHARS", "4000"))
WEB_RESEARCH_RUN_ALL_PROVIDERS: bool = os.getenv(
"WEB_RESEARCH_RUN_ALL_PROVIDERS",
"false",
).lower() in ("true", "1", "yes")
# --- Incremental Processing ---
INCREMENTAL_ENABLED: bool = os.getenv("INCREMENTAL_ENABLED", "true").lower() in ("true", "1", "yes")
PIPELINE_STATE_FILE: str = os.getenv("PIPELINE_STATE_FILE", ".pipeline_state.json")
# --- ICP Criteria (injected into prompt) ---
ICP_CRITERIA: str = os.getenv(
"ICP_CRITERIA",
(
"B2B SaaS companies with 50-500 employees, "
"strong product-market fit indicators, "
"actively investing in growth and technology, "
"decision-makers accessible and engaged, "
"budget availability signals present"
),
)
# --- Notion Property Name Mapping ---
# Input properties (read from Notion)
NOTION_PROP_COMPANY: str = os.getenv("NOTION_PROP_COMPANY", "Company")
NOTION_PROP_WEBSITE: str = os.getenv("NOTION_PROP_WEBSITE", "Website")
NOTION_PROP_NOTES: str = os.getenv("NOTION_PROP_NOTES", "Notes")
NOTION_PROP_LAST_CONTACTED: str = os.getenv("NOTION_PROP_LAST_CONTACTED", "Last Contacted")
NOTION_PROP_STATUS: str = os.getenv("NOTION_PROP_STATUS", "Status")
# Output properties (written by agents)
NOTION_PROP_ICP_SCORE: str = os.getenv("NOTION_PROP_ICP_SCORE", "icp_score")
NOTION_PROP_CONFIDENCE: str = os.getenv("NOTION_PROP_CONFIDENCE", "confidence_score")
NOTION_PROP_ICP_REASONING: str = os.getenv("NOTION_PROP_ICP_REASONING", "icp_reasoning")
NOTION_PROP_RESEARCH_BRIEF: str = os.getenv("NOTION_PROP_RESEARCH_BRIEF", "research_brief")
NOTION_PROP_PRIORITY_TIER: str = os.getenv("NOTION_PROP_PRIORITY_TIER", "priority_tier")
NOTION_PROP_PRIORITY_REASONING: str = os.getenv("NOTION_PROP_PRIORITY_REASONING", "priority_reasoning")
NOTION_PROP_STALE_FLAG: str = os.getenv("NOTION_PROP_STALE_FLAG", "stale_flag")
NOTION_PROP_NEXT_ACTION: str = os.getenv("NOTION_PROP_NEXT_ACTION", "next_action")
NOTION_PROP_ACTION_REASONING: str = os.getenv("NOTION_PROP_ACTION_REASONING", "action_reasoning")
NOTION_PROP_ACTION_CONFIDENCE: str = os.getenv("NOTION_PROP_ACTION_CONFIDENCE", "action_confidence")
NOTION_PROP_RESEARCH_CONFIDENCE: str = os.getenv("NOTION_PROP_RESEARCH_CONFIDENCE", "research_confidence")
NOTION_PROP_RESEARCH_CITATIONS: str = os.getenv("NOTION_PROP_RESEARCH_CITATIONS", "research_citations")
NOTION_PROP_RESEARCH_SOURCE_COUNT: str = os.getenv("NOTION_PROP_RESEARCH_SOURCE_COUNT", "research_source_count")
NOTION_PROP_RESEARCH_PROVIDERS: str = os.getenv("NOTION_PROP_RESEARCH_PROVIDERS", "research_providers")
NOTION_PROP_SIGNAL_TYPE: str = os.getenv("NOTION_PROP_SIGNAL_TYPE", "signal_type")
NOTION_PROP_SIGNAL_STRENGTH: str = os.getenv("NOTION_PROP_SIGNAL_STRENGTH", "signal_strength")
NOTION_PROP_SIGNAL_DATE: str = os.getenv("NOTION_PROP_SIGNAL_DATE", "signal_date")
NOTION_PROP_SIGNAL_REASONING: str = os.getenv("NOTION_PROP_SIGNAL_REASONING", "signal_reasoning")
@classmethod
def validate(cls, require_notion: bool = True) -> bool:
"""
Validate configuration with actionable error messages.
Args:
require_notion: If False, skip Notion key validation (for dry-run).
Raises:
ValueError with specific guidance on how to fix the issue.
"""
errors = []
# Claude API key
if not cls.CLAUDE_API_KEY:
errors.append(
"CLAUDE_API_KEY is missing.\n"
" Get one at: https://console.anthropic.com/settings/keys"
)
elif not cls.CLAUDE_API_KEY.startswith("sk-ant-"):
errors.append(
"CLAUDE_API_KEY doesn't look right (should start with 'sk-ant-').\n"
" Check: https://console.anthropic.com/settings/keys"
)
if require_notion:
# Notion API key
if not cls.NOTION_API_KEY:
errors.append(
"NOTION_API_KEY is missing.\n"
" Create an integration at: https://www.notion.so/my-integrations"
)
elif not (
cls.NOTION_API_KEY.startswith("secret_")
or cls.NOTION_API_KEY.startswith("ntn_")
):
errors.append(
"NOTION_API_KEY doesn't look right (should start with 'secret_' or 'ntn_').\n"
" Check: https://www.notion.so/my-integrations"
)
# Notion database ID
if not cls.NOTION_DATABASE_ID:
errors.append(
"NOTION_DATABASE_ID is missing.\n"
" Find it in your Notion database URL:\n"
" https://notion.so/workspace/[DATABASE_ID]?v=..."
)
elif len(cls.NOTION_DATABASE_ID.replace("-", "")) != 32:
errors.append(
"NOTION_DATABASE_ID doesn't look right (should be 32 hex characters).\n"
" Find it in your Notion database URL:\n"
" https://notion.so/workspace/[DATABASE_ID]?v=..."
)
if errors:
raise ValueError("\n\n".join(errors))
return True