Drafting Process Documents and Exception Reports for Chemical Pharmaceutical Dosage Production: Tool Calling and Plugins

This category's data comes from approved formulation processes, MES electronic batch records, equipment and environmental monitoring data, LIMS

What the data for this category looks like

This category's data comes from approved formulation processes, MES electronic batch records, equipment and environmental monitoring data, LIMS laboratory management systems, and quality management systems. Data updates are triggered with each production batch and each critical process step, and are also updated per regular monitoring plans. Daily documents include master production files, batch production records, cleaning records, deviation/CAPA/change records, and batch release review forms. Core fields include material batch numbers, process temperatures, operation durations, deviation descriptions, test results, and other relevant fields. Fields must match fixed formats required by GMP control requirements.

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

Multi-source heterogeneous data sources require tools to support integration with multiple interfaces such as MES, LIMS, and quality management systems, to avoid data silos. The update rhythm tied to batches and critical steps requires tool calls to be bound to production node triggers, to ensure data timeliness aligns with production workflows. The complex document structure and fixed field requirements demand that tool calls accurately screen core control fields, to avoid redundant data occupying context windows. Under compliance requirements, tool call results must be bound in real time to production operations, and sensitive batch information must be hidden to avoid compliance risks.

The following configurations are based on FastGPT v4.17.0.

How to set the configurations

Configuration ItemRecommended SettingRationale
Workflow/API tool selectionautoAdapts to autonomous calling needs for multiple document types and cross-system data
Workflow/API function-call configuration{"name": "extract_chemical_batch_data"}Fixed call to the preset chemical pharmaceutical dosage batch data extraction tool
Tool call timeout120 secondsSufficient duration to pull multi-source data across MES and LIMS systems
Tool call result caching ruleCache by batch for 7 daysMatches the audit cycle of batch records to avoid repeated calls
Maximum number of fields returned per tool callTop 15 itemsFocuses on core control fields for batch production records, avoiding context overflow
Maximum context length per tool call8000 tokenAdapts to large model context window limits, avoiding truncation of core data

Three common mistakes

  • Phenomenon: Tool call processes are fully exposed in logs or front-end interfaces, including sensitive batch data. Cause: FastGPT tool call silent configuration is not enabled, leading to compliance risks.
  • Phenomenon: Interface calls return 413 errors. Cause: The volume of batch record data returned by a single tool call exceeds interface limits, and no field screening or result paging is configured.
  • Phenomenon: When using the qwen3 model, tool calls force inference mode and cannot switch to function call mode. Cause: The toolChoice parameter is not correctly set to function, leading to the model selecting calling logic autonomously.

How to confirm the configuration is complete

  • Trigger a tool call simulating a critical production step, and check that the returned results only include the preset core fields.
  • View tool call logs, confirm that the toolChoice parameter takes effect as configured, with no additional unauthorized calls.
  • Simulate cross-system data pulling, verify that the call timeout meets the configured 120-second threshold.
  • Check tool call result caches, confirm that batch-generated cache files do not include redundant data.

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