refactor(prompt): Replace hardcoded strings with template fragments#363
Merged
codelion merged 1 commit intoalgorithmicsuperintelligence:mainfrom Dec 23, 2025
Merged
Conversation
- Refactor hardcoded strings in PromptSampler class to use template manager for localized fragments - Modify format_feature_coordinates function to return empty string instead of fixed text when no feature coordinates are available - Update fragments.json to add new template fragment
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.
Just like #361 (comment) , I extracted the hard coded fields from the code and stored them in fragment.json. For readability, I used prefix naming to indicate which part of the program prompt each fragment is working on.Now it is possible to customize all parts of the prompt without changing the framework

I verified the correctness of fragment I added in the Chinese prompt template:
As a result, the content of fragmentjson has swelled a lot. I think adding comments is necessary for readability. Considering that json files cannot have comments, I once considered replacing them with configuration files in other formats (such as YAML), but gave up for compatibility with the tasks in the examples.
In addition, I also want to add similar images in the issue I mentioned to illustrate the process of constructing prompts, but it is currently unclear whether PNG images or Mermaid are more suitable?