ERP applications and tools for AMF
The monthly Operations KPI Report can enrich its deterministic KPI snapshot
with bilingual, evidence-backed OpenAI insights.
Configuration:
- Install
requirements.txtin the target bench Python environment, then runbench --site <site> migrateandbench restart. Example from the bench root:./env/bin/pip install -r apps/amf/requirements.txt. - Enter the API key in the Single
Operations KPI Report SettingsDocType. AMF encrypts it with the site's encryption key into a Long Text field, avoiding Frappe v12's short__Auth.passwordcolumn. The key is never displayed again after saving.OPENAI_API_KEYremains an optional deployment fallback. - Enable
AI Insights, select the model and confidence threshold, and keepRequire Human Approvalenabled for controlled distribution. Each report has an editableGenerate AI Insightscheckbox, enabled by default. - Generate a monthly or semester report. Validated AI output is stored on the report for review but is excluded from files and email until approved.
For reliable monthly and comparative reports, keep AI reasoning on low, use a
timeout close to 600 seconds, and limit the maximum insights to about 10.
Higher reasoning with the maximum 15 insights can exceed the OpenAI read
timeout on larger KPI snapshots.
Reports can run in Single Period or Comparative mode. Comparative mode
keeps the primary month/semester calculations intact, adds a selected comparison
month/semester, stores primary-versus-comparison KPI deltas in the snapshot, and
asks the AI to prioritize evidence-backed evolution insights.
The KPI calculations remain authoritative. The AI receives a bounded snapshot,
external parties and transaction identifiers are aliased by default, API
storage is disabled with store=False, Issue root-cause free text is excluded
unless explicitly enabled, and every retained insight must cite a real
leaf-level source path. Evidence values are replaced server-side with the
canonical values from the snapshot before storage.
The read-only investigation methods in
amf.amf.utils.operations_ai_tools expose bounded OTIF, shortfall, machining
scrap, shipping issue and procurement exception details. They do not provide
SQL execution, document mutation, email or other outbound actions.
AGPL