-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathds_41_features.py
More file actions
136 lines (121 loc) · 5.26 KB
/
ds_41_features.py
File metadata and controls
136 lines (121 loc) · 5.26 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
"""VynFi DataSynth 4.1.x — exercise the new config subsections end-to-end.
DS 4.1.x / VynFi API 4.1.x added seven new config surfaces to
``POST /v1/generate``. This example wires them all into a single
generation job, waits for completion, and inspects the archive to confirm
that each feature produced observable output.
Sections exercised:
- ``analyticsMetadata`` — prior-year benchmarks + industry peers +
management reports + drift events
- ``audit`` — workpapers + IT controls + review delay model
- ``complianceRegulations`` — legal documents + opinions
- ``accountingStandards`` — IFRS 16 leases, fair value, framework
differences
- ``interconnectivity`` — vendor tiers / customer segments / industry
metadata (Scale+)
- ``templates.packId`` — link a user-uploaded template pack (optional;
commented out because it needs a pre-created pack)
- ``llm.enrichmentEnabled`` — switch on LLM-backed enrichments in the
generation pipeline
Tier notes:
- ``interconnectivity.*`` requires Scale+.
- ``complianceRegulations.legalDocumentsEnabled`` requires Team+.
- ``llm.enrichmentEnabled`` requires Scale+ and a configured portal LLM.
"""
from __future__ import annotations
import os
import vynfi
client = vynfi.VynFi(api_key=os.environ["VYNFI_API_KEY"], timeout=120.0)
config = {
"sector": "manufacturing",
"country": "CH",
"accountingFramework": "ifrs",
"rows": 400,
"companies": 2,
"periods": 2,
"periodLength": "quarterly",
"processModels": ["o2c", "p2p", "h2r", "audit"],
"exportFormat": "json",
"fraudPacks": ["vendor_kickback"],
"fraudRate": 0.03,
# ── DS 4.1: analytics metadata ──────────────────────────────────
"analyticsMetadata": {
"enabled": True,
"priorYear": True,
"industryBenchmark": "manufacturing_ch_midsize",
"managementReports": ["cash_flow", "opex_by_function"],
# Synthetic drift events let anomaly detectors learn to ignore them.
"driftEvents": [
{"period": 2, "type": "cost_inflation", "magnitude": 0.08},
],
},
# ── DS 4.1: audit workpapers + IT controls ──────────────────────
"audit": {
"enabled": True,
"generateWorkpapers": True,
"itControls": True,
"minTeamSize": 3,
"maxTeamSize": 6,
"workpapersAveragePerPhase": 12,
"averageReviewDelayDays": 2,
},
# ── DS 4.1: compliance regulations (Team+) ─────────────────────
"complianceRegulations": {
"legalDocumentsEnabled": True,
"legalOpinionProbability": 0.15,
},
# ── DS 4.1: accounting standards ───────────────────────────────
"accountingStandards": {
"enabled": True,
"framework": "ifrs",
"leasesEnabled": True, # IFRS 16
"fairValueEnabled": True, # IFRS 13
"generateDifferences": True, # US GAAP ↔ IFRS reconciliation
},
# ── DS 4.1: interconnectivity (Scale+) ─────────────────────────
"interconnectivity": {
"vendorNetworkEnabled": True,
"customerSegmentationEnabled": True,
"industrySpecificEnabled": True,
},
# ── DS 4.1: templates (needs a pre-uploaded pack) ──────────────
# "templates": {"packId": "<uuid of a pack you own>"},
# ── DS 4.1: LLM enrichment (Scale+) ────────────────────────────
"llm": {
"enrichmentEnabled": True,
"modelId": "anthropic/claude-sonnet-4.5",
},
}
print("Submitting DS 4.1 feature-matrix job …")
job = client.jobs.generate_config(config=config)
print(f" job {job.id}")
done = client.jobs.wait(job.id, timeout=420)
print(f" status {done.status}")
if done.status != "completed":
raise SystemExit(done.error_detail or "Generation did not complete.")
# ── Group the archive paths by top-level directory to see what landed ───────
files = client.jobs.list_files(job.id)
grouped: dict[str, list[str]] = {}
for f in files.files:
top, sep, rest = f.path.partition("/")
group = top if sep else "(root)"
grouped.setdefault(group, []).append(rest if sep else top)
print(f"\nArchive contents ({files.total_files} files):")
for group, entries in sorted(grouped.items()):
label = "(root)" if group == "(root)" else f"{group}/"
print(f" {label} ({len(entries)} files)")
for entry in sorted(entries)[:4]:
print(f" {entry}")
if len(entries) > 4:
print(f" … and {len(entries) - 4} more")
# ── Bonus: use the aggregated audit-artifacts endpoint ────────────────────
try:
art = client.jobs.audit_artifacts(job.id)
n_op = len(art.audit_opinions or [])
n_kam = len(art.key_audit_matters or [])
print(f"\naudit_artifacts(): {n_op} opinions, {n_kam} KAMs")
except vynfi.NotFoundError:
print(
"\naudit_artifacts(): no audit/*.json materialized on this run — "
"the audit pipeline is best-effort on DS 4.1.x and only emits "
"when findings warrant."
)