-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Add the endpoints /api/tags and /api/chat #13659
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
Conversation
Add the endpoints /api/tags and /api/chat, and improved the model metadata response
tools/server/server.cpp
Outdated
@@ -4086,6 +4101,19 @@ int main(int argc, char ** argv) { | |||
{ "llama.context_length", ctx_server.slots.back().n_ctx, }, | |||
} | |||
}, | |||
{"modelfile", ""}, // Specific to ollama and does not seem to be needed | |||
{"parameters", ""}, // TODO: add parameters |
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.
Does the API client expect this to be a string or an object?
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.
modelfile is a string. Parameters i am not sure, but it seems to be enough as is.
I think this is the minimal code that we need for copilot to work with it. |
@@ -3740,7 +3741,7 @@ int main(int argc, char ** argv) { | |||
if (req.path == "/" || tmp.back() == "html") { | |||
res.set_content(reinterpret_cast<const char*>(loading_html), loading_html_len, "text/html; charset=utf-8"); | |||
res.status = 503; | |||
} else if (req.path == "/models" || req.path == "/v1/models") { | |||
} else if (req.path == "/models" || req.path == "/v1/models" || req.path == "/api/tags") { | |||
// allow the models endpoint to be accessed during loading |
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.
during loading, common_chat_templates_source
call will fail
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.
Do you want me to remove that endpoint from the if-case?
Edit:
The current code does not use common_chat_templates_source
in that endpoint after the latest changes.
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.
hmm I think it's ok to keep this then
* Add the endpoints /api/tags and /api/chat Add the endpoints /api/tags and /api/chat, and improved the model metadata response * Remove trailing whitespaces * Removed code that is not needed for copilot to work.
Add the endpoints /api/tags and /api/chat, and improved the model metadata response.
These changes made llama-server work with Copilot Chat again for me. both /api/tags and /api/chat are added because of a discussion on open-webui's page where they point out that both need to be handled. The old json values are kept as is to keep backwards compatibility, in case anyone uses them.
This issue was also pointed out in the comments of #12896.