Files
moloapp/src/vendors/mistral/models.h
T

53 lines
1.6 KiB
C++

#pragma once
// Models: GET /v1/models, GET /v1/models/{id}, DELETE /v1/models/{id} (own
// fine-tuned models only; explicit, irreversible). BaseModelCard and
// FTModelCard are told apart by `type` ("base" | "fine-tuned").
#include <string>
#include <vector>
#include "vendors/mistral/types.h"
namespace molo::mistral {
struct ModelCapabilities {
bool completion_chat = false, function_calling = false, reasoning = false, completion_fim = false;
bool fine_tuning = false, vision = false, ocr = false, classification = false, moderation = false;
bool audio = false, audio_transcription = false, audio_speech = false;
static ModelCapabilities parse(const Json* caps);
};
struct ModelCard {
std::string id, type, owned_by, name, description, deprecation, job, root;
long created = 0, max_context_length = 0;
bool archived = false;
std::vector<std::string> aliases;
ModelCapabilities capabilities;
bool fine_tuned() const { return type == "fine-tuned"; }
static ModelCard parse(const Json& doc);
};
struct ModelList {
std::vector<ModelCard> models;
bool truncated = false;
Json raw;
static ModelList parse(const Json& doc);
const ModelCard* find(const std::string& id) const;
};
struct ModelDeleted {
std::string id;
bool deleted = false;
};
class Models : public MistralService {
public:
explicit Models(std::shared_ptr<llm::ApiClient> client) : MistralService(std::move(client)) {}
ModelList list(const std::string& provider = "", const std::string& model = "");
ModelCard get(const std::string& model_id);
ModelDeleted remove(const std::string& model_id); // explicit, irreversible
};
} // namespace molo::mistral