Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ options:
dump actual configuration into JSON file and quit
-s, --dump-schema dump configuration schema into OpenAPI-compatible file and quit
-m, --dump-models dump schemas for all models into OpenAPI-compatible file and quit
-gr, --dump-models-group {requests,successful_responses,error_responses,common,agents,common_responses}
-gr, --dump-models-group {conversation_summary,requests,successful_responses,error_responses,common,agents,common_responses}
dump schemas for selected models group into OpenAPI-compatible file and quit
-c, --config CONFIG_FILE
path to configuration file (default: lightspeed-stack.yaml)
Expand Down
5 changes: 3 additions & 2 deletions src/lightspeed_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def create_argument_parser() -> ArgumentParser:
- -d / --dump-configuration: dump the loaded configuration to JSON and exit
- -s / --dump-schema: dump the configuration schema to OpenAPI JSON and exit
- -m / --dump-models: dump schemas for all models into OpenAPI-compatible file and quit
- -gr / --dump-models-group {requests,successful_responses,error_responses,common,agents,
common_responses}
- -gr / --dump-models-group {conversation_summary,requests,successful_responses,
error_responses,common,agents,common_responses}
dump schemas for selected models group into OpenAPI-compatible file and quit
- -c / --config: path to the configuration file (default "lightspeed-stack.yaml")
- -g / --generate-llama-stack-configuration: generate a Llama Stack
Expand Down Expand Up @@ -80,6 +80,7 @@ def create_argument_parser() -> ArgumentParser:
help="dump schemas for selected models group into OpenAPI-compatible file and quit",
action="store",
choices=[
"conversation_summary",
"requests",
"successful_responses",
"error_responses",
Expand Down
4 changes: 4 additions & 0 deletions src/utils/models_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def get_models_for_group(model_group: str) -> list[type[BaseModel]]:
"""Return the list of Pydantic model classes for the given model group.

Supported groups:
- "conversation_summary"
- "requests"
- "successful_responses"
- "error_responses"
Expand All @@ -201,7 +202,10 @@ def get_models_for_group(model_group: str) -> list[type[BaseModel]]:
------
Exception: If model_group is not a recognized group name.
"""
# pylint: disable=too-many-return-statements
match model_group:
case "conversation_summary":
return conversation_summary_models
case "requests":
return requests_models
case "successful_responses":
Expand Down
17 changes: 14 additions & 3 deletions tests/unit/utils/test_models_dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -9506,7 +9506,7 @@ def test_dump_models_group_error_responses(tmpdir: Path) -> None:
check_json_file_content(filename, expected_schemas)


def test_dump_models_group_common_models(tmpdir: Path) -> None:
def test_dump_models_group_common(tmpdir: Path) -> None:
"""Test that selected models can be dump into a JSON file."""
group = "common"
filename = tmpdir / "foo.json"
Expand Down Expand Up @@ -9539,7 +9539,7 @@ def test_dump_models_group_common_models(tmpdir: Path) -> None:
check_json_file_content(filename, expected_schemas)


def test_dump_models_group_agent_models(tmpdir: Path) -> None:
def test_dump_models_group_agent(tmpdir: Path) -> None:
"""Test that selected models can be dump into a JSON file."""
group = "agents"
filename = tmpdir / "foo.json"
Expand All @@ -9565,7 +9565,7 @@ def test_dump_models_group_agent_models(tmpdir: Path) -> None:
check_json_file_content(filename, expected_schemas)


def test_dump_models_common_responses_models(tmpdir: Path) -> None:
def test_dump_models_common_responses(tmpdir: Path) -> None:
"""Test that selected models can be dump into a JSON file."""
group = "common_responses"
filename = tmpdir / "foo.json"
Expand All @@ -9579,6 +9579,17 @@ def test_dump_models_common_responses_models(tmpdir: Path) -> None:
check_json_file_content(filename, expected_schemas)


def test_dump_models_conversation_summary(tmpdir: Path) -> None:
"""Test that selected models can be dump into a JSON file."""
group = "conversation_summary"
filename = tmpdir / "foo.json"
dump_models_group(group, filename)

# list of schemas expected in a dump
expected_schemas = ("ConversationSummary",)
check_json_file_content(filename, expected_schemas)
Comment thread
coderabbitai[bot] marked this conversation as resolved.


def test_dump_models_unknown_group() -> None:
"""Test that exception is raised for unknown model group."""
with pytest.raises(ValueError, match="Unknown model group provided: unknown"):
Expand Down
Loading