Quality Problem Traceability and Defect Analysis for Petroleum Refining: Multi-turn Dialogue and Prompt Engineering

Petroleum refining scenario data sources include DCS/APC real-time process systems, LIMS laboratory information management systems, tank farm metering

What the Data for This Category Looks Like

Petroleum refining scenario data sources include DCS/APC real-time process systems, LIMS laboratory information management systems, tank farm metering systems, crude oil evaluation databases, equipment management systems, and energy management systems. Daily documents include operating procedures, production plans, material balance sheets, distillate export quality reports, interlock logs, shift handover records, and change management documents. Data update frequencies fall into three categories: real-time (process parameters), per shift (shift handover records), and daily (material balance and quality reports). Core fields include process temperature, pressure, and flow, with units of ℃, MPa, and m³/h respectively, as well as oil sulfur content, cetane number, tank farm liquid level, crude oil grade, and other relevant fields.

Constraints Imposed on Multi-turn Dialogue and Prompt Engineering

For multiple continuous units coupled via material and hydrogen networks, multi-turn dialogue must associate historical parameters across different units. Isolated analysis of single-unit data must be avoided. For multi-source heterogeneous data with differing update frequencies, prompt engineering must explicitly specify data retrieval periods and source systems. Invalid data recall across time periods and systems must be prevented. For diverse document types and exclusive business fields, prompt engineering must preset core variables such as crude oil grade and unit number. Use these variables to quickly locate matching business documents and data.

Configuration Settings

This configuration is based on FastGPT v4.17.0.

Configuration ItemRecommended SettingRationale
Context window size8000–12000 tokenCovers process data from coupled multiple units and multi-turn traceability dialogues, avoiding loss of critical information
chatIdSession identifier bound to a single production unitDistinguishes traceability data for different units, preventing cross-unit context confusion
messagesRetain the most recent 20 dialogue turns and the first 3 core process adjustment recordsLinks earlier operations to current issues, supporting complete traceability logic
variablesPreset variables for crude oil grade, unit number, and laboratory test dateMatches core business fields in petroleum refining scenarios, enabling quick location of associated data
Tool call trigger threshold0.75–0.85Accurately matches the correlation between process parameters and issues, reducing invalid tool calls

Three Common Configuration Errors

  • When configuring the MySQL tool, calls return a 400 status code (no body). This occurs when database connection parameters in variables are not correctly bound, or the chatId does not carry a valid session identifier, leading to non-standard request formatting.
  • Switching models or adding internet call buttons in the current dialogue is not possible. This occurs when model switching permissions are not enabled in the messages context configuration, or call variables for the corresponding model are not preset.
  • Retrieved distillate export quality data does not match actual values. This occurs when the prompt does not limit the laboratory test date range in variables, leading to recall of cross-period data.

How to Verify Successful Configuration

  • Initiate a query containing preset variables fields. Verify that the system automatically associates historical data corresponding to the crude oil grade and unit number.
  • Initiate two or more consecutive dialogues. Check that the messages context retains the specified number of historical records, with no unnecessary information truncation.
  • Call the configured database tool to query specified process parameters. Verify that returned results match real-time data from DCS/APC systems.
  • Perform a session cleanup operation in the chatId dimension. Verify that historical records for the corresponding session are completely cleared.

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