Process Document and Abnormal Report Drafting for Petroleum Refining: Multi-turn Dialogue and Prompt Engineering

Data for petroleum refining process documents and abnormal reports comes from DCS/APC control systems, LIMS laboratory information management systems

What data for this use case looks like

Data for petroleum refining process documents and abnormal reports comes from DCS/APC control systems, LIMS laboratory information management systems, tank farm metering systems, crude oil evaluation reports, equipment management systems, and energy management systems. Data update frequencies fall into three categories: real-time, shift-based, and daily. Real-time data covers unit operating parameters. Shift-based data covers shift handover records and material balance sheets. Daily data covers quality reports and change management documents. Daily documents include operating procedures, production plans, interlock logs, and similar items. Fields cover process parameters, equipment status, quality indicators, and other categories. Units include flow rate, temperature, concentration, time, and other types.

Constraints for Multi-turn Dialogue and Prompt Engineering

Multiple continuous units are coupled via material and hydrogen networks. Feedstock properties fluctuate widely. This requires multi-turn dialogue to track associated parameters of different units to avoid context confusion. Data update frequencies vary across multiple data sources. Prompts must clearly distinguish the timing for calling real-time and batch data. This ensures the timeliness of data in drafted process documents and abnormal reports. Document types are diverse and fields are complex. Prompts must specify processing rules for different documents. For example, extract sulfur content parameters from crude oil evaluation reports, and extract unit load data from DCS systems. Abnormal report handling requires associating data from multiple systems. Multi-turn dialogue must support real-time pulling of information from different data sources. This ensures content accuracy and completeness.

Configuration Settings

Configuration ItemRecommended ApproachRationale
chatIdBind to the unique identifier of the current refinery unit groupRefinery multiple units operate in a coupled manner. chatId distinguishes dialogue contexts for different unit groups to avoid cross-unit parameter confusion
messagesRetain the last 30 rounds of dialogue content, with a total length not exceeding 12000 tokensProcess parameters are closely linked. Retaining multi-round records of crude oil property adjustments and unit load changes ensures context continuity
variablesConfigure crude oil density, sulfur content, and unit load rate as callable variablesCore refinery process parameters come from crude oil evaluation and DCS systems. These variables must be directly referenced in prompts to generate compliant documents
Maximum context length8000–12000 tokensThe total length of process documents and real-time data is large. Limiting context length prevents model processing overflow
Dialogue timeout period600 secondsDrafting abnormal reports requires waiting for data pulling from multiple systems. This duration covers most data aggregation scenarios and avoids excessive resource occupation

This configuration applies to FastGPT v4.17.0.

Three Common Misconfigurations

  • Failure to retrieve question content from each dialogue round. The symptom is that the dialogue component returns context containing only the latest query. The cause is incorrect binding of the chatId parameter and failure to retain complete dialogue history.
  • Failure to set the temperature parameter when configuring the large language model. The symptom is that no temperature setting button appears in the interface. The cause is that the custom model configuration switch is not enabled, or the reference entry for the temperature parameter is not added in the variable configuration.
  • Dialogue round-trip time far exceeds the call group duration. The symptom is that a single dialogue takes more than 600 seconds, but the call group only shows 1 minute. The cause is that no timeout retry logic for real-time data pulling is configured, leading to timeout when waiting for system data.

How to Verify Successful Configuration

  • Initiate a query covering crude oil sulfur content and catalytic unit load. Check whether the dialogue context contains historical queries and response content to confirm that the chatId binding is effective.
  • Check whether a temperature parameter setting item exists in the large language model configuration interface, or confirm that the reference entry for the temperature variable has been added in the variable configuration.
  • Initiate a request for abnormal report drafting. Check whether the dialogue duration matches the preset timeout threshold to confirm that the real-time data pulling logic is working properly.
  • After configuring the database connection plugin, perform a simulated query. Check whether process data from the corresponding system can be returned to confirm that the connection parameters and table field rule configuration are correct.

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