#include "anthropic/core/version.h" #include "llm/error.h" namespace molo::anthropic::core { // VERSIONS-BEGIN (checked against docs api/versioning by tools/check_spec.py) static const VersionInfo kVersions[] = { {ApiVersion::k20230601, "2023-06-01", true, true, true}, {ApiVersion::k20261021, "2026-10-21", false, false, false}, }; // VERSIONS-END const VersionInfo& version_info(ApiVersion version) { for (const VersionInfo& v : kVersions) if (v.version == version) return v; return kVersions[0]; } const char* version_name(ApiVersion version) { return version_info(version).wire; } ApiVersion parse_version(const std::string& wire) { for (const VersionInfo& v : kVersions) if (wire == v.wire) return v.version; throw llm::ApiError::invalid("anthropic", "unknown anthropic-version '" + wire + "'"); } std::size_t version_count() { return sizeof(kVersions) / sizeof(kVersions[0]); } const VersionInfo& version_at(std::size_t index) { return kVersions[index]; } } // namespace molo::anthropic::core