Production Ledger Summary and Report Generation for Pharmaceutical Preparations Manufacturing: Tool Calling and Plugins

Ledger data for pharmaceutical preparations manufacturing comes from approved formulation processes, material batch information, electronic batch

What the data for this category looks like

Ledger data for pharmaceutical preparations manufacturing comes from approved formulation processes, material batch information, electronic batch records from MES systems, equipment and environmental monitoring data, test results from LIMS systems, and deviation and change records from quality management systems. Data is updated per production batch, each key process step execution, and per fixed monitoring plans. Daily documents include master production files, batch production records, batch packaging records, cleaning records, test records, deviation/CAPA/change records, and batch release review forms. Fields include material batch numbers, process execution parameters, environmental monitoring values, test results, deviation descriptions, approval status, and more. There are no universal standard units, and industry standard units for corresponding business fields must be used.

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

Data for this category is scattered across multiple heterogeneous systems. Tool calling must support connecting to multiple types of data sources including MES, LIMS, and quality management systems, to avoid incomplete ledger summaries caused by data silos. Data updates are tied to production batches and process steps, so tool trigger timing must match production nodes to ensure obtained ledger data aligns with current production status. Document fields have no unified format, so precise extraction of specified business fields is required, and tool calling must support custom field mapping rules. GMP requirements mandate complete and traceable data, so tool return results must retain original data sources and operation logs to facilitate subsequent audits. An exception capture mechanism must also be built in to handle missing ledger data or erroneous reports caused by system call failures.

How to set up the configuration

This document is written for FastGPT v4.17.0.

Configuration ItemRecommended SettingRationale
Workflow/API tool selectionautoAdapt to multi-data-source ledger summary requests, automatically determine whether to trigger tool calls
Workflow/API function-call configurationTriggered by batch record fieldsBind key nodes of production batches to ensure call timing matches data update rhythm
Tool call timeout300-600 secondsSingle-batch ledger involves pulling data from multiple systems, reserve sufficient response time
Tool call retry count1-3 timesRespond to temporary system connection fluctuations, avoid summary interruption caused by single call failure
Retry interval10 secondsReasonable duration to wait for system connection recovery
Maximum number of returned entries per queryTop 100 entriesAvoid pulling excessive redundant data that affects summary efficiency
Result output modeReturn only tool call dataMeet the requirement of not outputting AI replies at the tool call node
Field mapping rulesMatch preset fields per GMP documentsEnsure extracted ledger fields comply with audit requirements, avoid data misalignment

Three common errors

  • Issue: Connection failure or permission denied error when calling database plugins. Cause: The database access whitelist for the environment where FastGPT is deployed has not been configured, or plugin connection parameters do not match the database instance's port and authentication method.
  • Issue: The tool call node outputs both AI replies and tool return data simultaneously. Cause: The result output mode is not set to return only tool call data, or the configuration was not saved and activated correctly.
  • Issue: Tool calls cannot be triggered normally when calling external models. Cause: The toolChoice parameter is not set to auto, or the model does not support standard function call formats.

How to confirm the configuration is complete

  • View FastGPT tool call logs to confirm that requests to all associated systems have been successfully initiated and returned valid business data.
  • Trigger a ledger summary request for a simulated production batch, check that output content only includes field data returned by the tool, with no additional AI-generated content.
  • Adjust test fields in the field mapping rules to verify that extracted ledger data fully matches preset business fields.
  • Simulate a system connection failure scenario to confirm that the tool call triggers the preset retry mechanism and completes automatic recovery.

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