Process Document and Abnormal Report Drafting for Petroleum Refining: Tool Calling and Plugins

Data sources for petroleum refining scenarios include DCS/APC control systems, LIMS laboratory management systems, tank farm metering systems, crude

What data looks like for this category

Data sources for petroleum refining scenarios include DCS/APC control systems, LIMS laboratory management systems, tank farm metering systems, crude oil evaluation databases, equipment management systems, and energy management systems. Data update frequencies fall into three categories: real-time (unit operation parameters), shift-based (shift handover records, material balance data), and daily (distillate quality reports, change management documents).

Daily documents include operating procedures, production plans, material balance sheets, distillate quality reports, interlock ledgers, shift handover records, and change management documents. Fields include crude oil density (unit kg/m³), unit load (unit t/h), distillation range temperature (unit ℃), material flow rate (unit m³/h), and operation timestamps, among others.

What constraints these characteristics impose on the "tool calling and plugins" workflow

The varying update frequencies of multi-source heterogeneous data require tool calling to support data retrieval across different cycles, to prevent process document errors caused by insufficient data timeliness.

The diversity of document structures and fields requires plugins to adapt to parsing rules for different documents, to accurately extract corresponding fields for report drafting.

The business logic of coupled multiple units requires tool calling to associate data from multiple systems simultaneously, to avoid one-sided analysis from a single data source.

Scenarios with high real-time requirements require tool calling to configure timeout and retry mechanisms, to respond to temporary system fluctuations.

How to configure the settings

The following configurations are based on FastGPT v4.17.0.

Configuration ItemRecommended SettingRationale
Workflow/API tool selectionautoAdapts to multi-tool calling scenarios, automatically selecting tools required for process data retrieval and anomaly analysis, covering the full workflow of process document and abnormal report drafting
Tool call timeout duration600 secondsPetroleum refining data retrieval involves cross-system interactions; 600 seconds covers the complete retrieval cycle for multi-source data such as DCS and LIMS
Tool call retry count2–3 timesReal-time data sources may experience temporary network fluctuations; retries reduce the probability of data retrieval failure
Workflow/API function-call configurationMandatorily specify the two tools of process data retrieval and anomaly analysisPetroleum refining scenarios require fixed calls to specific system data, to prevent tool calling from deviating from business objectives
Parallel call limit for multiple data sourcesTop 3In coupled refining scenarios with multiple units, excessive parallel retrieval increases system load; 3 balances efficiency and resource usage
Abnormal report trigger thresholdCalibrated through actual measurementAdjust parameter conditions that trigger abnormal reports in combination with actual business rules such as unit interlocks and quality deviations

Three common mistakes

  • A cross-domain error occurs when calling the api/v1/chat/completions interface, with CORS-related prompts displayed in the front-end console. The cause is that allowed cross-domain origins and request headers are not configured in the FastGPT backend.
  • Tool calling returns empty results or lengthy error codes, and DCS or LIMS data cannot be retrieved. The cause is that the API key forwarding rules of aiproxy are not correctly configured, causing the system to fail to obtain model calling permissions.
  • Tool calling fails after a new version is deployed, with a prompt that the MCP service is not found. The cause is that the MCP server is not deployed and the corresponding service address is not associated in the FastGPT backend.

How to confirm configurations are correctly applied

  • Call the api/v1/chat/completions interface, and check whether the returned results include tool calling logs and data retrieval records.
  • Simulate a process anomaly scenario, trigger abnormal report drafting, and confirm whether the tool automatically retrieves real-time data from the corresponding data source.
  • View the tool calling monitoring panel in the FastGPT backend, and confirm that the retry count and timeout duration configurations have taken effect.
  • Test cross-domain requests, and confirm that no CORS errors occur when the front-end calls the interface.

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