Skip to content

Commit 4c05510

Browse files
committed
Remove extra instruction from system prompt generation
Eliminated the explicit instruction to use documented parameter names and keyword arguments from the system prompt in ShinyTestGenerator. The prompt now only includes the system prompt file and function reference documentation.
1 parent 0accf10 commit 4c05510

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

shiny/pytest/_generate/_main.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -146,17 +146,7 @@ def _read_system_prompt(self) -> str:
146146
"System prompt file not found for app type: testing"
147147
)
148148

149-
# Add an explicit instruction to the system prompt to prefer documented
150-
# parameter names and to always pass arguments as keyword arguments.
151-
extra_instruction = (
152-
"\n\nIMPORTANT: When generating test code, use the exact parameter names shown in the provided function reference documentation and pass all arguments as keyword arguments using those documented names. "
153-
"Do not invent, rename, or reorder parameter names."
154-
)
155-
156-
return (
157-
f"{system_prompt_file}\n\nHere is the function reference documentation for Shiny for Python: {self.documentation}"
158-
+ extra_instruction
159-
)
149+
return f"{system_prompt_file}\n\nHere is the function reference documentation for Shiny for Python: {self.documentation}"
160150

161151
def _resolve_model(self, model: str) -> str:
162152
"""Resolve model alias to actual model name"""
@@ -324,6 +314,8 @@ def _create_test_prompt(self, app_text: str, app_file_name: str) -> str:
324314
"- If test is in 'tests/subdir/test_app.py' and app is in 'apps/subdir/app.py', use: '../../apps/subdir/app.py'\n"
325315
"- Always compute the correct relative path from the test file to the app file\n"
326316
"- NEVER use absolute paths or paths that aren't relative from the test location\n\n"
317+
"CRITICAL: Generate only ONE comprehensive test function (e.g., 'test_app_functionality') that tests ALL components sequentially within the same test. "
318+
"Do NOT create multiple separate test functions. Exercise all inputs and outputs in a single test flow.\n\n"
327319
"IMPORTANT: Only output the Python test code in a single code block. Do not include any explanation, justification, or extra text."
328320
)
329321

0 commit comments

Comments
 (0)