diff --git a/include/json_types.hpp b/include/json_types.hpp index 0f051ed..8832492 100644 --- a/include/json_types.hpp +++ b/include/json_types.hpp @@ -505,14 +505,14 @@ struct ChatResponse { DRH_DEFINE_TYPE_MIXED(ChatResponse, (choices), (usage)) struct ModelInfo { - std::string name; + std::string id; }; -DRH_DEFINE_TYPE_REQUIRED(ModelInfo, name) +DRH_DEFINE_TYPE_REQUIRED(ModelInfo, id) struct ModelListResponse { - std::vector models; + std::vector data; }; -DRH_DEFINE_TYPE_REQUIRED(ModelListResponse, models) +DRH_DEFINE_TYPE_REQUIRED(ModelListResponse, data) // Tool parameter structs diff --git a/src/ollama_client.cpp b/src/ollama_client.cpp index 66c08c1..11d61f0 100644 --- a/src/ollama_client.cpp +++ b/src/ollama_client.cpp @@ -251,7 +251,7 @@ std::expected OllamaClient::chat(const std::vector, std::string> OllamaClient::list_models() const { - std::string url = base_url_ + "/api/tags"; + std::string url = base_url_ + "/v1/models"; auto response_result = http_request(url, "GET", ""); if (!response_result) { return std::unexpected(response_result.error()); @@ -269,8 +269,8 @@ std::expected, std::string> OllamaClient::list_models() } auto resp = result.value(); std::vector models; - for (const auto& m : resp.models) { - models.push_back(m.name); + for (const auto& m : resp.data) { + models.push_back(m.id); } return models; }