system-prompts-and-models-o.../salesflow-saas/backend/dealix_gtm_os/proof/source_quality.py
Claude bf91167350
feat: close 5 truth audit gaps — GTM routes + governance + proof + delivery
1. GTM API Routes: 12 endpoints at /api/v1/gtm/*
   - company-intelligence, score-target, outreach-pack
   - compliance-check, classify-reply, next-action
   - daily-command-pack, targets, approvals
   - approve-action, log-outcome
   All registered in router.py

2. Governance Module: 4 files
   - approval_queue.py: add/approve/reject/get_pending
   - action_policy.py: policy per action type
   - audit_log.py: log every proposed action
   - risk_flags.py: HIGH/LOW risk classification

3. Proof Module: 3 files
   - evidence.py: VERIFIED/INFERRED/UNVERIFIED/LOW_CONFIDENCE
   - claim_validator.py: blocks fake claims
   - source_quality.py: rates source reliability

4. Customer Delivery: 2 files
   - customer_workspace.py: Pydantic model with onboarding checklist
   - customer_delivery_pipeline.py: create workspace + weekly report

5. All verified: 9/9 new imports pass, 30/30 evals, dry-run works

https://claude.ai/code/session_01W1rJthWDkasijTdXCfxVHs
2026-04-27 00:41:40 +00:00

21 lines
703 B
Python

"""Source quality — rates the reliability of evidence sources."""
SOURCE_RATINGS = {
"company_website": 0.8,
"uploaded_file": 0.9,
"google_search": 0.6,
"tavily": 0.7,
"manual_input": 1.0,
"llm_inference": 0.4,
"mock": 0.3,
"unknown": 0.1,
}
def rate_source(source_type: str) -> float:
return SOURCE_RATINGS.get(source_type, 0.2)
def rate_sources(sources: list[str]) -> dict:
if not sources:
return {"average_quality": 0.0, "best_source": None, "count": 0}
ratings = [rate_source(s) for s in sources]
return {"average_quality": round(sum(ratings) / len(ratings), 2), "best_source": sources[ratings.index(max(ratings))], "count": len(sources)}