Original Reddit post

Gemini 3 Flash. I use Gemini for my startup to generate the contents of the assessment step by step. So far it followed the instructions precisely. But not this time, and I don’t know why. the content string contains placeholder elements not present in context variables, it happens consistently - not for every element, but like 1 in 5. I tried different instruction variations, but it’s like hitting roadblock on such a simple task. It is not an issue of big context because I am batching data, so context is very modest. In the example, {‘industrial_zone’, ‘speed’} are missing from context_variables. See

C. Context Variables (context_variables)

StimulusSpecification( id=‘STIM_LEVEL_01_BASE’, context_domain_id=‘CTX_Level_Strike_Horizontal’, content=( "You are tasked with the destruction of a [target_structure] " "located at the [industrial_zone]. Fly a level flight path at " “[altitude] meters and [speed] kph. Wind conditions are calm.” ), display_caption=‘Standard Level Bombing Mission Briefing’, generation_constraints=[ ‘No wind’, ‘Stationary large-scale target’, ‘Standard altitude and speed parameters’ ], context_variables=[ ContextVariable( name=‘target_structure’, type=‘CATEGORICAL’, range=[‘Factory hangar’, ‘Supply depot’, ‘Train station’], impact_description=‘Determines the size of the aim point.’ ), ContextVariable( name=‘altitude’, type=‘NUMERIC’, range=[‘2000’, ‘3000’], impact_description=‘Standardizes the bombsight calculation for the trainee.’ ) ], type=StimulusTypeEnum.TEXT, difficulty=DifficultyEnum.EASY ) md file

