Feature/ab#32009 prompt version baselines#2105
Merged
Merged
Conversation
Contributor
Author
|
Will move these prompt templates/files to database in a following story |
Contributor
There was a problem hiding this comment.
Pull request overview
Finalizes runtime prompt versioning for AI generation by moving prompts into file-based templates (v0/v1) resolved at runtime by OpenAIService, and standardizes prompt payload construction/fallbacks to keep analysis and scoresheet flows consistent.
Changes:
- Introduces versioned, tokenized prompt templates under
AI/Prompts/Versionsand adds a runtime resolver/renderer inOpenAIService. - Aligns AI service contracts and orchestration to typed DTOs and normalized submission payloads (analysis + scoresheet).
- Preserves additional fixes (e.g., async authorization loop correction, extractor dispatch consolidation).
Reviewed changes
Copilot reviewed 35 out of 35 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Unity.GrantManager.Application.csproj | Copies versioned prompt template .txt files to build output. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/Intakes/Handlers/GenerateAIContentHandler.cs | Normalizes submission parsing and unifies fallback payload shape for analysis/scoresheet. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/GrantApplications/GrantApplicationAppService.cs | Fixes async authorization loop by replacing ForEach(async ...) with foreach + await. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/TextExtractionService.cs | Centralizes extractor selection via extension-dispatch dictionary and simplifies content-type fallbacks. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/scoresheet.user.txt | Adds v1 scoresheet user template with token placeholders. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/scoresheet.system.txt | Adds v1 scoresheet system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/scoresheet.rules.txt | Adds v1 scoresheet rules fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/scoresheet.output.txt | Adds v1 scoresheet output fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/common.rules.txt | Adds shared v1 common rules fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/attachment.user.txt | Adds v1 attachment user template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/attachment.system.txt | Adds v1 attachment system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/attachment.rules.txt | Adds v1 attachment rules fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/attachment.output.txt | Adds v1 attachment output fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.user.txt | Adds v1 analysis user template (schema/data/attachments + fragment placeholders). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.system.txt | Adds v1 analysis system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.score.txt | Adds v1 analysis score fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.rules.txt | Adds v1 analysis rules fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.rubric.txt | Adds v1 analysis rubric fragment. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v1/analysis.output.txt | Adds v1 analysis output fragment (typed findings contract). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/scoresheet.user.txt | Adds v0 legacy scoresheet user template (monolithic prompt). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/scoresheet.system.txt | Adds v0 legacy scoresheet system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/attachment.user.txt | Adds v0 legacy attachment user template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/attachment.system.txt | Adds v0 legacy attachment system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/analysis.user.txt | Adds v0 legacy analysis user template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/v0/analysis.system.txt | Adds v0 legacy analysis system template. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/Versions/README.md | Documents template layout, placeholders, fragment resolution rules, and version selection. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/ScoresheetPrompts.cs | Removes hard-coded scoresheet prompt builder (replaced by file templates). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/PromptHeader.cs | Removes prompt header helper (replaced by file templates). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/PromptCoreRules.cs | Removes core rules constants (replaced by common fragment templates). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/AttachmentPrompts.cs | Removes hard-coded attachment prompt builder (replaced by file templates). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/Prompts/AnalysisPrompts.cs | Removes hard-coded analysis prompt builder/rubric/output (replaced by file templates). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application/AI/OpenAIService.cs | Implements runtime prompt version selection, template loading/caching, fragment rendering, and aligns typed DTO methods. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/AI/Requests/ApplicationAnalysisRequest.cs | Removes rubric field from request (rubric now comes from templates/fragments). |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/AI/Requests/AICompletionRequest.cs | Removes system prompt override and keeps temperature/max tokens configuration. |
| applications/Unity.GrantManager/src/Unity.GrantManager.Application.Contracts/AI/IAIService.cs | Simplifies interface to typed AI operations and renames scoresheet call to GenerateScoresheetSectionAsync. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
JamesPasta
approved these changes
Mar 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request overview
This pull request finalizes runtime prompt versioning for AI generation using file-based v0/v1 templates and a tokenized resolver in
OpenAIService. It aligns the active v1 prompt contracts with the typed AI DTO flow and keeps v0 available for controlled legacy behavior.It also standardizes payload construction across analysis and scoresheet generation by introducing shared submission-shape normalization and a shared fallback payload model. This reduces divergence between prompt paths and keeps orchestration behavior predictable.
Additional correctness and maintainability updates from this branch are preserved, including async authorization loop fixes, centralized text extraction routing, and Sonar-driven cleanup in AI orchestration/services.
Changes:
AI/Prompts/Versionswith runtime version selection (v0/v1)OpenAIService(including shared/common rule fragments)GenerateAIContentHandler