From 5c4813b10a1e4531d0ab070a34f0bb2d95abf046 Mon Sep 17 00:00:00 2001 From: ValueOn AG Date: Mon, 26 Jan 2026 14:54:47 +0100 Subject: [PATCH] workflow dynamic tested --- .../services/serviceAi/subStructureFilling.py | 30 ++++++++++++++++++- .../serviceAi/subStructureGeneration.py | 13 ++++++-- .../workflows/processing/workflowProcessor.py | 2 +- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/modules/services/serviceAi/subStructureFilling.py b/modules/services/serviceAi/subStructureFilling.py index 5145ad54..8f63277f 100644 --- a/modules/services/serviceAi/subStructureFilling.py +++ b/modules/services/serviceAi/subStructureFilling.py @@ -1797,6 +1797,13 @@ LANGUAGE: Generate all content in {language.upper()} language. All text, titles, CHAPTER: {chapterTitle} (Level {chapterLevel}, ID: {chapterId}) GENERATION HINT: {generationHint} +## CONTENT EFFICIENCY PRINCIPLES +- Generate COMPACT sections: Focus on essential information only +- AVOID creating too many sections - combine related content where possible +- Each section should serve a clear purpose with meaningful data +- If no relevant data exists for a topic, do NOT create a section for it +- Prefer ONE comprehensive section over multiple sparse sections + **CRITICAL**: The chapter's generationHint above describes what content this chapter should generate. If the generationHint references documents/images/data, then EACH section that generates content for this chapter MUST assign the relevant ContentParts from AVAILABLE CONTENT PARTS below. NOTE: Chapter already has a heading section. Do NOT generate a heading for the chapter title. @@ -2024,6 +2031,13 @@ LANGUAGE: Generate all content in {language.upper()} language. All text, titles, - Content Type: {contentType} - Generation Hint: {generationHint} +## CONTENT EFFICIENCY PRINCIPLES +- Generate COMPACT content: Focus on essential facts only +- AVOID verbose text, filler phrases, or redundant explanations +- Be CONCISE and direct - every word should add value +- NO introductory phrases like "This section describes..." or "Here we present..." +- Minimize output size for efficient processing + ## INSTRUCTIONS 1. Extract all data from the context provided. Do not skip or omit any data. 2. Extract data only from the provided context. Never invent, create, or generate data that is not in the context. @@ -2076,6 +2090,13 @@ LANGUAGE: Generate all content in {language.upper()} language. All text, titles, - Content Type: {contentType} - Generation Hint: {generationHint} +## CONTENT EFFICIENCY PRINCIPLES +- Generate COMPACT content: Focus on essential facts only +- AVOID verbose text, filler phrases, or redundant explanations +- Be CONCISE and direct - every word should add value +- NO introductory phrases like "This section describes..." or "Here we present..." +- Minimize output size for efficient processing + ## AVAILABLE CONTENT FOR THIS SECTION {contentPartsText} @@ -2124,13 +2145,20 @@ LANGUAGE: Generate all content in {language.upper()} language. All text, titles, - Content Type: {contentType} - Generation Hint: {generationHint} +## CONTENT EFFICIENCY PRINCIPLES +- Generate COMPACT content: Focus on essential facts only +- AVOID verbose text, filler phrases, or redundant explanations +- Be CONCISE and direct - every word should add value +- NO introductory phrases like "This section describes..." or "Here we present..." +- Minimize output size for efficient processing + ## INSTRUCTIONS 1. Generate content based on the Generation Hint above. 2. Create appropriate content that matches the content_type ({contentType}). 3. The content should be relevant to the USER REQUEST and fit the context of surrounding sections. 4. Return only valid JSON with "elements" array. 5. No HTML/styling: Plain text only, no markup. -6. CONTINUE UNTIL COMPLETE: Extract ALL data from the provided context. Do NOT stop early because you think the response might be too long. Do NOT truncate or abbreviate. Do not impose artificial limits on yourself. +6. Keep content CONCISE - focus on substance, not length. ## OUTPUT FORMAT Return a JSON object with this structure: diff --git a/modules/services/serviceAi/subStructureGeneration.py b/modules/services/serviceAi/subStructureGeneration.py index 64624b84..67b045b3 100644 --- a/modules/services/serviceAi/subStructureGeneration.py +++ b/modules/services/serviceAi/subStructureGeneration.py @@ -420,8 +420,16 @@ CRITICAL RULE: If the user request mentions BOTH: b) Generic content types (article text, main content, body text, etc.) Then chapters that generate those generic content types MUST assign the relevant ContentParts, because the content should relate to or be based on the provided documents/images/data. +## CONTENT EFFICIENCY PRINCIPLES +- Generate COMPACT content: Focus on essential information only +- AVOID verbose, lengthy, or repetitive text - be concise and direct +- Prioritize FACTS over filler text - no introductions like "In this chapter..." +- Minimize system resources: shorter content = faster processing +- Quality over quantity: precise, meaningful content rather than padding + ## CHAPTER STRUCTURE REQUIREMENTS - Generate chapters based on USER REQUEST - analyze what structure the user wants +- Create ONLY the minimum chapters needed to cover the user's request - avoid over-structuring - IMPORTANT: Each chapter MUST have ALL these fields: - id: Unique identifier (e.g., "chapter_1") - level: Heading level (1, 2, 3, etc.) @@ -431,9 +439,8 @@ Then chapters that generate those generic content types MUST assign the relevant - sections: Empty array [] (REQUIRED - sections are generated in next phase) - contentParts: {{"partId": {{"instruction": "..."}} or {{"caption": "..."}} or both}} - Assign ContentParts as required by CONTENT ASSIGNMENT RULE above - The "instruction" field for each ContentPart MUST contain ALL relevant details from the USER REQUEST that apply to content extraction for this specific chapter. Include all formatting rules, data requirements, constraints, and specifications mentioned in the user request that are relevant for processing this ContentPart in this chapter. -- generationHint: Description of what content to generate for this chapter - The generationHint MUST contain ALL relevant details from the USER REQUEST that apply to this specific chapter. Include all formatting rules, data requirements, constraints, column specifications, validation rules, and any other specifications mentioned in the user request that are relevant for generating content for this chapter. Do NOT use generic descriptions - include specific details from the user request. -- The number of chapters depends on the user request - create only what is requested +- generationHint: Keep CONCISE but include relevant details from the USER REQUEST. Focus on WHAT to generate, not HOW to phrase it verbosely. +- The number of chapters depends on the user request - create only what is requested. Do NOT create chapters for topics without available data. CRITICAL: Only create chapters for CONTENT sections, not for formatting/styling requirements. Formatting/styling requirements to be included in each generationHint if needed. diff --git a/modules/workflows/processing/workflowProcessor.py b/modules/workflows/processing/workflowProcessor.py index 11879e9d..38763f51 100644 --- a/modules/workflows/processing/workflowProcessor.py +++ b/modules/workflows/processing/workflowProcessor.py @@ -13,7 +13,7 @@ from modules.workflows.processing.modes.modeBase import BaseMode from modules.workflows.processing.modes.modeDynamic import DynamicMode from modules.workflows.processing.modes.modeAutomation import AutomationMode from modules.workflows.processing.shared.stateTools import checkWorkflowStopped -from modules.datamodels.datamodelAi import OperationTypeEnum, PriorityEnum, ProcessingModeEnum, AiCallOptions +from modules.datamodels.datamodelAi import OperationTypeEnum, PriorityEnum, ProcessingModeEnum, AiCallOptions, AiCallRequest from modules.shared.jsonUtils import extractJsonString, repairBrokenJson if TYPE_CHECKING: