-
Notifications
You must be signed in to change notification settings - Fork 2
Added Pseudo FIM Feature #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,118 @@ public static String changeCodeSystemPrompt() { | |
| """.trim(); | ||
| } | ||
|
|
||
| public static String pseudoFimCodeSystemPrompt() { | ||
| return """ | ||
| You are an expert code completion AI. | ||
| Complete the code. | ||
| - The user will provide a code snippet formatted as a "Fill in the Middle" (FIM) request with <|fim_prefix|>, <|fim_suffix|>, and <|fim_middle|> tags. | ||
| - You must strictly complete the code, starting immediately after the <|fim_middle|> tag, and return **ONLY** the generated completion code, without any surrounding explanation or text. | ||
| - Do not include the prefix or suffix in your response. | ||
| - Do not repeat any of the provided context in the response. | ||
| - Partial code snippets are expected. | ||
| - Apply the following examples returning multiple lines unless instructed to return only a single line assuming the user will complete subsequent lines. | ||
| - Provide the completion that fills in the missing code. | ||
|
|
||
| :::Example prompts and responses::: | ||
|
|
||
| Example 1: | ||
| ``` | ||
| <|fim_prefix|># Current edit location: [path]; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| // TODO: add a for loop count from 1 to 10 | ||
| for (<|fim_suffix|> | ||
| } | ||
| } | ||
| <|fim_middle|> | ||
| ``` | ||
| Correct response: | ||
| ``` | ||
| int i = 1; i <= 10; i++) { | ||
| System.out.println(i); | ||
| } | ||
| ``` | ||
|
|
||
| Example 2: | ||
| ``` | ||
| <|fim_prefix|># Current edit location: [path]; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| // TODO: add a for loop count from 1 to 10 | ||
| for(<|fim_suffix|>) | ||
| } | ||
| } | ||
| <|fim_middle|> | ||
| ``` | ||
| Correct response: | ||
| ```int i = 1; i <= 10; i++``` | ||
|
|
||
| Example 3: "<|fim_prefix|># Current edit location: [path]; | ||
| ``` | ||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| int j = 100; | ||
| while(j<|fim_suffix|> | ||
| } | ||
| } | ||
| <|fim_middle|> | ||
| ``` | ||
| Correct response: | ||
| ``` | ||
| > 0) { | ||
| System.out.println(j); | ||
| j--; | ||
| } | ||
| ``` | ||
| Example 4: | ||
| ``` | ||
| <|fim_prefix|># Current edit location: [path]; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| int j = 100; | ||
| while(j<|fim_suffix|>) | ||
| } | ||
| } | ||
| <|fim_middle|> | ||
| ``` | ||
| Correct response: | ||
| is: | ||
| ``` > 0``` | ||
|
|
||
| Example 5: | ||
| ``` | ||
| <|fim_prefix|># Current edit location: [path]; | ||
|
|
||
| public class Main { | ||
|
|
||
| public static void main(String[] args) { | ||
| String title = "A FIM example."; | ||
| System.out | ||
| } | ||
| } | ||
| <|fim_middle|> | ||
| ``` | ||
| Correct response: | ||
| ```.println(title);``` | ||
|
|
||
| ## Additional information ## | ||
| - Use Java 21 syntax | ||
| - Use the correct variables based on the context | ||
| - If a comment precedes the line to you be completed, implement it | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand the intention, but I'm not sure it makes sense. My observation is that "fill in the middle" tends to look for structural completion and shouldn't generally follow instructions. Here is an example: Then the result could be: or: In the first case, it follows the instruction, and in the second, it completes the code. For cases where I want to implement a comment, I use what I call "TODO-driven development" with inline edit (which works by instructions). Example prompt: "Implement the TODOs/comments and remove them afterward." |
||
| - Focus on short, high confidence completions | ||
| - Do not generate extraneous code that does not logically fill in the completion | ||
| - When the completion is combined with the context code, it should be logically and syntactically correct and compliable | ||
| - Pay attention to opening and closing characters such as braces and parentheses | ||
| """.trim(); | ||
| } | ||
|
|
||
| public static String generateCodeSystemPrompt() { | ||
| return """ | ||
| You are a software developer assistant. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prompt should not contain any hardcoded information about the used technology.