Skip to content
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

Handle verbose model info calls. #13

Merged
merged 2 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ int main()
// Generate embeddings for a model and a prompt.
std::cout << ollama::generate_embeddings("llama3:8b", "Why is the sky blue?") << std::endl;

sleep(10);

// Push a model a model library with the syntax <namespace>/<model>:<tag>. Note that you must have registered on ollama.ai and added a public key to do this.
try { if ( ollama::push_model("jmont/my_model:latest") ) std::cout << "Model was pushed" << std::endl; }catch(...) {std::cout << "Unable to push model." << std::endl; }

Expand Down
7 changes: 4 additions & 3 deletions include/ollama.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,11 @@ class Ollama

}

json show_model_info(const std::string& model)
json show_model_info(const std::string& model, bool verbose=false)
{
json request, response;
request["name"] = model;
if (verbose) request["verbose"] = true;

std::string request_string = request.dump();
if (ollama::log_requests) std::cout << request_string << std::endl;
Expand Down Expand Up @@ -859,9 +860,9 @@ namespace ollama
return ollama.create_blob(digest);
}

inline json show_model_info(const std::string& model)
inline json show_model_info(const std::string& model, bool verbose=false)
{
return ollama.show_model_info(model);
return ollama.show_model_info(model, verbose);
}

inline bool copy_model(const std::string& source_model, const std::string& dest_model)
Expand Down
7 changes: 4 additions & 3 deletions singleheader/ollama.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35398,10 +35398,11 @@ class Ollama

}

json show_model_info(const std::string& model)
json show_model_info(const std::string& model, bool verbose=false)
{
json request, response;
request["name"] = model;
if (verbose) request["verbose"] = true;

std::string request_string = request.dump();
if (ollama::log_requests) std::cout << request_string << std::endl;
Expand Down Expand Up @@ -35649,9 +35650,9 @@ namespace ollama
return ollama.create_blob(digest);
}

inline json show_model_info(const std::string& model)
inline json show_model_info(const std::string& model, bool verbose=false)
{
return ollama.show_model_info(model);
return ollama.show_model_info(model, verbose);
}

inline bool copy_model(const std::string& source_model, const std::string& dest_model)
Expand Down
Loading