forked from phoenix-oss/llama-stack-mirror
# What does this PR do? - add --version to llama stack CLI - add /version endpoint - run OpenAPI generator for the new endpoint ## Test Plan **CLI** <img width="184" alt="image" src="https://github.com/user-attachments/assets/3acb1d22-453e-4b79-baf6-e98e88d0671c" /> **endpoint** <img width="430" alt="image" src="https://github.com/user-attachments/assets/79cdd670-493b-40cf-8f9e-28a4ac0988ac" /> ## Sources Please link relevant resources if necessary. ## Before submitting - [ ] This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case). - [ ] Ran pre-commit to handle lint / formatting issues. - [ ] Read the [contributor guideline](https://github.com/meta-llama/llama-stack/blob/main/CONTRIBUTING.md), Pull Request section? - [ ] Updated relevant documentation. - [ ] Wrote necessary unit or integration tests.
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the terms described in the LICENSE file in
|
|
# the root directory of this source tree.
|
|
|
|
import argparse
|
|
from importlib.metadata import version
|
|
|
|
from llama_stack.cli.subcommand import Subcommand
|
|
|
|
from .build import StackBuild
|
|
from .configure import StackConfigure
|
|
from .list_apis import StackListApis
|
|
from .list_providers import StackListProviders
|
|
from .run import StackRun
|
|
|
|
|
|
class StackParser(Subcommand):
|
|
def __init__(self, subparsers: argparse._SubParsersAction):
|
|
super().__init__()
|
|
self.parser = subparsers.add_parser(
|
|
"stack",
|
|
prog="llama stack",
|
|
description="Operations for the Llama Stack / Distributions",
|
|
)
|
|
|
|
self.parser.add_argument(
|
|
"--version",
|
|
action="version",
|
|
version=f"{version('llama-stack')}",
|
|
)
|
|
|
|
subparsers = self.parser.add_subparsers(title="stack_subcommands")
|
|
|
|
# Add sub-commands
|
|
StackBuild.create(subparsers)
|
|
StackConfigure.create(subparsers)
|
|
StackListApis.create(subparsers)
|
|
StackListProviders.create(subparsers)
|
|
StackRun.create(subparsers)
|