WeaviateEx.Version (WeaviateEx v0.7.4)
View SourceWeaviate server version detection and validation.
Ensures client compatibility with the connected Weaviate instance. The minimum supported version is 1.27.0.
Examples
# Parse a version string
{:ok, {1, 28, 0}} = Version.parse("1.28.0")
# Check if a version meets the minimum requirement
true = Version.meets_minimum?({1, 28, 0}, {1, 27, 0})
# Validate server version
:ok = Version.validate_server({1, 28, 0})
Summary
Functions
Check server compatibility by fetching the meta endpoint.
Format a version tuple to a string.
Extract gRPC max message size from meta response.
Extract server version from meta endpoint response.
Get the minimum Weaviate version required for gRPC support.
Check if a version meets the minimum requirement.
Get the minimum supported Weaviate version.
Get the minimum supported version as a string.
Parse a version string into a tuple.
Check if a server version supports gRPC.
Validate that a server version is supported.
Types
@type version() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
Functions
Check server compatibility by fetching the meta endpoint.
This function requires a client module that implements meta/1.
Returns :ok if the server version is compatible, or an error tuple
with details about why it's incompatible.
Examples
# Assuming you have a client that can fetch meta
:ok = Version.check_compatibility(client)
# If server version is too old
{:error, "Weaviate server version 1.20.0 is below minimum required 1.27.0"}
Format a version tuple to a string.
Examples
iex> Version.format_version({1, 28, 0})
"1.28.0"
@spec get_grpc_max_message_size(map()) :: {:ok, pos_integer()} | :default
Extract gRPC max message size from meta response.
Weaviate returns the maximum gRPC message size in the meta endpoint.
Examples
Version.get_grpc_max_message_size(%{"grpcMaxMessageSize" => 104858000})
# => {:ok, 104858000}
Version.get_grpc_max_message_size(%{})
# => :default
Extract server version from meta endpoint response.
The meta response is expected to have a "version" key with a version string.
Examples
iex> Version.get_server_version(%{"version" => "1.28.0"})
{:ok, {1, 28, 0}}
iex> Version.get_server_version(%{})
{:error, :no_version}
@spec grpc_minimum_version() :: version()
Get the minimum Weaviate version required for gRPC support.
Examples
iex> Version.grpc_minimum_version()
{1, 23, 0}
Check if a version meets the minimum requirement.
Examples
iex> Version.meets_minimum?({1, 28, 0}, {1, 27, 0})
true
iex> Version.meets_minimum?({1, 26, 0}, {1, 27, 0})
false
@spec minimum_version() :: version()
Get the minimum supported Weaviate version.
Examples
iex> Version.minimum_version()
{1, 27, 0}
@spec minimum_version_string() :: String.t()
Get the minimum supported version as a string.
Examples
iex> Version.minimum_version_string()
"1.27.0"
Parse a version string into a tuple.
Handles versions with or without 'v' prefix, and ignores prerelease/build metadata.
Examples
iex> Version.parse("1.28.0")
{:ok, {1, 28, 0}}
iex> Version.parse("v1.28.0-rc1")
{:ok, {1, 28, 0}}
iex> Version.parse("invalid")
{:error, :invalid_version}
Check if a server version supports gRPC.
gRPC support was added in Weaviate 1.23.0.
Examples
iex> Version.supports_grpc?({1, 28, 0})
true
iex> Version.supports_grpc?({1, 22, 0})
false
Validate that a server version is supported.
Returns :ok if the version meets the minimum requirement (1.27.0),
otherwise returns an error with both the actual and minimum versions.
Examples
iex> Version.validate_server({1, 28, 0})
:ok
iex> Version.validate_server({1, 20, 0})
{:error, {:unsupported_version, {1, 20, 0}, {1, 27, 0}}}