unit-mesh / auto-dev-vscode

AutoDev - 🧙‍the AI-powered coding wizard . Put the most loved AutoDev AI assistant into your VSCode, and have things done quickly
http://vscode.unitmesh.cc/
MIT License
234 stars 38 forks source link

Use “/api/infill” instead of “/api/generate” #61

Open zhengxs2018 opened 2 months ago

zhengxs2018 commented 2 months ago

Validations

Problem

The endpoints "/chat/completions" or "/api/generate" are well-suited for writing test cases or generating complete code snippets.

Writing tests:

write a unit test for this function: $(cat example.py)

Code completions:

# A simple python function to remove whitespace from a string:

However, these endpoints are not very effective when dealing with non-standard or incomplete code.

FIM (Fill-in-the-Middle) is a specialized prompting format supported by code completion models, allowing completion of code between two pre-written code segments.

<PRE> def compute_gcd(x, y): <SUF>return result <MID>

<PRE>, <SUF> and <MID> are special tokens that guide the model.

The challenge lies in the fact that different models use different special tokens for this purpose. Developers from llama.cpp and ollama have already identified this issue.

Links:

Solution

No response