Skip to content

server : passthrough the /models endpoint during loading #13535

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

Merged
merged 2 commits into from
May 14, 2025

Conversation

ggerganov
Copy link
Member

Certain 3rd-party applications could use the information about the model currently being loaded. This change allows the /models and /v1/models endpoints to passthrough.

@ngxson Not sure if this is the correct way to do this, so suggestions are welcome.

cc @astoilkov

Copy link
Collaborator

@ngxson ngxson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this sounds good to me, maybe we should add a line in the docs to say about model_meta being null when is model loading is in progress?

const auto handle_models = [&params, &ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
const auto handle_models = [&params, &ctx_server, &state, &res_ok](const httplib::Request &, httplib::Response & res) {
server_state current_state = state.load();
std::string model_meta;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::string model_meta;
json model_meta = nullptr;

Otherwise, the model_meta will always be a string, right?

@ggerganov ggerganov merged commit 0531744 into master May 14, 2025
44 checks passed
Silver267 pushed a commit to Silver267/llama.cpp that referenced this pull request May 14, 2025
)

* server : passthrough the /models endpoint during loading

* server : update readme + return json for "meta" field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants