data-designer 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data_designer/__init__.py +15 -0
- data_designer/_version.py +34 -0
- data_designer/cli/README.md +236 -0
- data_designer/cli/__init__.py +6 -0
- data_designer/cli/commands/__init__.py +2 -0
- data_designer/cli/commands/list.py +130 -0
- data_designer/cli/commands/models.py +10 -0
- data_designer/cli/commands/providers.py +11 -0
- data_designer/cli/commands/reset.py +100 -0
- data_designer/cli/controllers/__init__.py +7 -0
- data_designer/cli/controllers/model_controller.py +246 -0
- data_designer/cli/controllers/provider_controller.py +317 -0
- data_designer/cli/forms/__init__.py +20 -0
- data_designer/cli/forms/builder.py +51 -0
- data_designer/cli/forms/field.py +180 -0
- data_designer/cli/forms/form.py +59 -0
- data_designer/cli/forms/model_builder.py +125 -0
- data_designer/cli/forms/provider_builder.py +76 -0
- data_designer/cli/main.py +44 -0
- data_designer/cli/repositories/__init__.py +8 -0
- data_designer/cli/repositories/base.py +39 -0
- data_designer/cli/repositories/model_repository.py +42 -0
- data_designer/cli/repositories/provider_repository.py +43 -0
- data_designer/cli/services/__init__.py +7 -0
- data_designer/cli/services/model_service.py +116 -0
- data_designer/cli/services/provider_service.py +111 -0
- data_designer/cli/ui.py +448 -0
- data_designer/cli/utils.py +47 -0
- data_designer/config/__init__.py +2 -0
- data_designer/config/analysis/column_profilers.py +89 -0
- data_designer/config/analysis/column_statistics.py +274 -0
- data_designer/config/analysis/dataset_profiler.py +60 -0
- data_designer/config/analysis/utils/errors.py +8 -0
- data_designer/config/analysis/utils/reporting.py +188 -0
- data_designer/config/base.py +68 -0
- data_designer/config/column_configs.py +354 -0
- data_designer/config/column_types.py +168 -0
- data_designer/config/config_builder.py +660 -0
- data_designer/config/data_designer_config.py +40 -0
- data_designer/config/dataset_builders.py +11 -0
- data_designer/config/datastore.py +151 -0
- data_designer/config/default_model_settings.py +123 -0
- data_designer/config/errors.py +19 -0
- data_designer/config/interface.py +54 -0
- data_designer/config/models.py +231 -0
- data_designer/config/preview_results.py +32 -0
- data_designer/config/processors.py +41 -0
- data_designer/config/sampler_constraints.py +51 -0
- data_designer/config/sampler_params.py +604 -0
- data_designer/config/seed.py +145 -0
- data_designer/config/utils/code_lang.py +83 -0
- data_designer/config/utils/constants.py +313 -0
- data_designer/config/utils/errors.py +19 -0
- data_designer/config/utils/info.py +88 -0
- data_designer/config/utils/io_helpers.py +273 -0
- data_designer/config/utils/misc.py +81 -0
- data_designer/config/utils/numerical_helpers.py +28 -0
- data_designer/config/utils/type_helpers.py +100 -0
- data_designer/config/utils/validation.py +336 -0
- data_designer/config/utils/visualization.py +427 -0
- data_designer/config/validator_params.py +96 -0
- data_designer/engine/__init__.py +2 -0
- data_designer/engine/analysis/column_profilers/base.py +55 -0
- data_designer/engine/analysis/column_profilers/judge_score_profiler.py +160 -0
- data_designer/engine/analysis/column_profilers/registry.py +20 -0
- data_designer/engine/analysis/column_statistics.py +142 -0
- data_designer/engine/analysis/dataset_profiler.py +125 -0
- data_designer/engine/analysis/errors.py +7 -0
- data_designer/engine/analysis/utils/column_statistics_calculations.py +209 -0
- data_designer/engine/analysis/utils/judge_score_processing.py +128 -0
- data_designer/engine/column_generators/__init__.py +2 -0
- data_designer/engine/column_generators/generators/__init__.py +2 -0
- data_designer/engine/column_generators/generators/base.py +61 -0
- data_designer/engine/column_generators/generators/expression.py +63 -0
- data_designer/engine/column_generators/generators/llm_generators.py +172 -0
- data_designer/engine/column_generators/generators/samplers.py +75 -0
- data_designer/engine/column_generators/generators/seed_dataset.py +149 -0
- data_designer/engine/column_generators/generators/validation.py +147 -0
- data_designer/engine/column_generators/registry.py +56 -0
- data_designer/engine/column_generators/utils/errors.py +13 -0
- data_designer/engine/column_generators/utils/judge_score_factory.py +57 -0
- data_designer/engine/column_generators/utils/prompt_renderer.py +98 -0
- data_designer/engine/configurable_task.py +82 -0
- data_designer/engine/dataset_builders/artifact_storage.py +181 -0
- data_designer/engine/dataset_builders/column_wise_builder.py +287 -0
- data_designer/engine/dataset_builders/errors.py +13 -0
- data_designer/engine/dataset_builders/multi_column_configs.py +44 -0
- data_designer/engine/dataset_builders/utils/__init__.py +2 -0
- data_designer/engine/dataset_builders/utils/concurrency.py +184 -0
- data_designer/engine/dataset_builders/utils/config_compiler.py +60 -0
- data_designer/engine/dataset_builders/utils/dag.py +56 -0
- data_designer/engine/dataset_builders/utils/dataset_batch_manager.py +190 -0
- data_designer/engine/dataset_builders/utils/errors.py +13 -0
- data_designer/engine/errors.py +49 -0
- data_designer/engine/model_provider.py +75 -0
- data_designer/engine/models/__init__.py +2 -0
- data_designer/engine/models/errors.py +308 -0
- data_designer/engine/models/facade.py +225 -0
- data_designer/engine/models/litellm_overrides.py +162 -0
- data_designer/engine/models/parsers/__init__.py +2 -0
- data_designer/engine/models/parsers/errors.py +34 -0
- data_designer/engine/models/parsers/parser.py +236 -0
- data_designer/engine/models/parsers/postprocessors.py +93 -0
- data_designer/engine/models/parsers/tag_parsers.py +60 -0
- data_designer/engine/models/parsers/types.py +82 -0
- data_designer/engine/models/recipes/base.py +79 -0
- data_designer/engine/models/recipes/response_recipes.py +291 -0
- data_designer/engine/models/registry.py +118 -0
- data_designer/engine/models/usage.py +75 -0
- data_designer/engine/models/utils.py +38 -0
- data_designer/engine/processing/ginja/__init__.py +2 -0
- data_designer/engine/processing/ginja/ast.py +64 -0
- data_designer/engine/processing/ginja/environment.py +461 -0
- data_designer/engine/processing/ginja/exceptions.py +54 -0
- data_designer/engine/processing/ginja/record.py +30 -0
- data_designer/engine/processing/gsonschema/__init__.py +2 -0
- data_designer/engine/processing/gsonschema/exceptions.py +8 -0
- data_designer/engine/processing/gsonschema/schema_transformers.py +81 -0
- data_designer/engine/processing/gsonschema/types.py +8 -0
- data_designer/engine/processing/gsonschema/validators.py +143 -0
- data_designer/engine/processing/processors/base.py +15 -0
- data_designer/engine/processing/processors/drop_columns.py +46 -0
- data_designer/engine/processing/processors/registry.py +20 -0
- data_designer/engine/processing/utils.py +120 -0
- data_designer/engine/registry/base.py +97 -0
- data_designer/engine/registry/data_designer_registry.py +37 -0
- data_designer/engine/registry/errors.py +10 -0
- data_designer/engine/resources/managed_dataset_generator.py +35 -0
- data_designer/engine/resources/managed_dataset_repository.py +194 -0
- data_designer/engine/resources/managed_storage.py +63 -0
- data_designer/engine/resources/resource_provider.py +46 -0
- data_designer/engine/resources/seed_dataset_data_store.py +66 -0
- data_designer/engine/sampling_gen/column.py +89 -0
- data_designer/engine/sampling_gen/constraints.py +95 -0
- data_designer/engine/sampling_gen/data_sources/base.py +214 -0
- data_designer/engine/sampling_gen/data_sources/errors.py +10 -0
- data_designer/engine/sampling_gen/data_sources/sources.py +342 -0
- data_designer/engine/sampling_gen/entities/__init__.py +2 -0
- data_designer/engine/sampling_gen/entities/assets/zip_area_code_map.parquet +0 -0
- data_designer/engine/sampling_gen/entities/dataset_based_person_fields.py +64 -0
- data_designer/engine/sampling_gen/entities/email_address_utils.py +169 -0
- data_designer/engine/sampling_gen/entities/errors.py +8 -0
- data_designer/engine/sampling_gen/entities/national_id_utils.py +100 -0
- data_designer/engine/sampling_gen/entities/person.py +142 -0
- data_designer/engine/sampling_gen/entities/phone_number.py +122 -0
- data_designer/engine/sampling_gen/errors.py +24 -0
- data_designer/engine/sampling_gen/generator.py +121 -0
- data_designer/engine/sampling_gen/jinja_utils.py +60 -0
- data_designer/engine/sampling_gen/people_gen.py +203 -0
- data_designer/engine/sampling_gen/person_constants.py +54 -0
- data_designer/engine/sampling_gen/schema.py +143 -0
- data_designer/engine/sampling_gen/schema_builder.py +59 -0
- data_designer/engine/sampling_gen/utils.py +40 -0
- data_designer/engine/secret_resolver.py +80 -0
- data_designer/engine/validators/__init__.py +17 -0
- data_designer/engine/validators/base.py +36 -0
- data_designer/engine/validators/local_callable.py +34 -0
- data_designer/engine/validators/python.py +245 -0
- data_designer/engine/validators/remote.py +83 -0
- data_designer/engine/validators/sql.py +60 -0
- data_designer/errors.py +5 -0
- data_designer/essentials/__init__.py +137 -0
- data_designer/interface/__init__.py +2 -0
- data_designer/interface/data_designer.py +351 -0
- data_designer/interface/errors.py +16 -0
- data_designer/interface/results.py +55 -0
- data_designer/logging.py +161 -0
- data_designer/plugin_manager.py +83 -0
- data_designer/plugins/__init__.py +6 -0
- data_designer/plugins/errors.py +10 -0
- data_designer/plugins/plugin.py +69 -0
- data_designer/plugins/registry.py +86 -0
- data_designer-0.1.0.dist-info/METADATA +173 -0
- data_designer-0.1.0.dist-info/RECORD +177 -0
- data_designer-0.1.0.dist-info/WHEEL +4 -0
- data_designer-0.1.0.dist-info/entry_points.txt +2 -0
- data_designer-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from data_designer._version import __version__
|
|
6
|
+
except ImportError:
|
|
7
|
+
# Fallback for editable installs without build
|
|
8
|
+
try:
|
|
9
|
+
from importlib.metadata import version
|
|
10
|
+
|
|
11
|
+
__version__ = version("data-designer")
|
|
12
|
+
except Exception:
|
|
13
|
+
__version__ = "0.0.0.dev0+unknown"
|
|
14
|
+
|
|
15
|
+
__all__ = ["__version__"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '0.1.0'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 1, 0)
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# 🎨 NeMo Data Designer CLI
|
|
2
|
+
|
|
3
|
+
This directory contains the Command-Line Interface (CLI) for configuring model providers and model configurations used in Data Designer.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The CLI provides an interactive interface for managing:
|
|
8
|
+
- **Model Providers**: LLM API endpoints (NVIDIA, OpenAI, Anthropic, custom providers)
|
|
9
|
+
- **Model Configs**: Specific model configurations with inference parameters
|
|
10
|
+
|
|
11
|
+
Configuration files are stored in `~/.data-designer/` by default and can be referenced by Data Designer workflows.
|
|
12
|
+
|
|
13
|
+
## Architecture
|
|
14
|
+
|
|
15
|
+
The CLI follows a **layered architecture** pattern, separating concerns into distinct layers:
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
19
|
+
│ Commands │
|
|
20
|
+
│ Entry points for CLI commands (list, providers, models) │
|
|
21
|
+
└─────────────────────────────────────────────────────────────┘
|
|
22
|
+
│
|
|
23
|
+
▼
|
|
24
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
25
|
+
│ Controllers │
|
|
26
|
+
│ Orchestrate user workflows and coordinate between layers │
|
|
27
|
+
└─────────────────────────────────────────────────────────────┘
|
|
28
|
+
│
|
|
29
|
+
┌───────────────────┴───────────────────┐
|
|
30
|
+
▼ ▼
|
|
31
|
+
┌──────────────────┐ ┌──────────────────┐
|
|
32
|
+
│ Services │ │ Forms │
|
|
33
|
+
│ Business logic │ │ Interactive UI │
|
|
34
|
+
└──────────────────┘ └──────────────────┘
|
|
35
|
+
│
|
|
36
|
+
▼
|
|
37
|
+
┌──────────────────┐
|
|
38
|
+
│ Repositories │
|
|
39
|
+
│ Data persistence│
|
|
40
|
+
└──────────────────┘
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Layer Responsibilities
|
|
44
|
+
|
|
45
|
+
#### 1. **Commands** (`commands/`)
|
|
46
|
+
- **Purpose**: Define CLI command entry points using Typer
|
|
47
|
+
- **Responsibilities**:
|
|
48
|
+
- Parse command-line arguments and options
|
|
49
|
+
- Initialize controllers with appropriate configuration
|
|
50
|
+
- Handle top-level error reporting
|
|
51
|
+
- **Files**:
|
|
52
|
+
- `list.py`: List current configurations
|
|
53
|
+
- `models.py`: Configure models
|
|
54
|
+
- `providers.py`: Configure providers
|
|
55
|
+
- `reset.py`: Reset/delete configurations
|
|
56
|
+
|
|
57
|
+
#### 2. **Controllers** (`controllers/`)
|
|
58
|
+
- **Purpose**: Orchestrate user workflows and coordinate between services, forms, and UI
|
|
59
|
+
- **Responsibilities**:
|
|
60
|
+
- Implement the main workflow logic (add, update, delete, etc.)
|
|
61
|
+
- Coordinate between services and interactive forms
|
|
62
|
+
- Handle user navigation and session state
|
|
63
|
+
- Manage associated resource deletion (e.g., deleting models when provider is deleted)
|
|
64
|
+
- **Files**:
|
|
65
|
+
- `model_controller.py`: Orchestrates model configuration workflows
|
|
66
|
+
- `provider_controller.py`: Orchestrates provider configuration workflows
|
|
67
|
+
|
|
68
|
+
**Key Features**:
|
|
69
|
+
- **Associated Resource Management**: When deleting a provider, the controller checks for associated models and prompts the user to delete them together
|
|
70
|
+
- **Interactive Navigation**: Supports add/update/delete/delete_all operations with user-friendly menus
|
|
71
|
+
|
|
72
|
+
#### 3. **Services** (`services/`)
|
|
73
|
+
- **Purpose**: Implement business logic and enforce domain rules
|
|
74
|
+
- **Responsibilities**:
|
|
75
|
+
- Validate business rules (e.g., unique names, required fields)
|
|
76
|
+
- Implement CRUD operations with validation
|
|
77
|
+
- Coordinate between multiple repositories when needed
|
|
78
|
+
- Handle default management (e.g., default provider selection)
|
|
79
|
+
- **Files**:
|
|
80
|
+
- `model_service.py`: Model configuration business logic
|
|
81
|
+
- `provider_service.py`: Provider business logic
|
|
82
|
+
|
|
83
|
+
**Key Methods**:
|
|
84
|
+
- `list_all()`: Get all configured items
|
|
85
|
+
- `get_by_*()`: Retrieve specific items
|
|
86
|
+
- `add()`: Add new item with validation
|
|
87
|
+
- `update()`: Update existing item
|
|
88
|
+
- `delete()`: Delete single item
|
|
89
|
+
- `delete_by_aliases()`: Batch delete (models only)
|
|
90
|
+
- `find_by_provider()`: Find models by provider (models only)
|
|
91
|
+
- `set_default()`, `get_default()`: Manage default provider (providers only)
|
|
92
|
+
|
|
93
|
+
#### 4. **Repositories** (`repositories/`)
|
|
94
|
+
- **Purpose**: Handle data persistence (YAML file I/O)
|
|
95
|
+
- **Responsibilities**:
|
|
96
|
+
- Load configuration from YAML files
|
|
97
|
+
- Save configuration to YAML files
|
|
98
|
+
- Check file existence
|
|
99
|
+
- Delete configuration files
|
|
100
|
+
- **Files**:
|
|
101
|
+
- `base.py`: Abstract base repository with common operations
|
|
102
|
+
- `model_repository.py`: Model configuration persistence
|
|
103
|
+
- `provider_repository.py`: Provider persistence
|
|
104
|
+
|
|
105
|
+
**Base Repository Pattern**:
|
|
106
|
+
```python
|
|
107
|
+
class ConfigRepository(ABC, Generic[T]):
|
|
108
|
+
def load(self) -> T | None: ...
|
|
109
|
+
def save(self, config: T) -> None: ...
|
|
110
|
+
def exists(self) -> bool: ...
|
|
111
|
+
def delete(self) -> None: ...
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### 5. **Forms** (`forms/`)
|
|
115
|
+
- **Purpose**: Interactive form-based data collection from users
|
|
116
|
+
- **Responsibilities**:
|
|
117
|
+
- Define form fields with validation
|
|
118
|
+
- Collect user input interactively
|
|
119
|
+
- Support navigation (back, cancel)
|
|
120
|
+
- Build configuration objects from form data
|
|
121
|
+
- **Files**:
|
|
122
|
+
- `builder.py`: Abstract form builder base
|
|
123
|
+
- `field.py`: Form field types (TextField, SelectField, NumericField)
|
|
124
|
+
- `form.py`: Form container and prompt orchestration
|
|
125
|
+
- `model_builder.py`: Interactive model configuration builder
|
|
126
|
+
- `provider_builder.py`: Interactive provider configuration builder
|
|
127
|
+
|
|
128
|
+
**Form Features**:
|
|
129
|
+
- Field-level validation
|
|
130
|
+
- Auto-completion support
|
|
131
|
+
- History navigation (arrow keys)
|
|
132
|
+
- Default value handling
|
|
133
|
+
- Back navigation support
|
|
134
|
+
|
|
135
|
+
#### 6. **UI Utilities** (`ui.py`)
|
|
136
|
+
- **Purpose**: User interface utilities for terminal output and input
|
|
137
|
+
- **Responsibilities**:
|
|
138
|
+
- Interactive menus with arrow key navigation
|
|
139
|
+
- Text input prompts with validation
|
|
140
|
+
- Confirmation dialogs
|
|
141
|
+
- Styled output (success, error, warning, info)
|
|
142
|
+
- Configuration preview displays
|
|
143
|
+
- **Key Functions**:
|
|
144
|
+
- `select_with_arrows()`: Interactive arrow-key menu
|
|
145
|
+
- `prompt_text_input()`: Text input with validation and completion
|
|
146
|
+
- `confirm_action()`: Yes/no confirmation
|
|
147
|
+
- `print_*()`: Styled console output
|
|
148
|
+
- `display_config_preview()`: YAML preview with syntax highlighting
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
## Configuration Files
|
|
152
|
+
|
|
153
|
+
The CLI manages two YAML configuration files:
|
|
154
|
+
|
|
155
|
+
### `~/.data-designer/model_providers.yaml`
|
|
156
|
+
|
|
157
|
+
Stores model provider configurations (API endpoints):
|
|
158
|
+
|
|
159
|
+
```yaml
|
|
160
|
+
providers:
|
|
161
|
+
- name: nvidia
|
|
162
|
+
endpoint: https://integrate.api.nvidia.com/v1
|
|
163
|
+
provider_type: openai
|
|
164
|
+
api_key: NVIDIA_API_KEY
|
|
165
|
+
- name: openai
|
|
166
|
+
endpoint: https://api.openai.com/v1
|
|
167
|
+
provider_type: openai
|
|
168
|
+
api_key: OPENAI_API_KEY
|
|
169
|
+
default: nvidia
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### `~/.data-designer/model_configs.yaml`
|
|
173
|
+
|
|
174
|
+
Stores model configurations:
|
|
175
|
+
|
|
176
|
+
```yaml
|
|
177
|
+
model_configs:
|
|
178
|
+
- alias: llama3-70b
|
|
179
|
+
model: meta/llama-3.1-70b-instruct
|
|
180
|
+
provider: nvidia
|
|
181
|
+
inference_parameters:
|
|
182
|
+
temperature: 0.7
|
|
183
|
+
top_p: 0.9
|
|
184
|
+
max_tokens: 2048
|
|
185
|
+
max_parallel_requests: 4
|
|
186
|
+
- alias: gpt-4
|
|
187
|
+
model: gpt-4-turbo
|
|
188
|
+
provider: openai
|
|
189
|
+
inference_parameters:
|
|
190
|
+
temperature: 0.8
|
|
191
|
+
top_p: 0.95
|
|
192
|
+
max_tokens: 4096
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Usage Examples
|
|
196
|
+
|
|
197
|
+
### Configure Providers
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Interactive provider configuration
|
|
201
|
+
data-designer config providers
|
|
202
|
+
|
|
203
|
+
# Options:
|
|
204
|
+
# - Add a new provider (predefined: nvidia, openai, anthropic, or custom)
|
|
205
|
+
# - Update an existing provider
|
|
206
|
+
# - Delete a provider (with associated model cleanup)
|
|
207
|
+
# - Delete all providers
|
|
208
|
+
# - Change default provider
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Configure Models
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# Interactive model configuration
|
|
215
|
+
data-designer config models
|
|
216
|
+
|
|
217
|
+
# Options:
|
|
218
|
+
# - Add a new model
|
|
219
|
+
# - Update an existing model
|
|
220
|
+
# - Delete a model
|
|
221
|
+
# - Delete all models
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### List Configurations
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# Display current configurations
|
|
228
|
+
data-designer config list
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Reset Configurations
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
# Delete configuration files (with confirmation)
|
|
235
|
+
data-designer config reset
|
|
236
|
+
```
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from rich.table import Table
|
|
5
|
+
|
|
6
|
+
from data_designer.cli.repositories.model_repository import ModelRepository
|
|
7
|
+
from data_designer.cli.repositories.provider_repository import ProviderRepository
|
|
8
|
+
from data_designer.cli.ui import console, print_error, print_header, print_info, print_warning
|
|
9
|
+
from data_designer.config.utils.constants import DATA_DESIGNER_HOME, NordColor
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def list_command() -> None:
|
|
13
|
+
"""List current Data Designer configurations.
|
|
14
|
+
|
|
15
|
+
Returns:
|
|
16
|
+
None
|
|
17
|
+
"""
|
|
18
|
+
# Determine config directory
|
|
19
|
+
print_header("Data Designer Configurations")
|
|
20
|
+
print_info(f"Configuration directory: {DATA_DESIGNER_HOME}")
|
|
21
|
+
console.print()
|
|
22
|
+
|
|
23
|
+
# Display providers
|
|
24
|
+
display_providers(ProviderRepository(DATA_DESIGNER_HOME))
|
|
25
|
+
display_models(ModelRepository(DATA_DESIGNER_HOME))
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def display_providers(provider_repo: ProviderRepository) -> None:
|
|
29
|
+
"""Load and display model providers.
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
provider_repo: Provider repository
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
None
|
|
36
|
+
"""
|
|
37
|
+
try:
|
|
38
|
+
provider_registry = provider_repo.load()
|
|
39
|
+
|
|
40
|
+
if not provider_registry:
|
|
41
|
+
print_warning("Providers have not been configured. Run 'data-designer config providers' to configure them.")
|
|
42
|
+
console.print()
|
|
43
|
+
return
|
|
44
|
+
|
|
45
|
+
# Display as table
|
|
46
|
+
table = Table(title="Model Providers", border_style=NordColor.NORD8.value)
|
|
47
|
+
table.add_column("Name", style=NordColor.NORD14.value, no_wrap=True)
|
|
48
|
+
table.add_column("Endpoint", style=NordColor.NORD4.value)
|
|
49
|
+
table.add_column("Type", style=NordColor.NORD9.value, no_wrap=True)
|
|
50
|
+
table.add_column("API Key", style=NordColor.NORD7.value)
|
|
51
|
+
table.add_column("Default", style=NordColor.NORD13.value, justify="center")
|
|
52
|
+
|
|
53
|
+
default_name = provider_registry.default or provider_registry.providers[0].name
|
|
54
|
+
|
|
55
|
+
for provider in provider_registry.providers:
|
|
56
|
+
is_default = "✓" if provider.name == default_name else ""
|
|
57
|
+
api_key_display = provider.api_key or "(not set)"
|
|
58
|
+
|
|
59
|
+
# Mask actual API keys (keep env var names visible)
|
|
60
|
+
if provider.api_key and not provider.api_key.isupper():
|
|
61
|
+
api_key_display = "***" + provider.api_key[-4:] if len(provider.api_key) > 4 else "***"
|
|
62
|
+
|
|
63
|
+
table.add_row(
|
|
64
|
+
provider.name,
|
|
65
|
+
provider.endpoint,
|
|
66
|
+
provider.provider_type,
|
|
67
|
+
api_key_display,
|
|
68
|
+
is_default,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
console.print(table)
|
|
72
|
+
console.print()
|
|
73
|
+
except Exception as e:
|
|
74
|
+
print_error(f"Error loading provider configuration: {e}")
|
|
75
|
+
console.print()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def display_models(model_repo: ModelRepository) -> None:
|
|
79
|
+
"""Load and display model configurations.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
model_repo: Model repository
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
None
|
|
86
|
+
"""
|
|
87
|
+
try:
|
|
88
|
+
registry = model_repo.load()
|
|
89
|
+
|
|
90
|
+
if not registry:
|
|
91
|
+
print_warning("Models have not been configured. Run 'data-designer config models' to configure them.")
|
|
92
|
+
console.print()
|
|
93
|
+
return
|
|
94
|
+
|
|
95
|
+
# Display as table
|
|
96
|
+
table = Table(title="Model Configurations", border_style=NordColor.NORD8.value)
|
|
97
|
+
table.add_column("Alias", style=NordColor.NORD14.value, no_wrap=True)
|
|
98
|
+
table.add_column("Model ID", style=NordColor.NORD4.value)
|
|
99
|
+
table.add_column("Provider", style=NordColor.NORD9.value, no_wrap=True)
|
|
100
|
+
table.add_column("Temperature", style=NordColor.NORD15.value, justify="right")
|
|
101
|
+
table.add_column("Top P", style=NordColor.NORD15.value, justify="right")
|
|
102
|
+
table.add_column("Max Tokens", style=NordColor.NORD15.value, justify="right")
|
|
103
|
+
|
|
104
|
+
for mc in registry.model_configs:
|
|
105
|
+
# Handle distribution-based parameters
|
|
106
|
+
temp_display = (
|
|
107
|
+
f"{mc.inference_parameters.temperature:.2f}"
|
|
108
|
+
if isinstance(mc.inference_parameters.temperature, (int, float))
|
|
109
|
+
else "dist"
|
|
110
|
+
)
|
|
111
|
+
top_p_display = (
|
|
112
|
+
f"{mc.inference_parameters.top_p:.2f}"
|
|
113
|
+
if isinstance(mc.inference_parameters.top_p, (int, float))
|
|
114
|
+
else "dist"
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
table.add_row(
|
|
118
|
+
mc.alias,
|
|
119
|
+
mc.model,
|
|
120
|
+
mc.provider or "(default)",
|
|
121
|
+
temp_display,
|
|
122
|
+
top_p_display,
|
|
123
|
+
str(mc.inference_parameters.max_tokens) if mc.inference_parameters.max_tokens else "(none)",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
console.print(table)
|
|
127
|
+
console.print()
|
|
128
|
+
except Exception as e:
|
|
129
|
+
print_error(f"Error loading model configuration: {e}")
|
|
130
|
+
console.print()
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from data_designer.cli.controllers.model_controller import ModelController
|
|
5
|
+
from data_designer.config.utils.constants import DATA_DESIGNER_HOME
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def models_command() -> None:
|
|
9
|
+
controller = ModelController(DATA_DESIGNER_HOME)
|
|
10
|
+
controller.run()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from data_designer.cli.controllers.provider_controller import ProviderController
|
|
5
|
+
from data_designer.config.utils.constants import DATA_DESIGNER_HOME
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def providers_command() -> None:
|
|
9
|
+
"""Configure model providers interactively."""
|
|
10
|
+
controller = ProviderController(DATA_DESIGNER_HOME)
|
|
11
|
+
controller.run()
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import typer
|
|
5
|
+
|
|
6
|
+
from data_designer.cli.repositories.model_repository import ModelRepository
|
|
7
|
+
from data_designer.cli.repositories.provider_repository import ProviderRepository
|
|
8
|
+
from data_designer.cli.ui import (
|
|
9
|
+
confirm_action,
|
|
10
|
+
console,
|
|
11
|
+
print_error,
|
|
12
|
+
print_header,
|
|
13
|
+
print_info,
|
|
14
|
+
print_success,
|
|
15
|
+
print_text,
|
|
16
|
+
)
|
|
17
|
+
from data_designer.config.utils.constants import DATA_DESIGNER_HOME
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def reset_command() -> None:
|
|
21
|
+
"""Reset configuration files by deleting them after confirmation."""
|
|
22
|
+
print_header("Reset Configuration")
|
|
23
|
+
|
|
24
|
+
# Determine configuration directory
|
|
25
|
+
print_info(f"Configuration directory: {DATA_DESIGNER_HOME}")
|
|
26
|
+
console.print()
|
|
27
|
+
|
|
28
|
+
# Create repositories
|
|
29
|
+
provider_repo = ProviderRepository(DATA_DESIGNER_HOME)
|
|
30
|
+
model_repo = ModelRepository(DATA_DESIGNER_HOME)
|
|
31
|
+
|
|
32
|
+
# Check which config files exist
|
|
33
|
+
provider_exists = provider_repo.exists()
|
|
34
|
+
model_exists = model_repo.exists()
|
|
35
|
+
|
|
36
|
+
if not provider_exists and not model_exists:
|
|
37
|
+
print_success("There are no configurations to reset! Nothing to do!")
|
|
38
|
+
console.print()
|
|
39
|
+
raise typer.Exit(0)
|
|
40
|
+
|
|
41
|
+
# Show what configuration files exist
|
|
42
|
+
print_text("Found the following configuration files:")
|
|
43
|
+
console.print()
|
|
44
|
+
|
|
45
|
+
if provider_exists:
|
|
46
|
+
print_text(f" |-- ⚙️ Model providers: {provider_repo.config_file}")
|
|
47
|
+
|
|
48
|
+
if model_exists:
|
|
49
|
+
print_text(f" |-- 🤖 Model configs: {model_repo.config_file}")
|
|
50
|
+
|
|
51
|
+
console.print()
|
|
52
|
+
console.print()
|
|
53
|
+
print_text("👀 You will be asked to confirm deletion for each file individually")
|
|
54
|
+
console.print()
|
|
55
|
+
|
|
56
|
+
# Track deletion results
|
|
57
|
+
deleted_count = 0
|
|
58
|
+
skipped_count = 0
|
|
59
|
+
failed_count = 0
|
|
60
|
+
|
|
61
|
+
# Ask for confirmation and delete model providers
|
|
62
|
+
if provider_exists:
|
|
63
|
+
if confirm_action(
|
|
64
|
+
f"Delete model providers configuration in {str(provider_repo.config_file)!r}?", default=False
|
|
65
|
+
):
|
|
66
|
+
try:
|
|
67
|
+
provider_repo.delete()
|
|
68
|
+
print_success("Deleted model providers configuration")
|
|
69
|
+
deleted_count += 1
|
|
70
|
+
except Exception as e:
|
|
71
|
+
print_error(f"Failed to delete model providers configuration: {e}")
|
|
72
|
+
failed_count += 1
|
|
73
|
+
else:
|
|
74
|
+
print_text(" |-- Skipped model providers configuration")
|
|
75
|
+
skipped_count += 1
|
|
76
|
+
console.print()
|
|
77
|
+
|
|
78
|
+
# Ask for confirmation and delete model configs
|
|
79
|
+
if model_exists:
|
|
80
|
+
if confirm_action(f"Delete model configs configuration in {str(model_repo.config_file)!r}?", default=False):
|
|
81
|
+
try:
|
|
82
|
+
model_repo.delete()
|
|
83
|
+
print_success("Deleted model configs configuration")
|
|
84
|
+
deleted_count += 1
|
|
85
|
+
except Exception as e:
|
|
86
|
+
print_error(f"Failed to delete model configs configuration: {e}")
|
|
87
|
+
failed_count += 1
|
|
88
|
+
else:
|
|
89
|
+
print_info("Skipped model configs configuration")
|
|
90
|
+
skipped_count += 1
|
|
91
|
+
console.print()
|
|
92
|
+
|
|
93
|
+
# Summary
|
|
94
|
+
if deleted_count > 0:
|
|
95
|
+
print_success(f"Successfully deleted {deleted_count} configuration file(s)")
|
|
96
|
+
if skipped_count > 0:
|
|
97
|
+
print_info(f"Skipped {skipped_count} configuration file(s)")
|
|
98
|
+
if failed_count > 0:
|
|
99
|
+
print_error(f"Failed to delete {failed_count} configuration file(s)")
|
|
100
|
+
raise typer.Exit(1)
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
from data_designer.cli.controllers.model_controller import ModelController
|
|
5
|
+
from data_designer.cli.controllers.provider_controller import ProviderController
|
|
6
|
+
|
|
7
|
+
__all__ = ["ModelController", "ProviderController"]
|