Cosmetics Production Ledger Summary and Report Generation: Multi-turn Dialogue and Prompt Engineering

This category of data comes from daily production documents of skincare, haircare, makeup, and special cosmetics manufacturers. Documents include

What this category of data looks like

This category of data comes from daily production documents of skincare, haircare, makeup, and special cosmetics manufacturers. Documents include formula process sheets, weighing and feeding records, emulsification and filling records, cleaning and site clearance records, semi-finished and finished product inspection reports, and label review materials. Data sources cover registered and filed formulas, raw material safety materials, production equipment, ERP/MES systems, laboratory data, and packaging material version information. Updates occur with each production batch or each line change. Fields include raw material components, feeding quantities, production parameters, inspection results, batch numbers, and packaging material information, among others.

What constraints do these characteristics impose on multi-turn dialogue and prompt engineering

Data for this category is updated per batch or line change, and involves filing and compliance requirements. Multi-turn dialogue must be bound to specific production batch context to avoid mixing data across batches. Daily documents include multiple types of structured and unstructured fields. Prompt engineering must guide users to provide complete data for feeding, inspection, cleaning, and other production links in sequence. This prevents omission of key information such as formula components and restricted substance content. Data sources cover multiple systems. Prompt engineering must support associating ledger data from different sources to ensure consistency during summarization. It must also embed compliance check prompts in dialogue to reduce risks such as formula-filing mismatches and incorrect labeling.

Configuration Settings

The following configurations are based on FastGPT v4.17.0:

Configuration ItemRecommended SettingRationale
Dialogue context windowRetain the most recent 20 messagesThe volume of full-process dialogue data for a single production batch is moderate. 20 entries are sufficient to cover the complete question chain from feeding to finished product inspection.
Session identifier bindingArchive dialogue records by chatIdMatches the independent management requirements of production batches. This facilitates subsequent traceability of the ledger summary process for the corresponding batch.
Global variable configurationBind production batch numbers and workshop information from variablesEnsures each round of dialogue is associated with exclusive data for the corresponding production scenario. This avoids confusion of ledgers across different batches.
Tool trigger ruleTrigger when keywords related to formulas, inspections, or cleaning are detectedAutomatically call ledger documents for the corresponding production link. This improves summarization efficiency.
Empty result handlingPrompt for supplementary key information when messages returns emptyAddresses empty result issues in actual usage. This avoids blank displays on the frontend.
Context length limitSet to 8000–12000 token based on actual testingCovers the complete content of multiple types of production documents. This prevents truncation of key compliance information.
Timeout settingSet to 60 secondsMatches the typical delay of data returned by production equipment and ERP systems.

Three Common Misconfigurations

  • Phenomenon: The AI dialogue node returns empty or an error prompt, and the frontend displays blank results. Cause: No branch processing logic is configured for empty messages or large model call failures. The original return result is directly passed through.
  • Phenomenon: When calling the chart tool to generate a production ledger chart, the chart displays as empty. Cause: The variables data for the corresponding batch is not explicitly bound in the prompt engineering. The tool cannot obtain correct ledger parameters.
  • Phenomenon: Attempts to delete dialogue records fail, and the request returns an abnormal status code. Cause: The chatId parameter is not correctly associated. The system cannot locate the target dialogue record.

How to Verify Successful Configuration

  • Initiate a query for a single batch production ledger. Check whether the dialogue context retains key information for that batch.
  • Trigger a tool call. Verify that bound variables field data can be correctly obtained.
  • Simulate a scenario where the large model returns empty. Check whether the preset error prompt logic is triggered.
  • After initiating a dialogue, verify through the dialogue management interface that the chatId is correctly associated with the current session.

The values provided here are common starting points and should be evaluated against the reader's own samples.