目前自己写的效果不是很好,模型是通义千问,经常重复补全(就是把光标后面已有的代码重复了一遍)或者胡言乱语。社区有开源的效果比较好 prompt 吗?
看了一下 continue 的 template,感觉没什么参考价值。其中 starcoder 等是专门训练的 code 补全模型,不需要特别的 prompt 。
以下是自己写的 prompt:
I am calling you in a code completion plugin for an editor. I need you to complete the code based on the context provided below, only providing the completion content.
# Code Context
Here is the beginning part of the ${language} code (before the cursor):
```
${input.prefix}
```
Here is the suffix part (after the cursor):
```
${input.suffix}
```
Do not explain, just return the code between the prefix part and the suffix part, and do not include the prefix part or the suffix part. Your completion should be concise and accurate. You need to note that brackets, etc. I may have provided them to you in suffix.