dhisana 0.0.1.dev254__py3-none-any.whl → 0.0.1.dev256__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dhisana/utils/generate_email_response.py +132 -117
- dhisana/utils/test_connect.py +48 -0
- {dhisana-0.0.1.dev254.dist-info → dhisana-0.0.1.dev256.dist-info}/METADATA +1 -1
- {dhisana-0.0.1.dev254.dist-info → dhisana-0.0.1.dev256.dist-info}/RECORD +7 -7
- {dhisana-0.0.1.dev254.dist-info → dhisana-0.0.1.dev256.dist-info}/WHEEL +0 -0
- {dhisana-0.0.1.dev254.dist-info → dhisana-0.0.1.dev256.dist-info}/entry_points.txt +0 -0
- {dhisana-0.0.1.dev254.dist-info → dhisana-0.0.1.dev256.dist-info}/top_level.txt +0 -0
|
@@ -246,129 +246,144 @@ async def generate_inbound_email_response_copy(
|
|
|
246
246
|
sender_data = cleaned_context.sender_info or SenderInfo()
|
|
247
247
|
|
|
248
248
|
prompt = f"""
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
Do not
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
249
|
+
You are a B2B account executive replying to warm inbound or engaged leads.
|
|
250
|
+
|
|
251
|
+
Your goal is to sound natural, helpful, and human while following all triage,
|
|
252
|
+
compliance, and action rules below.
|
|
253
|
+
|
|
254
|
+
Write responses the way a strong AE would type them, not like a system message.
|
|
255
|
+
|
|
256
|
+
=====================================================
|
|
257
|
+
INPUT CONTEXT
|
|
258
|
+
=====================================================
|
|
259
|
+
|
|
260
|
+
1) Email thread to respond to:
|
|
261
|
+
{[thread_item.model_dump() for thread_item in cleaned_context.current_conversation_context.current_email_thread]
|
|
262
|
+
if cleaned_context.current_conversation_context.current_email_thread else []}
|
|
263
|
+
|
|
264
|
+
2) Lead information:
|
|
265
|
+
{lead_data.dict()}
|
|
266
|
+
|
|
267
|
+
Sender information:
|
|
268
|
+
- Full name: {sender_data.sender_full_name or ''}
|
|
269
|
+
- First name: {sender_data.sender_first_name or ''}
|
|
270
|
+
- Last name: {sender_data.sender_last_name or ''}
|
|
271
|
+
- Bio: {sender_data.sender_bio or ''}
|
|
272
|
+
|
|
273
|
+
3) Campaign-specific triage guidelines
|
|
274
|
+
(User overrides always take priority):
|
|
275
|
+
{cleaned_context.campaign_context.email_triage_guidelines}
|
|
276
|
+
|
|
277
|
+
=====================================================
|
|
278
|
+
TRIAGE DECISION LOGIC
|
|
279
|
+
=====================================================
|
|
280
|
+
|
|
281
|
+
Decide first. Write second.
|
|
282
|
+
|
|
283
|
+
• Routine, non-sensitive, clearly actionable
|
|
284
|
+
→ triage_status = "AUTOMATIC"
|
|
285
|
+
|
|
286
|
+
• PII, finance, legal, contracts, compliance, NSFW,
|
|
287
|
+
or document requests
|
|
288
|
+
→ triage_status = "END_CONVERSATION"
|
|
289
|
+
→ Include a brief triage_reason
|
|
290
|
+
|
|
291
|
+
=====================================================
|
|
292
|
+
ACTION SELECTION
|
|
293
|
+
=====================================================
|
|
294
|
+
|
|
295
|
+
Choose exactly ONE action from:
|
|
296
|
+
{allowed_actions}
|
|
297
|
+
|
|
298
|
+
Priority order:
|
|
299
|
+
1. UNSUBSCRIBE
|
|
300
|
+
2. NOT_INTERESTED
|
|
301
|
+
3. OOF_MESSAGE
|
|
302
|
+
4. SCHEDULE_MEETING
|
|
303
|
+
5. FORWARD_TO_OTHER_USER
|
|
304
|
+
6. NEED_MORE_INFO
|
|
305
|
+
7. OBJECTION_RAISED
|
|
306
|
+
8. SEND_REPLY
|
|
307
|
+
9. END_CONVERSATION
|
|
308
|
+
|
|
309
|
+
=====================================================
|
|
310
|
+
HOW THE RESPONSE SHOULD SOUND
|
|
311
|
+
=====================================================
|
|
312
|
+
|
|
313
|
+
This is a warm lead. Assume positive intent.
|
|
314
|
+
|
|
315
|
+
• Friendly, relaxed, and conversational
|
|
316
|
+
• Short sentences. Natural pacing.
|
|
317
|
+
• One clear idea per paragraph
|
|
318
|
+
• No sales pressure. No hype. No buzzwords.
|
|
319
|
+
• Helpful first. Next step second.
|
|
320
|
+
|
|
321
|
+
Think:
|
|
322
|
+
"Thanks for reaching out. Happy to help."
|
|
323
|
+
Not:
|
|
324
|
+
"Thank you for your inquiry regarding..."
|
|
325
|
+
|
|
326
|
+
=====================================================
|
|
327
|
+
RESPONSE STRUCTURE (LOOSE, NOT FORMAL)
|
|
328
|
+
=====================================================
|
|
329
|
+
|
|
330
|
+
Typical flow:
|
|
331
|
+
1. Quick thank-you or acknowledgement
|
|
332
|
+
2. Briefly mirror what they said or asked
|
|
333
|
+
3. Answer or clarify in plain language
|
|
334
|
+
4. Suggest a simple next step, if appropriate
|
|
335
|
+
|
|
336
|
+
Do not force all steps if it feels unnatural.
|
|
337
|
+
|
|
338
|
+
=====================================================
|
|
339
|
+
HARD RULES
|
|
340
|
+
=====================================================
|
|
341
|
+
|
|
342
|
+
• Plain text only. No HTML.
|
|
343
|
+
• Do not repeat previous messages verbatim.
|
|
344
|
+
• Do not invent information, pricing, links, or docs.
|
|
345
|
+
• If a link exists in the inbound email, reuse it exactly.
|
|
346
|
+
• Do not add new links or attachments.
|
|
347
|
+
• If documents are requested, END_CONVERSATION.
|
|
348
|
+
• Never contradict or disparage {campaign_context.lead_info.organization_name}.
|
|
349
|
+
• Do not spam or over-message.
|
|
350
|
+
|
|
351
|
+
=====================================================
|
|
352
|
+
NAMING AND STYLE
|
|
353
|
+
=====================================================
|
|
354
|
+
|
|
355
|
+
• Use conversational company name
|
|
356
|
+
• Use conversational lead first name
|
|
357
|
+
• Do not use special characters or spaces when referencing lead first name
|
|
358
|
+
• Signature must include sender_first_name exactly as provided
|
|
359
|
+
• Preserve clean spacing and newlines
|
|
360
|
+
• Do NOT use em dash
|
|
361
|
+
• Keep it human. Avoid templates.
|
|
362
|
+
|
|
363
|
+
=====================================================
|
|
364
|
+
OUTPUT FORMAT (STRICT JSON)
|
|
365
|
+
=====================================================
|
|
366
|
+
|
|
367
|
+
Return valid JSON only.
|
|
368
|
+
|
|
369
|
+
{
|
|
361
370
|
"triage_status": "AUTOMATIC" or "END_CONVERSATION",
|
|
362
|
-
"triage_reason": "<
|
|
371
|
+
"triage_reason": "<string if END_CONVERSATION, otherwise null>",
|
|
363
372
|
"response_action_to_take": "one of {allowed_actions}",
|
|
364
|
-
"response_message": "<
|
|
365
|
-
}
|
|
373
|
+
"response_message": "<reply body only if SEND_REPLY or SCHEDULE_MEETING, otherwise empty>"
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
=====================================================
|
|
377
|
+
SYSTEM CONTEXT
|
|
378
|
+
=====================================================
|
|
366
379
|
|
|
367
|
-
Current date
|
|
368
|
-
|
|
380
|
+
• Current date: {current_date_iso}
|
|
381
|
+
• Use only provided context
|
|
382
|
+
• If unsure, choose END_CONVERSATION
|
|
369
383
|
"""
|
|
370
384
|
|
|
371
385
|
|
|
386
|
+
|
|
372
387
|
# If there's a vector store ID, use that approach
|
|
373
388
|
if (
|
|
374
389
|
cleaned_context.external_known_data
|
dhisana/utils/test_connect.py
CHANGED
|
@@ -1561,6 +1561,36 @@ async def test_dialpad(client_id: str, client_secret: str) -> Dict[str, Any]:
|
|
|
1561
1561
|
return {"success": False, "status_code": 0, "error_message": str(exc)}
|
|
1562
1562
|
|
|
1563
1563
|
|
|
1564
|
+
async def test_twilio(account_sid: str, auth_token: str) -> Dict[str, Any]:
|
|
1565
|
+
"""
|
|
1566
|
+
Validate Twilio credentials via a lightweight authenticated call.
|
|
1567
|
+
Uses HTTP Basic Auth (account_sid:auth_token) to fetch account info.
|
|
1568
|
+
"""
|
|
1569
|
+
url = f"https://api.twilio.com/2010-04-01/Accounts/{account_sid}.json"
|
|
1570
|
+
|
|
1571
|
+
try:
|
|
1572
|
+
auth = aiohttp.BasicAuth(account_sid, auth_token)
|
|
1573
|
+
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10), auth=auth) as session:
|
|
1574
|
+
async with session.get(url) as response:
|
|
1575
|
+
status = response.status
|
|
1576
|
+
data = await safe_json(response)
|
|
1577
|
+
|
|
1578
|
+
if status == 200 and isinstance(data, dict) and "sid" in data:
|
|
1579
|
+
return {"success": True, "status_code": status, "error_message": None}
|
|
1580
|
+
|
|
1581
|
+
message = None
|
|
1582
|
+
if isinstance(data, dict):
|
|
1583
|
+
message = data.get("message") or data.get("error")
|
|
1584
|
+
return {
|
|
1585
|
+
"success": False,
|
|
1586
|
+
"status_code": status,
|
|
1587
|
+
"error_message": message or f"Twilio responded with {status}",
|
|
1588
|
+
}
|
|
1589
|
+
except Exception as exc:
|
|
1590
|
+
logger.error(f"Twilio connectivity test failed: {exc}")
|
|
1591
|
+
return {"success": False, "status_code": 0, "error_message": str(exc)}
|
|
1592
|
+
|
|
1593
|
+
|
|
1564
1594
|
async def test_nooks(api_key: str) -> Dict[str, Any]:
|
|
1565
1595
|
"""
|
|
1566
1596
|
Validate Nooks.ai API key via a simple authenticated call.
|
|
@@ -1880,6 +1910,7 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
|
|
|
1880
1910
|
"aircall": test_aircall, # handled specially to pass appId + apiToken
|
|
1881
1911
|
"ringover": test_ringover,
|
|
1882
1912
|
"dialpad": test_dialpad, # handled specially to pass client credentials
|
|
1913
|
+
"twilio": test_twilio, # handled specially to pass account_sid + auth_token
|
|
1883
1914
|
"nooks": test_nooks,
|
|
1884
1915
|
"commonRoom": test_commonroom,
|
|
1885
1916
|
"scarf": test_scarf,
|
|
@@ -2097,6 +2128,23 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
|
|
|
2097
2128
|
results[tool_name] = await test_dialpad(client_id, client_secret)
|
|
2098
2129
|
continue
|
|
2099
2130
|
|
|
2131
|
+
# ------------------------------------------------------------------ #
|
|
2132
|
+
# Special-case: Twilio (account_sid + auth_token)
|
|
2133
|
+
# ------------------------------------------------------------------ #
|
|
2134
|
+
if tool_name == "twilio":
|
|
2135
|
+
account_sid = next((c["value"] for c in config_entries if c["name"] in ("accountSid", "account_sid")), None)
|
|
2136
|
+
auth_token = next((c["value"] for c in config_entries if c["name"] in ("authToken", "auth_token")), None)
|
|
2137
|
+
if not account_sid or not auth_token:
|
|
2138
|
+
results[tool_name] = {
|
|
2139
|
+
"success": False,
|
|
2140
|
+
"status_code": 0,
|
|
2141
|
+
"error_message": "Missing accountSid or authToken for Twilio.",
|
|
2142
|
+
}
|
|
2143
|
+
else:
|
|
2144
|
+
logger.info("Testing connectivity for Twilio…")
|
|
2145
|
+
results[tool_name] = await test_twilio(account_sid, auth_token)
|
|
2146
|
+
continue
|
|
2147
|
+
|
|
2100
2148
|
# ------------------------------------------------------------------ #
|
|
2101
2149
|
# All other tools – expect an apiKey by default
|
|
2102
2150
|
# ------------------------------------------------------------------ #
|
|
@@ -40,7 +40,7 @@ dhisana/utils/g2_tools.py,sha256=a4vmBYCBvLae5CdpOhMN1oNlvO8v9J1B5Sd8T5PzuU8,334
|
|
|
40
40
|
dhisana/utils/generate_content.py,sha256=kkf-aPuA32BNgwk_j5N6unYHOZpO7zIfO6zP95XM9fA,2298
|
|
41
41
|
dhisana/utils/generate_custom_message.py,sha256=_m_8akk5eHyD6nNvzbhnFVmOp_v14rB-jDTVKk1PHOQ,11988
|
|
42
42
|
dhisana/utils/generate_email.py,sha256=YUhrku9meo3ee5Ft2ybtLTUTAfUf4quPmJp9hmSkdzM,12895
|
|
43
|
-
dhisana/utils/generate_email_response.py,sha256=
|
|
43
|
+
dhisana/utils/generate_email_response.py,sha256=lFcpgOthpce4tSoB8xhlqD5yVEC_nJrFvyJYoZZ0z6E,19420
|
|
44
44
|
dhisana/utils/generate_flow.py,sha256=QMn6bWo0nH0fBvy2Ebub1XfH5udnVAqsPsbIqCtQPXU,4728
|
|
45
45
|
dhisana/utils/generate_leads_salesnav.py,sha256=AONP1KXDJdg95JQBmKx5PQXUD2BHctc-MZOMuRfuK9U,12156
|
|
46
46
|
dhisana/utils/generate_linkedin_connect_message.py,sha256=WZThEun-DMuAOqlzMI--hGmrDuQUYEb4Hl2DoMv3s80,9885
|
|
@@ -81,7 +81,7 @@ dhisana/utils/serperdev_google_jobs.py,sha256=m5_2f_5y79FOFZz1A_go6m0hIUfbbAoZ0Y
|
|
|
81
81
|
dhisana/utils/serperdev_local_business.py,sha256=JoZfTg58Hojv61cyuwA2lcnPdLT1lawnWaBNrUYWnuQ,6447
|
|
82
82
|
dhisana/utils/serperdev_search.py,sha256=_iBKIfHMq4gFv5StYz58eArriygoi1zW6VnLlux8vto,9363
|
|
83
83
|
dhisana/utils/smtp_email_tools.py,sha256=J9uDHCEu2BTyFzDBru0e1lC8bsAMt9c_mYXTzJgk9Kc,22054
|
|
84
|
-
dhisana/utils/test_connect.py,sha256=
|
|
84
|
+
dhisana/utils/test_connect.py,sha256=YCweFyTRWSP3iwR3uLE0VWLIOK1qHY2OI4oNe6pCV_Y,92403
|
|
85
85
|
dhisana/utils/trasform_json.py,sha256=7V72XNDpuxUX0GHN5D83z4anj_gIf5zabaHeQm7b1_E,6979
|
|
86
86
|
dhisana/utils/web_download_parse_tools.py,sha256=ouXwH7CmjcRjoBfP5BWat86MvcGO-8rLCmWQe_eZKjc,7810
|
|
87
87
|
dhisana/utils/workflow_code_model.py,sha256=YPWse5vBb3O6Km2PvKh1Q3AB8qBkzLt1CrR5xOL9Mro,99
|
|
@@ -95,8 +95,8 @@ dhisana/workflow/agent.py,sha256=esv7_i_XuMkV2j1nz_UlsHov_m6X5WZZiZm_tG4OBHU,565
|
|
|
95
95
|
dhisana/workflow/flow.py,sha256=xWE3qQbM7j2B3FH8XnY3zOL_QXX4LbTW4ArndnEYJE0,1638
|
|
96
96
|
dhisana/workflow/task.py,sha256=HlWz9mtrwLYByoSnePOemBUBrMEcj7KbgNjEE1oF5wo,1830
|
|
97
97
|
dhisana/workflow/test.py,sha256=E7lRnXK0PguTNzyasHytLzTJdkqIPxG5_4qk4hMEeKc,3399
|
|
98
|
-
dhisana-0.0.1.
|
|
99
|
-
dhisana-0.0.1.
|
|
100
|
-
dhisana-0.0.1.
|
|
101
|
-
dhisana-0.0.1.
|
|
102
|
-
dhisana-0.0.1.
|
|
98
|
+
dhisana-0.0.1.dev256.dist-info/METADATA,sha256=HagswDBVW-DaxEac9yaFUTjSBvGCMD2lNetMk-Iqe-s,1190
|
|
99
|
+
dhisana-0.0.1.dev256.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
dhisana-0.0.1.dev256.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
|
|
101
|
+
dhisana-0.0.1.dev256.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
|
|
102
|
+
dhisana-0.0.1.dev256.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|