STIMULUS_SPEC_GENERATION_START ## 1. THE OBJECTIVE Generate a Stimulus Model (Context Template) for a provided “Task Cluster” of proficiency nodes. * Role: You are a Media Director & Context Architect. * Goal: Create a reusable specification for the “Source Material” (Text, Image, or Audio) that the user will analyze. * Constraint: Do NOT write the specific question or interaction (e.g., “Select A or B”). Only describe the content, the environment, and the changing variables. ## 2. INPUT DATA You will receive an assessment draft with array in field stimulus_generation_specifications. Fill the field stimulus_specifications elements according to the field difficlty and data in context_domain. Each context_domain contains one or multiple proficiency variable clusters, and you should generate a stimuli specification according to what those clusters stand for in pmf_nodes_clusters. The stimulus should fit all those clusters in the specification. ## 3. MEDIA SELECTION LOGIC (CRITICAL) You must determine the best media_type based on the nature of the Target Nodes. 1. Select IMAGE if: * The skill is inherently visual (e.g., “Graph Reading,” “X-Ray Analysis,” “Geometry,” “Spotting Defects”). * The user needs to interpret spatial relationships or diagrams. AI generated images may be not precise, so prefer this option only when the image does not require a lot of small exact details. In general avoid this type. 2. Select AUDIO if: * The skill involves acoustic perception (e.g., “Heart Sound Diagnosis,” “Engine Tuning”). * The skill involves linguistic listening (e.g., “Tone Analysis,” “Foreign Language Comprehension,” “Customer Service Empathy”). 3. Select TEXT (Default) if: * The skill is logical, mathematical, or procedural. * The scenario is a standard word problem, case study, or data table that doesn’t require visual plotting. ## 4. REQUIRED OUTPUT STRUCTURE (JSON) You must generate a JSON object that maps to the StimulusSpecification class: ### A. Media Type (media_type) TEXT, IMAGE, or AUDIO. Here is the updated instruction for the Generative Template (content), aligned with your requirement for “ready-to-generate” prompts that include variable placeholders. ### B. The Generative Template (content) This field defines the Source Material for the stimulus. Its format depends strictly on the media_type, but in all cases, it must be exhaustive and include your [context_variables] to ensure the media matches the data. #### 1. IF media_type == ‘TEXT’ The Narrative Shell. * Function: This is the exact text displayed to the user on the screen. * Requirement: Write the final, polished prose. Use placeholders to insert dynamic data naturally into the sentence structure. * Example: > “You are reviewing a patient chart. The blood pressure is [systolic] / [diastolic] mmHg and the heart rate is [heart_rate] bpm. The patient complains of dizziness.” #### 2. IF media_type == ‘IMAGE’ The Generative Image Prompt. * Function: This is the text sent to an AI image generator (e.g., DALL-E, Midjourney). * Requirement: Provide a highly detailed visual description. You MUST include the [context_variables] in the prompt so the generated image reflects the specific scenario data. * Structure: [Subject] + [Data Visuals] + [Style/Lighting] + [Viewpoint] * Example: > “A photorealistic first-person view from a cockpit. The main altimeter gauge clearly reads [altitude] feet. The sky outside is [weather_condition]. Cinematic lighting, high resolution, 4k.” #### 3. IF media_type == ‘AUDIO’ The Generative Audio Prompt / Script. * Function: This is the text sent to an AI audio generator (e.g., ElevenLabs, OpenAI Audio). * Requirement: Provide the Exact Script to be spoken, including placeholders for numbers or terms that change. You must also include Meta-Instructions for sound effects (SFX), tone, and pacing to ensure the file is generated correctly. * Structure: [Meta-Instructions] + "Spoken Text" * Example: > “[Sound of wind howling in background. Speaker is a male pilot, shouting to be heard over engine noise, urgent tone.] ‘Tower, this is Ghost Rider. My fuel is critical at [fuel_level] pounds. Requesting immediate vector to [nearest_airport].’” ### C. Context Variables (context_variables) Define the dynamic elements (“Knobs”) that populate the template. For each variable, define: * name: Matches the [placeholder]. * type: NUMERIC or CATEGORICAL. * range: List defining min/max or options. * role: "FUNCTIONAL" (Changes answer) or "FLAVOR" (Cosmetic). — ### 5. VARIATION & CARDINALITY (CRITICAL) A. OUTPUT CARDINALITY You must expand the input data. For every single StimulusGenerationSpecification object in the input list, you must generate a JSON List of Distinct StimulusSpecification objects. The number of expected objects is set in quantity field of the StimulusGenerationSpecification. * Input List Size: N * Output List Size: N*quantity B. VARIATION REQUIREMENT The quantity variants generated for each input must be generated consecutively (in the same batch) to ensure they are conceptually distinct. They must differ fundamentally in their Constraint Logic, not just their flavor text. Follow this strict pattern for the 3 variants: 1. Variant A (Baseline): The Standard Scenario * Goal: Clean execution of the skill. * Distinct Feature: Nominal conditions, standard targets. 2. Variant B (Environmental Stress): The “Bad Weather” Scenario * Goal: Force the user to compensate for external factors. * Distinct Feature: Must add variables like wind, visibility, or sea_state that functionally change the math or decision logic. 3. Variant C (Tactical Stress): The “High Threat” Scenario * Goal: Force decision-making under pressure. * Distinct Feature: Must add variables like moving_target_speed, time_limit, or defensive_fire. Verification Rule: If Variant A and Variant B have the exact same list of context_variables, YOU HAVE FAILED. They must require different inputs to function. — ## 7. GENERATION GUIDELINES 1. Media Appropriateness: Do not use Audio/Image unless the skill requires it. Text is the safest default. 2. Dialogue Precision: For spoken audio, do not summarize (“The customer is angry”). You must write the Script (“Customer: ‘I am angry!’”) so the variable can be injected into the spoken words. 3. Variable Impact: Ensure at least one variable is "FUNCTIONAL". 4. Difficulty Calibration (CRITICAL): The Stimulus complexity must match the Difficulty Tier. * EASY: Use “Clean Room” contexts. Minimal noise, clear signals, few variables. (e.g., A simple bar chart with clear labels). * MEDIUM: Standard contexts. Introduce some “Flavor” variables (irrelevant info) that the user must ignore. * HARD: “Real World” contexts. High noise, messy data, distractors, or complex interactions between variables. (e.g., A coffee-stained receipt, a graph with missing axis labels, or audio with background static). Here is the properly formatted Markdown section. It uses bolding, lists, and hierarchy to make the instructions impossible for the LLM to ignore. # STIMULUS_SPEC_GENERATION_END

submitted by /u/Affectionate-Mail612

Originally posted by u/Affectionate-Mail612 on r/ArtificialInteligence