Code and Change Review Assistance for Advertising Compliance Audit: Context and Token

Data originates from advertising platform backends, customer qualification records, contract systems, and publicly disclosed regulatory rules. Four

What data for this use case looks like

Data originates from advertising platform backends, customer qualification records, contract systems, and publicly disclosed regulatory rules. Four document types are generated regularly: advertising review forms, qualification attachments, delivery logs, and rectification notifications. Updates are triggered per individual advertising campaign, only when the campaign launches, review finishes, or rectification completes. No fixed monthly update cycle exists. Documents include fields such as campaign identifier, review status, qualification number, delivery time window, and rectification completion status. Document formats differ across source systems, so separate parsing and adaptation are required for each source.

What constraints these characteristics impose on the context and token workflow

The document set for a single advertising campaign is relatively fixed but diverse in type. The context window must accommodate all full compliance documents for one campaign. It must also avoid redundant token usage. Data formats vary across multiple sources. Context concatenation must retain field identifiers to keep compliance evidence traceable. This prevents failure to associate corresponding documents during reviews. Regulatory accountability risks require core evidence such as qualification numbers and delivery logs to not be truncated. Token quotas must be allocated appropriately. Data updates have no fixed cycle. Context refreshes must align with campaign milestones. This prevents using expired documents that lead to review errors.

How to set configurations

Configuration ItemRecommended SettingRationale
maxContext8000–12000 charactersAligns with total character count of compliance documents for a single campaign, ensures all core evidence loads fully, and complies with FastGPT v4.17.0 configuration limits
quoteMaxToken3000–5000 tokensPrioritizes retaining full content of core documents such as advertising review forms and rectification notices, prevents critical compliance information from being truncated
Context recall countTop 3 matching documentsCompliance document types for a single campaign are fixed; excessive recall increases invalid token usage and reduces review efficiency
Context refresh ruleTriggered by campaign IDAligns with the rhythm of data updates per campaign, ensures each review uses the latest compliance documents for the current campaign
Token statistics granularityCount separately for input and outputMeets the need to track compliance document references and question consumption during reviews, aligns with actual business compliance audit requirements

Three common misconfigurations

  • Issue: Context window exceeds limit error with 413 status code appears during code review. Cause: maxContext is not set based on per-campaign document volume. A generic large window configuration is used blindly. This leads to compliance documents being truncated and critical evidence lost.
  • Issue: Input and output token details for individual reviews cannot be viewed. Cause: The separate input and output counting rule is not configured. Only total token consumption is counted. This makes it impossible to distinguish token share between compliance document references and review questions.
  • Issue: Context is not reset when switching between campaigns. Compliance documents from past campaigns are mixed in. Cause: The context clearing rule triggered by campaign ID is not configured. Generic session context retention logic is used instead.

How to confirm correct configuration

  • Upload all compliance documents for a single campaign. Check in the FastGPT v4.17.0 configuration interface that the context window loads all documents fully, with no truncation prompts.
  • Initiate a code review. Verify that input token and output token counts are displayed separately in the conversation log.
  • Switch to the compliance document set for a different campaign. Confirm that the context automatically updates to the document content for the corresponding campaign.
  • Manually trigger a context reset operation. Confirm that historical session content is cleared, and the new review session uses the current campaign's documents.

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

Question material comes from public community discussions. Configuration values are common starting points and should be measured against your own samples. Verified on 2026-10-19.