Cross-Review of Technical Documents for Active Pharmaceutical Ingredient and Pharmaceutical Intermediate Production: Tool Calling and Plugins

Active pharmaceutical ingredient and pharmaceutical intermediate production technical documents include batch production records, material balance

What data for this category looks like

Active pharmaceutical ingredient and pharmaceutical intermediate production technical documents include batch production records, material balance sheets, reaction and purification records, cleaning validation records, impurity profile reports, deviation and change documents, and similar items. Data sources include registered process documents, raw material batch ledgers, DCS systems, weighing systems, LIMS laboratory information management systems, chromatography data systems, and QMS quality management systems. Data is updated once per production batch and per process step. Single-batch documents contain fields such as batch number, reaction temperature, yield, impurity content, and solvent residue amount. Field units use professional measurement standards including degrees Celsius, percentage, milligrams per kilogram, and similar units.

Constraints on tool calling and plugins from these characteristics

The multi-source heterogeneous data sources and batch-based update characteristics of this category require tool calling to accurately match batch numbers and corresponding system interfaces, to avoid mixing data across batches. Single-batch documents have dense professional fields, so tool calling must accurately screen relevant data to prevent irrelevant information from interfering with review logic. Errors may result in batch scrap or compliance risks, so tool calling must include verification mechanisms to ensure data accuracy. Additionally, associated review of multi-step processes requires sequential triggering of tool calls, relying on output results from previous steps, which imposes clear constraints on plugin triggering logic.

Configuration settings

Configuration ItemRecommended SettingRationale
Workflow/API tool selectionMandatorily specify the target APIAccurate calling of corresponding system interfaces is required to avoid interference with review logic from unrelated tool calls
Workflow/API function-call configurationTrigger per production batchMatches exclusive documents and data for each batch to ensure accuracy of associated information
Tool call timeout600 secondsMulti-step data retrieval and professional text processing require sufficient time to prevent mid-run interruptions
Number of returned entries per tool callTop 10 entriesAssociated data volume per batch is limited; excessive entries will exceed the context window
Reranking modelbge-rerankerAdapts to similarity matching for professional medical texts to improve accuracy of cross-review
Single-instance GPU memory limit1000 MBPrevents excessive GPU resource usage by single tool call instances, and adapts to multi-GPU deployment scenarios

Three common misconfigurations

  • Rapid growth of GPU memory usage to 6-7 GB with simultaneous occupancy across multiple GPUs. This occurs when concurrent loading of the reranking model is not restricted. Each tool call instance independently loads the bge-reranker model, leading to excessive consumption of memory resources.
  • Empty fields returned by tool calls. This occurs when the correct production batch number is not passed in the call parameters, so the system cannot match data from the LIMS or chromatography data system for the corresponding batch.
  • Abnormal interruptions during sequential tool call execution. This occurs when dependency triggering logic for tool calls is not configured. Subsequent tools are called before previous steps are completed, leading to incomplete data.

How to confirm correct configuration

  • Test tool calls for single-batch documents, and check if impurity profile reports and material balance data for the corresponding batch are retrieved.
  • View FastGPT v4.17.0 tool call logs to confirm that the toolChoice parameter correctly triggers the specified system API.
  • Verify the functionCall triggering logic to ensure tool calls start only when documents for the corresponding production batch are uploaded or under review.
  • Check GPU resource usage to confirm that memory usage of single tool call instances does not exceed the preset threshold, and there is no excessive resource consumption.

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