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
Add /api/infill for fill-in-the-middle #3907
base: main
Are you sure you want to change the base?
Conversation
@@ -83,10 +83,10 @@ type GenerateRequest struct { | |||
type InfillRequest struct { | |||
|
|||
// InputPrefix is the text before the infilling position to send to the model. | |||
InputPrefix string `json:"input_prefix"` | |||
InputPrefix string `json:"input_prefix"` |
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.
why not merge with the previous CL?
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.
I now squashed the 2 commits, I hope thats what you meant.
Where is FIM actually implemented for each model? |
39c65f3
to
4aaa4f8
Compare
The actual infilling / FIM prompt is already implemented in It might be a good idea to check if the used model actually supports FIM, and if not immediately return an error: Line 353 in 4aaa4f8
EDIT: I just stumbled upon ggerganov/llama.cpp#6689, which enables other FIM trained models to be used with |
@PhilKes It'd be good if we could list all supported models, as well. How does |
The prompt for infilling is created at: |
Would love to hear some opinions on this @jmorganca 😀 |
This PR closes #3869
Adds
/api/infill
to leverage llama.cpp's POST /infill API for infilling / fill-in-the-middle / code-completion.An example request looks like this:
Response:
(Streaming is also available)
Note: could probably need more refactoring to cleanup duplicate code, I am very new to Golang programming, so feedback would be appreciated