@@ -22,7 +22,15 @@ class InvalidLlamaStackVersionException(Exception):
2222async def check_llama_stack_version (
2323 client : AsyncLlamaStackClient ,
2424) -> None :
25- """Check if the Llama Stack version is supported by the LCS."""
25+ """
26+ Verify the connected Llama Stack's version is within the supported range.
27+
28+ This coroutine fetches the Llama Stack version from the
29+ provided client and validates it against the configured minimal
30+ and maximal supported versions. Raises
31+ InvalidLlamaStackVersionException if the detected version is
32+ outside the supported range.
33+ """
2634 version_info = await client .inspect .version ()
2735 compare_versions (
2836 version_info .version ,
@@ -32,7 +40,23 @@ async def check_llama_stack_version(
3240
3341
3442def compare_versions (version_info : str , minimal : str , maximal : str ) -> None :
35- """Compare current Llama Stack version with minimal and maximal allowed versions."""
43+ """
44+ Validate that a semver version string is within the inclusive [minimal, maximal] range.
45+
46+ Parses `version_info`, `minimal`, and `maximal` with semver.Version.parse
47+ and compares them. If the current version is lower than `minimal` or
48+ higher than `maximal`, an InvalidLlamaStackVersionException is raised.
49+
50+ Parameters:
51+ version_info (str): Semver version string to validate (must be
52+ parseable by semver.Version.parse).
53+ minimal (str): Minimum allowed semver version (inclusive).
54+ maximal (str): Maximum allowed semver version (inclusive).
55+
56+ Raises:
57+ InvalidLlamaStackVersionException: If `version_info` is outside the
58+ inclusive range defined by `minimal` and `maximal`.
59+ """
3660 current_version = Version .parse (version_info )
3761 minimal_version = Version .parse (minimal )
3862 maximal_version = Version .parse (maximal )
0 commit comments