Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Deduplicate models_cmd → models_ops and remove talent system
Louis Choquel2d2c1d031062
diff --git a/pipelex/builder/CLAUDE.md b/pipelex/builder/CLAUDE.mdindex d7b319345..ac794be65 100644--- a/pipelex/builder/CLAUDE.md+++ b/pipelex/builder/CLAUDE.md@@ -37,16 +37,11 @@ pipe/operations/concept_ops.py # Parse/serialize concepts to TOMLinputs_ops.py # Generate example input JSON- models_ops.py # Model preset and talent operations+ models_ops.py # Model preset listing and markdown formattingoutput_ops.py # Generate output JSON representationspipe_ops.py # Parse/serialize pipes to TOMLrunner_code_ops.py # Code generation utilitiesvalidate_ops.py # Validation operations-talents/- llm_talent.py # LLMTalent enum + preset mapping- extract_talent.py # ExtractTalent enum + preset mapping- img_gen_talent.py # ImgGenTalent enum + preset mapping- search_talent.py # SearchTalent enum + preset mapping```## Spec Architecture@@ -80,6 +75,3 @@ Pipe inputs and outputs use multiplicity suffixes on concept names:- `Text[]` — variable-length list- `Text[N]` — exactly N items-## Talent System--Talents are abstract capability labels mapped to concrete model presets. They remain in `talents/` and are used by the `pipelex-agent models` CLI to help agents choose appropriate presets. PipeSpec subclasses accept model presets directly via a `model: str | None` field, bypassing talent resolution. When modifying talent enums, update both the enum and its preset mapping dict in `pipelex.toml`.diff --git a/pipelex/builder/operations/models_ops.py b/pipelex/builder/operations/models_ops.pyindex 1b2312d76..de5b1d272 100644--- a/pipelex/builder/operations/models_ops.py+++ b/pipelex/builder/operations/models_ops.py@@ -1,11 +1,10 @@-"""Core operation for listing model presets, aliases, waterfalls, and talent mappings."""+"""Core operation for listing model presets, aliases, and waterfalls."""from typing import Anyfrom pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.cogt.models.model_deck import ModelDeck-from pipelex.config import get_configfrom pipelex.hub import get_model_deckfrom pipelex.types import StrEnum@@ -95,36 +94,6 @@ def _filter_waterfalls_by_backend(return filtered-def _strip_sigil(value: str) -> str:- """Strip sigil prefix ($, @, ~) from a model reference to get the bare name."""- if value and value[0] in {"$", "@", "~"}:- return value[1:]- return value---def _filter_talent_mappings_by_backend(- mappings: dict[str, str],- presets_dict: dict[str, Any],- model_deck: ModelDeck,- model_type: ModelType,- backend: str,-) -> dict[str, str]:- """Filter talent mappings to only include those whose preset resolves to the given backend."""- filtered: dict[str, str] = {}- for talent_name, preset_name in mappings.items():- bare_name = _strip_sigil(preset_name)- setting = presets_dict.get(bare_name)- if setting is not None:- # Direct preset — resolve via its model handle- spec = _resolve_preset_backend(model_deck, setting.model, model_type)- else:- # May be an alias or waterfall reference — resolve via model_deck- spec = model_deck.get_optional_inference_model(model_handle=bare_name, model_type=model_type)- if spec is not None and spec.backend_name == backend:- filtered[talent_name] = preset_name- return filtered--def _build_presets_for_category(model_deck: ModelDeck,category: ModelCategory,@@ -204,80 +173,101 @@ def _build_waterfalls_for_category(return waterfalls-def _build_talent_mappings_for_category(- model_deck: ModelDeck,- category: ModelCategory,- mappings: dict[str, str],- backend: str | None,-) -> dict[str, str]:- """Build the talent mappings dict for a given category, optionally filtered by backend."""- if backend is None:- return mappings-- model_type = CATEGORY_TO_MODEL_TYPE[category]- presets_dict: dict[str, Any]- match category:- case ModelCategory.LLM:- presets_dict = model_deck.llm_presets- case ModelCategory.EXTRACT:- presets_dict = model_deck.extract_presets- case ModelCategory.IMG_GEN:- presets_dict = model_deck.img_gen_presets- case ModelCategory.SEARCH:- presets_dict = model_deck.search_presets-- return _filter_talent_mappings_by_backend(mappings, presets_dict, model_deck, model_type, backend)--def list_models(categories: list[ModelCategory] | None = None,backend: str | None = None,) -> dict[str, Any]:- """List available model presets, aliases, waterfalls, and talent mappings.+ """List available model presets, aliases, and waterfalls.Args:categories: Filter by model category. None or empty means all categories.backend: Filter by backend name. None means no filtering.Returns:- Dict with presets, aliases, waterfalls, and talent_mappings keyed by category.+ Dict with presets, aliases, and waterfalls keyed by category."""model_deck = get_model_deck()- builder_config = get_config().pipelex.builder_config- talent_mappings = builder_config.talent_preset_mappingspresets: dict[str, list[dict[str, Any]]] = {}aliases: dict[str, dict[str, str]] = {}waterfalls: dict[str, dict[str, list[str]]] = {}- talent: dict[str, dict[str, str]] = {}if _should_include(ModelCategory.LLM, categories):presets["llm"] = _build_presets_for_category(model_deck, ModelCategory.LLM, backend)aliases["llm"] = _build_aliases_for_category(model_deck, ModelCategory.LLM, backend)waterfalls["llm"] = _build_waterfalls_for_category(model_deck, ModelCategory.LLM, backend)- talent["llm"] = _build_talent_mappings_for_category(model_deck, ModelCategory.LLM, talent_mappings.llm, backend)if _should_include(ModelCategory.IMG_GEN, categories):presets["img_gen"] = _build_presets_for_category(model_deck, ModelCategory.IMG_GEN, backend)aliases["img_gen"] = _build_aliases_for_category(model_deck, ModelCategory.IMG_GEN, backend)waterfalls["img_gen"] = _build_waterfalls_for_category(model_deck, ModelCategory.IMG_GEN, backend)- talent["img_gen"] = _build_talent_mappings_for_category(model_deck, ModelCategory.IMG_GEN, talent_mappings.img_gen, backend)if _should_include(ModelCategory.EXTRACT, categories):presets["extract"] = _build_presets_for_category(model_deck, ModelCategory.EXTRACT, backend)aliases["extract"] = _build_aliases_for_category(model_deck, ModelCategory.EXTRACT, backend)waterfalls["extract"] = _build_waterfalls_for_category(model_deck, ModelCategory.EXTRACT, backend)- talent["extract"] = _build_talent_mappings_for_category(model_deck, ModelCategory.EXTRACT, talent_mappings.extract, backend)if _should_include(ModelCategory.SEARCH, categories):presets["search"] = _build_presets_for_category(model_deck, ModelCategory.SEARCH, backend)aliases["search"] = _build_aliases_for_category(model_deck, ModelCategory.SEARCH, backend)waterfalls["search"] = _build_waterfalls_for_category(model_deck, ModelCategory.SEARCH, backend)- talent["search"] = _build_talent_mappings_for_category(model_deck, ModelCategory.SEARCH, talent_mappings.search, backend)return {"presets": presets,"aliases": aliases,"waterfalls": waterfalls,- "talent_mappings": talent,}+++CATEGORY_DISPLAY_NAMES: dict[str, str] = {+ "llm": "LLM",+ "img_gen": "Image Generation",+ "extract": "Extract",+ "search": "Search",+}+++def format_models_markdown(result: dict[str, Any]) -> str:+ """Format the models result dict as markdown with bullet points."""+ lines: list[str] = ["# Available Models"]++ presets: dict[str, list[dict[str, Any]]] = result["presets"]+ aliases: dict[str, dict[str, str]] = result["aliases"]+ waterfalls: dict[str, dict[str, list[str]]] = result["waterfalls"]++ for category_key, display_name in CATEGORY_DISPLAY_NAMES.items():+ cat_presets = presets.get(category_key, [])+ cat_aliases = aliases.get(category_key, {})+ cat_waterfalls = waterfalls.get(category_key, {})++ if not cat_presets and not cat_aliases and not cat_waterfalls:+ continue++ lines.append(f"\n## {display_name}")++ if cat_presets:+ lines.append("\n### Presets")+ lines.append("\nPresets are the preferred way to specify models — each preset bundles a model with relevant settings.\n")+ for preset in cat_presets:+ description = preset.get("description", "")+ if description:+ lines.append(f"- ${preset['name']}: {description}")+ else:+ lines.append(f"- ${preset['name']}")++ if cat_aliases:+ lines.append("\n### Aliases")+ lines.append(+ "\nAliases provide stable names that can be retargeted when new models come out, so pipelines stay up to date without edits.\n"+ )+ for alias_name, alias_target in cat_aliases.items():+ lines.append(f"- @{alias_name} \u2192 {alias_target}")++ if cat_waterfalls:+ lines.append("\n### Waterfalls")+ lines.append("\nWaterfalls define ordered fallback chains — if the first model is unavailable, the next one is tried automatically.\n")+ for waterfall_name, fallback_list in cat_waterfalls.items():+ chain = " \u2192 ".join(fallback_list)+ lines.append(f"- ~{waterfall_name}: {chain}")++ return "\n".join(lines)diff --git a/pipelex/builder/talents/__init__.py b/pipelex/builder/talents/__init__.pydeleted file mode 100644index e69de29bb..000000000diff --git a/pipelex/builder/talents/extract_talent.py b/pipelex/builder/talents/extract_talent.pydeleted file mode 100644index 446adf7c3..000000000--- a/pipelex/builder/talents/extract_talent.py+++ /dev/null@@ -1,8 +0,0 @@-from pipelex.types import StrEnum---class ExtractTalent(StrEnum):- PDF_BASIC_TEXT_EXTRACTOR = "pdf-basic-text-extractor"- IMAGE_TEXT_EXTRACTOR = "image-text-extractor"- FULL_DOCUMENT_EXTRACTOR = "full-document-extractor"- WEB_PAGE_EXTRACTOR = "web-page-extractor"diff --git a/pipelex/builder/talents/img_gen_talent.py b/pipelex/builder/talents/img_gen_talent.pydeleted file mode 100644index 2517c2e82..000000000--- a/pipelex/builder/talents/img_gen_talent.py+++ /dev/null@@ -1,7 +0,0 @@-from pipelex.types import StrEnum---class ImgGenTalent(StrEnum):- GEN_IMAGE = "gen-image"- GEN_IMAGE_FAST = "gen-image-fast"- GEN_IMAGE_HIGH_QUALITY = "gen-image-high-quality"diff --git a/pipelex/builder/talents/llm_talent.py b/pipelex/builder/talents/llm_talent.pydeleted file mode 100644index dfb56f2a0..000000000--- a/pipelex/builder/talents/llm_talent.py+++ /dev/null@@ -1,13 +0,0 @@-from pipelex.types import StrEnum---class LLMTalent(StrEnum):- DATA_RETRIEVAL = "data-retrieval"- HR_EXPERT = "hr-expert"- ACCOUNTING_EXPERT = "accounting-expert"- CREATIVE_WRITER = "creative-writer"- ENGINEER = "engineer"- CODER = "coder"- CODE_ANALYZER = "code-analyzer"- VISION_LANGUAGE_MODEL = "vision-language-model"- VISUAL_DESIGNER = "visual-designer"diff --git a/pipelex/builder/talents/search_talent.py b/pipelex/builder/talents/search_talent.pydeleted file mode 100644index 3e2da3067..000000000--- a/pipelex/builder/talents/search_talent.py+++ /dev/null@@ -1,6 +0,0 @@-from pipelex.types import StrEnum---class SearchTalent(StrEnum):- WEB_SEARCH = "web-search"- WEB_SEARCH_DEEP = "web-search-deep"diff --git a/pipelex/cli/agent_cli/commands/check_model_cmd.py b/pipelex/cli/agent_cli/commands/check_model_cmd.pyindex c08e3d915..911cf4ecc 100644--- a/pipelex/cli/agent_cli/commands/check_model_cmd.py+++ b/pipelex/cli/agent_cli/commands/check_model_cmd.py@@ -4,9 +4,9 @@ from typing import Annotated, Anyimport typer+from pipelex.builder.operations.models_ops import CATEGORY_TO_MODEL_TYPE, ModelCategoryfrom pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat, agent_error, agent_success-from pipelex.cli.agent_cli.commands.models_cmd import CATEGORY_TO_MODEL_TYPE, ModelCategoryfrom pipelex.cogt.models.model_reference import ModelReference, ModelReferenceParseErrorfrom pipelex.cogt.models.model_suggestion import (KIND_LABELS,diff --git a/pipelex/cli/agent_cli/commands/models_cmd.py b/pipelex/cli/agent_cli/commands/models_cmd.pyindex 542df98d7..a237e35a8 100644--- a/pipelex/cli/agent_cli/commands/models_cmd.py+++ b/pipelex/cli/agent_cli/commands/models_cmd.py@@ -1,235 +1,13 @@"""Agent CLI models command -- list available model presets, aliases, and waterfalls."""-from typing import Annotated, Any+from typing import Annotatedimport typer+from pipelex.builder.operations.models_ops import ModelCategory, format_models_markdown, list_modelsfrom pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat, agent_error, agent_success-from pipelex.cogt.model_backends.model_spec import InferenceModelSpec-from pipelex.cogt.model_backends.model_type import ModelType-from pipelex.cogt.models.model_deck import ModelDeck-from pipelex.hub import get_model_deckfrom pipelex.pipelex import Pipelex-from pipelex.types import StrEnum---# TODO: get this from somewhere else, not hardcoded here.-class ModelCategory(StrEnum):- LLM = "llm"- EXTRACT = "extract"- IMG_GEN = "img_gen"- SEARCH = "search"---CATEGORY_TO_MODEL_TYPE: dict[ModelCategory, ModelType] = {- ModelCategory.LLM: ModelType.LLM,- ModelCategory.EXTRACT: ModelType.TEXT_EXTRACTOR,- ModelCategory.IMG_GEN: ModelType.IMG_GEN,- ModelCategory.SEARCH: ModelType.SEARCH,-}---def _should_include(category: ModelCategory, categories: list[ModelCategory] | None) -> bool:- """Check whether a category should be included given the filter list.-- Returns True when no filter is set (None or empty) or when the category is in the filter list.- """- return categories is None or len(categories) == 0 or category in categories---def _resolve_preset_backend(- model_deck: ModelDeck,- model_handle: str,- model_type: ModelType,-) -> InferenceModelSpec | None:- """Resolve a preset's model handle to an InferenceModelSpec, returning None if unresolvable."""- return model_deck.get_optional_inference_model(model_handle=model_handle, model_type=model_type)---def _filter_presets_by_backend(- presets_list: list[dict[str, Any]],- presets_dict: dict[str, Any],- model_deck: ModelDeck,- model_type: ModelType,- backend: str,-) -> list[dict[str, Any]]:- """Filter a presets list to only include presets whose model resolves to the given backend."""- filtered: list[dict[str, Any]] = []- for preset_entry in presets_list:- preset_name = preset_entry["name"]- setting = presets_dict.get(preset_name)- if setting is None:- continue- spec = _resolve_preset_backend(model_deck, setting.model, model_type)- if spec is not None and spec.backend_name == backend:- filtered.append(preset_entry)- return filtered---def _filter_aliases_by_backend(- aliases: dict[str, str],- model_deck: ModelDeck,- model_type: ModelType,- backend: str,-) -> dict[str, str]:- """Filter aliases to only include those whose target resolves to the given backend."""- filtered: dict[str, str] = {}- for alias_name, alias_target in aliases.items():- spec = model_deck.get_optional_inference_model(model_handle=alias_target, model_type=model_type)- if spec is not None and spec.backend_name == backend:- filtered[alias_name] = alias_target- return filtered---def _filter_waterfalls_by_backend(- waterfalls: dict[str, list[str]],- model_deck: ModelDeck,- model_type: ModelType,- backend: str,-) -> dict[str, list[str]]:- """Filter waterfalls to only include those where at least one fallback resolves to the given backend."""- filtered: dict[str, list[str]] = {}- for waterfall_name, fallback_list in waterfalls.items():- for fallback in fallback_list:- spec = model_deck.get_optional_inference_model(model_handle=fallback, model_type=model_type)- if spec is not None and spec.backend_name == backend:- filtered[waterfall_name] = fallback_list- break- return filtered---def _build_presets_for_category(- model_deck: ModelDeck,- category: ModelCategory,- backend: str | None,-) -> list[dict[str, Any]]:- """Build the presets list for a given category, optionally filtered by backend."""- presets_dict: dict[str, Any]- model_type = CATEGORY_TO_MODEL_TYPE[category]- match category:- case ModelCategory.LLM:- presets_dict = model_deck.llm_presets- case ModelCategory.EXTRACT:- presets_dict = model_deck.extract_presets- case ModelCategory.IMG_GEN:- presets_dict = model_deck.img_gen_presets- case ModelCategory.SEARCH:- presets_dict = model_deck.search_presets-- presets_list: list[dict[str, Any]] = []- for preset_name, setting in presets_dict.items():- entry: dict[str, Any] = {"name": preset_name}- if setting.description is not None:- entry["description"] = setting.description- presets_list.append(entry)-- if backend is not None:- presets_list = _filter_presets_by_backend(presets_list, presets_dict, model_deck, model_type, backend)-- return presets_list---def _build_aliases_for_category(- model_deck: ModelDeck,- category: ModelCategory,- backend: str | None,-) -> dict[str, str]:- """Build the aliases dict for a given category, optionally filtered by backend."""- model_type = CATEGORY_TO_MODEL_TYPE[category]- aliases: dict[str, str]- match category:- case ModelCategory.LLM:- aliases = model_deck.llm_aliases- case ModelCategory.EXTRACT:- aliases = model_deck.extract_aliases- case ModelCategory.IMG_GEN:- aliases = model_deck.img_gen_aliases- case ModelCategory.SEARCH:- aliases = model_deck.search_aliases-- if backend is not None:- aliases = _filter_aliases_by_backend(aliases, model_deck, model_type, backend)-- return aliases---def _build_waterfalls_for_category(- model_deck: ModelDeck,- category: ModelCategory,- backend: str | None,-) -> dict[str, list[str]]:- """Build the waterfalls dict for a given category, optionally filtered by backend."""- model_type = CATEGORY_TO_MODEL_TYPE[category]- waterfalls: dict[str, list[str]]- match category:- case ModelCategory.LLM:- waterfalls = model_deck.llm_waterfalls- case ModelCategory.EXTRACT:- waterfalls = model_deck.extract_waterfalls- case ModelCategory.IMG_GEN:- waterfalls = model_deck.img_gen_waterfalls- case ModelCategory.SEARCH:- waterfalls = model_deck.search_waterfalls-- if backend is not None:- waterfalls = _filter_waterfalls_by_backend(waterfalls, model_deck, model_type, backend)-- return waterfalls---CATEGORY_DISPLAY_NAMES: dict[str, str] = {- "llm": "LLM",- "img_gen": "Image Generation",- "extract": "Extract",- "search": "Search",-}---def _format_models_markdown(result: dict[str, Any]) -> str:- """Format the models result dict as markdown with bullet points."""- lines: list[str] = ["# Available Models"]-- presets: dict[str, list[dict[str, Any]]] = result["presets"]- aliases: dict[str, dict[str, str]] = result["aliases"]- waterfalls: dict[str, dict[str, list[str]]] = result["waterfalls"]-- for category_key, display_name in CATEGORY_DISPLAY_NAMES.items():- cat_presets = presets.get(category_key, [])- cat_aliases = aliases.get(category_key, {})- cat_waterfalls = waterfalls.get(category_key, {})-- if not cat_presets and not cat_aliases and not cat_waterfalls:- continue-- lines.append(f"\n## {display_name}")-- if cat_presets:- lines.append("\n### Presets")- lines.append("\nPresets are the preferred way to specify models — each preset bundles a model with relevant settings.\n")- for preset in cat_presets:- description = preset.get("description", "")- if description:- lines.append(f"- ${preset['name']}: {description}")- else:- lines.append(f"- ${preset['name']}")-- if cat_aliases:- lines.append("\n### Aliases")- lines.append(- "\nAliases provide stable names that can be retargeted when new models come out, so pipelines stay up to date without edits.\n"- )- for alias_name, alias_target in cat_aliases.items():- lines.append(f"- @{alias_name} \u2192 {alias_target}")-- if cat_waterfalls:- lines.append("\n### Waterfalls")- lines.append("\nWaterfalls define ordered fallback chains — if the first model is unavailable, the next one is tried automatically.\n")- for waterfall_name, fallback_list in cat_waterfalls.items():- chain = " \u2192 ".join(fallback_list)- lines.append(f"- ~{waterfall_name}: {chain}")-- return "\n".join(lines)def agent_models_cmd(@@ -255,44 +33,13 @@ def agent_models_cmd(try:make_pipelex_for_agent_cli(log_level=ctx.obj["log_level"], needs_inference=False, needs_model_specs=backend is not None)- model_deck = get_model_deck()-- presets: dict[str, list[dict[str, Any]]] = {}- aliases: dict[str, dict[str, str]] = {}- waterfalls: dict[str, dict[str, list[str]]] = {}-- if _should_include(ModelCategory.LLM, model_type):- presets["llm"] = _build_presets_for_category(model_deck, ModelCategory.LLM, backend)- aliases["llm"] = _build_aliases_for_category(model_deck, ModelCategory.LLM, backend)- waterfalls["llm"] = _build_waterfalls_for_category(model_deck, ModelCategory.LLM, backend)-- if _should_include(ModelCategory.IMG_GEN, model_type):- presets["img_gen"] = _build_presets_for_category(model_deck, ModelCategory.IMG_GEN, backend)- aliases["img_gen"] = _build_aliases_for_category(model_deck, ModelCategory.IMG_GEN, backend)- waterfalls["img_gen"] = _build_waterfalls_for_category(model_deck, ModelCategory.IMG_GEN, backend)-- if _should_include(ModelCategory.EXTRACT, model_type):- presets["extract"] = _build_presets_for_category(model_deck, ModelCategory.EXTRACT, backend)- aliases["extract"] = _build_aliases_for_category(model_deck, ModelCategory.EXTRACT, backend)- waterfalls["extract"] = _build_waterfalls_for_category(model_deck, ModelCategory.EXTRACT, backend)-- if _should_include(ModelCategory.SEARCH, model_type):- presets["search"] = _build_presets_for_category(model_deck, ModelCategory.SEARCH, backend)- aliases["search"] = _build_aliases_for_category(model_deck, ModelCategory.SEARCH, backend)- waterfalls["search"] = _build_waterfalls_for_category(model_deck, ModelCategory.SEARCH, backend)-- result: dict[str, Any] = {- "success": True,- "presets": presets,- "aliases": aliases,- "waterfalls": waterfalls,- }+ result = list_models(categories=model_type, backend=backend)match output_format:case CliOutputFormat.JSON:- agent_success(result)+ agent_success({"success": True, **result})case CliOutputFormat.MARKDOWN:- print(_format_models_markdown(result))+ print(format_models_markdown(result))except SystemExit:# agent_error already handled and called sys.exitraisediff --git a/pipelex/pipelex.toml b/pipelex/pipelex.tomlindex ce231ad8b..1bdfeba4c 100644--- a/pipelex/pipelex.toml+++ b/pipelex/pipelex.toml@@ -52,32 +52,6 @@ default_output_dir = "."default_bundle_file_name = "bundle"default_directory_base_name = "pipeline"-[pipelex.builder_config.talent_preset_mappings.llm]-data-retrieval = "$retrieval"-hr-expert = "$writing-factual"-accounting-expert = "$writing-factual"-creative-writer = "$writing-creative"-engineer = "$engineering-structured"-coder = "$engineering-code"-code-analyzer = "$engineering-codebase-analysis"-vision-language-model = "$vision"-visual-designer = "$img-gen-prompting"--[pipelex.builder_config.talent_preset_mappings.img_gen]-gen-image = "$gen-image"-gen-image-fast = "$gen-image-fast"-gen-image-high-quality = "$gen-image-high-quality"--[pipelex.builder_config.talent_preset_mappings.extract]-pdf-basic-text-extractor = "@default-text-from-pdf"-image-text-extractor = "@default-extract-image"-full-document-extractor = "@default-extract-document"-web-page-extractor = "@default-extract-web-page"--[pipelex.builder_config.talent_preset_mappings.search]-web-search = "$standard"-web-search-deep = "$deep"-[pipelex.feature_config]# WIP/Experimental feature flagsis_reporting_enabled = truediff --git a/pipelex/system/configuration/configs.py b/pipelex/system/configuration/configs.pyindex da5f03208..13e3afacb 100644--- a/pipelex/system/configuration/configs.py+++ b/pipelex/system/configuration/configs.py@@ -99,19 +99,11 @@ class ScanConfig(ConfigModel):return frozenset(value)-class TalentPresetMappings(ConfigModel):- llm: dict[str, str]- img_gen: dict[str, str]- extract: dict[str, str]- search: dict[str, str]--class BuilderConfig(ConfigModel):fix_loop_max_attempts: intdefault_output_dir: strdefault_bundle_file_name: strdefault_directory_base_name: str- talent_preset_mappings: TalentPresetMappingsclass PipelineExecutionConfig(ConfigModel):diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_extract_talent_presets.py b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_extract_talent_presets.pydeleted file mode 100644index 13e24c2dd..000000000--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_extract/test_extract_talent_presets.py+++ /dev/null@@ -1,49 +0,0 @@-import pytest--from pipelex.builder.talents.extract_talent import ExtractTalent-from pipelex.cogt.exceptions import ModelChoiceNotFoundError-from pipelex.cogt.models.model_deck_check import check_extract_choice_with_deck-from pipelex.config import get_config---class TestExtractTalent:- """Test that all ExtractTalent enum values are valid ExtractModelChoice values in the model deck."""-- def test_all_extract_talents_are_valid_extract_choices(self):- """Verify that every ExtractTalent enum value can be resolved as a valid ExtractModelChoice.-- This ensures that all talent-based extraction choices referenced in code are actually- configured in the model deck (as presets, waterfalls, aliases, or direct model names)- and available at runtime.- """- # Get all Extract talent values- mappings = get_config().pipelex.builder_config.talent_preset_mappings.extract-- # Act & Assert- invalid_choices: list[str] = []- for talent in ExtractTalent:- try:- # Use check_extract_choice_with_deck to validate - this checks both presets and handles- extract_choice = mappings[talent]- check_extract_choice_with_deck(extract_choice)- except ModelChoiceNotFoundError:- invalid_choices.append(talent.value)-- # Provide clear error message if any choices are invalid- assert not invalid_choices, (- f"The following ExtractTalent values are not valid extraction choices in the model deck: "- f"{', '.join(invalid_choices)}. "- f"Please add them as presets, waterfalls, aliases, or ensure they exist as direct model names "- f"in .pipelex/inference/deck/base_deck.toml or overrides.toml"- )-- def test_individual_extract_talents_are_valid(self):- """Test each ExtractTalent value individually for better error reporting."""- mappings = get_config().pipelex.builder_config.talent_preset_mappings.extract- for talent in ExtractTalent:- try:- # Use check_extract_choice_with_deck to validate - this checks both presets and handles- extract_choice = mappings[talent]- check_extract_choice_with_deck(extract_choice)- except ModelChoiceNotFoundError as exc:- pytest.fail(f"ExtractTalent.{talent.name} ('{talent.value}') is not a valid extraction choice in the model deck. Error: {exc}")diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_img_gen_talent_presets.py b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_img_gen_talent_presets.pydeleted file mode 100644index 6b83724a3..000000000--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_img_gen/test_img_gen_talent_presets.py+++ /dev/null@@ -1,49 +0,0 @@-import pytest--from pipelex.builder.talents.img_gen_talent import ImgGenTalent-from pipelex.cogt.exceptions import ModelChoiceNotFoundError-from pipelex.cogt.models.model_deck_check import check_img_gen_choice_with_deck-from pipelex.config import get_config---class TestImgGenTalent:- """Test that all ImgGenTalent enum values are valid ImgGenModelChoice values in the model deck."""-- def test_all_img_gen_talents_are_valid_img_gen_choices(self):- """Verify that every ImgGenTalent enum value can be resolved as a valid ImgGenModelChoice.-- This ensures that all talent-based image generation choices referenced in code are actually- configured in the model deck (as presets, waterfalls, aliases, or direct model names)- and available at runtime.- """- # Get all ImgGen talent values- mappings = get_config().pipelex.builder_config.talent_preset_mappings.img_gen-- # Act & Assert- invalid_choices: list[str] = []- for talent in ImgGenTalent:- try:- # Use check_img_gen_choice_with_deck to validate - this checks both presets and handles- img_gen_choice = mappings[talent]- check_img_gen_choice_with_deck(img_gen_choice)- except ModelChoiceNotFoundError:- invalid_choices.append(talent.value)-- # Provide clear error message if any choices are invalid- assert not invalid_choices, (- f"The following ImgGenTalent values are not valid image generation choices in the model deck: "- f"{', '.join(invalid_choices)}. "- f"Please add them as presets, waterfalls, aliases, or ensure they exist as direct model names "- f"in .pipelex/inference/deck/base_deck.toml or overrides.toml"- )-- def test_individual_img_gen_talents_are_valid(self):- """Test each ImgGenTalent value individually for better error reporting."""- mappings = get_config().pipelex.builder_config.talent_preset_mappings.img_gen- for talent in ImgGenTalent:- try:- # Use check_img_gen_choice_with_deck to validate - this checks both presets and handles- img_gen_choice = mappings[talent]- check_img_gen_choice_with_deck(img_gen_choice)- except ModelChoiceNotFoundError as exc:- pytest.fail(f"ImgGenTalent.{talent.name} ('{talent.value}') is not a valid image generation choice in the model deck. Error: {exc}")diff --git a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_llm_talent_presets.py b/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_llm_talent_presets.pydeleted file mode 100644index 5bfb700c2..000000000--- a/tests/unit/pipelex/builder/pipe/pipe_operator/pipe_llm/test_llm_talent_presets.py+++ /dev/null@@ -1,47 +0,0 @@-import pytest--from pipelex.builder.talents.llm_talent import LLMTalent-from pipelex.cogt.exceptions import ModelChoiceNotFoundError-from pipelex.cogt.models.model_deck_check import check_llm_choice_with_deck-from pipelex.config import get_config---class TestLLMTalent:- """Test that all LLMTalent enum values are valid LLMModelChoice values in the model deck."""-- def test_all_llm_talents_are_valid_llm_choices(self):- """Verify that every LLMTalent enum value can be resolved as a valid LLMModelChoice.-- This ensures that all talent-based LLM choices referenced in code are actually- configured in the model deck (as presets, waterfalls, aliases, or direct model names)- and available at runtime.- """- # Act & Assert- invalid_choices: list[str] = []- mappings = get_config().pipelex.builder_config.talent_preset_mappings.llm- for talent in LLMTalent:- try:- # Use check_llm_choice_with_deck to validate - this checks both presets and handles (including waterfalls)- llm_choice = mappings[talent]- check_llm_choice_with_deck(llm_choice)- except ModelChoiceNotFoundError:- invalid_choices.append(talent.value)-- # Provide clear error message if any choices are invalid- assert not invalid_choices, (- f"The following LLMTalent values are not valid LLM choices in the model deck: "- f"{', '.join(invalid_choices)}. "- f"Please add them as presets, waterfalls, aliases, or ensure they exist as direct model names "- f"in .pipelex/inference/deck/base_deck.toml or overrides.toml"- )-- def test_individual_llm_talents_are_valid(self):- """Test each LLMTalent value individually for better error reporting."""- mappings = get_config().pipelex.builder_config.talent_preset_mappings.llm- for talent in LLMTalent:- try:- # Use check_llm_choice_with_deck to validate - this checks both presets and handles (including waterfalls)- llm_choice = mappings[talent]- check_llm_choice_with_deck(llm_choice)- except ModelChoiceNotFoundError as exc:- pytest.fail(f"LLMTalent.{talent.name} ('{talent.value}') is not a valid LLM choice in the model deck. Error: {exc}")diff --git a/tests/unit/pipelex/cli/test_agent_models_cmd.py b/tests/unit/pipelex/cli/test_agent_models_cmd.pyindex a8ae8eeea..61d724fdf 100644--- a/tests/unit/pipelex/cli/test_agent_models_cmd.py+++ b/tests/unit/pipelex/cli/test_agent_models_cmd.py@@ -9,11 +9,13 @@ if TYPE_CHECKING:import pytestfrom pytest_mock import MockerFixture+from pipelex.builder.operations.models_ops import ModelCategoryfrom pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat-from pipelex.cli.agent_cli.commands.models_cmd import ModelCategory, agent_models_cmd+from pipelex.cli.agent_cli.commands.models_cmd import agent_models_cmdfrom pipelex.cogt.model_backends.model_type import ModelType-MODULE_PATH = "pipelex.cli.agent_cli.commands.models_cmd"+CMD_MODULE_PATH = "pipelex.cli.agent_cli.commands.models_cmd"+OPS_MODULE_PATH = "pipelex.builder.operations.models_ops"class _FakeSetting:@@ -95,9 +97,9 @@ def _make_fake_model_deck() -> Any:def _setup_mocks(mocker: MockerFixture) -> None:"""Patch the common dependencies for agent_models_cmd."""- mocker.patch(f"{MODULE_PATH}.make_pipelex_for_agent_cli")- mocker.patch(f"{MODULE_PATH}.get_model_deck", return_value=_make_fake_model_deck())- mocker.patch(f"{MODULE_PATH}.Pipelex")+ mocker.patch(f"{CMD_MODULE_PATH}.make_pipelex_for_agent_cli")+ mocker.patch(f"{OPS_MODULE_PATH}.get_model_deck", return_value=_make_fake_model_deck())+ mocker.patch(f"{CMD_MODULE_PATH}.Pipelex")class TestAgentModelsCmd:diff --git a/tests/unit/pipelex/cli/test_check_model_cmd.py b/tests/unit/pipelex/cli/test_check_model_cmd.pyindex 11080664a..b09bd6254 100644--- a/tests/unit/pipelex/cli/test_check_model_cmd.py+++ b/tests/unit/pipelex/cli/test_check_model_cmd.py@@ -9,9 +9,9 @@ if TYPE_CHECKING:import pytestfrom pytest_mock import MockerFixture+from pipelex.builder.operations.models_ops import ModelCategoryfrom pipelex.cli.agent_cli.commands.agent_output import CliOutputFormatfrom pipelex.cli.agent_cli.commands.check_model_cmd import agent_check_model_cmd-from pipelex.cli.agent_cli.commands.models_cmd import ModelCategoryfrom pipelex.cogt.model_backends.model_type import ModelTypeMODULE_PATH = "pipelex.cli.agent_cli.commands.check_model_cmd"diff --git a/tests/unit/pipelex/cli/test_format_models_markdown.py b/tests/unit/pipelex/cli/test_format_models_markdown.pyindex e0bd9b53c..681caf61d 100644--- a/tests/unit/pipelex/cli/test_format_models_markdown.py+++ b/tests/unit/pipelex/cli/test_format_models_markdown.py@@ -4,13 +4,11 @@ from __future__ import annotationsfrom typing import Any, ClassVar-from pipelex.cli.agent_cli.commands.models_cmd import (- _format_models_markdown, # noqa: PLC2701 # pyright: ignore[reportPrivateUsage]-)+from pipelex.builder.operations.models_ops import format_models_markdownclass TestFormatModelsMarkdown:- """Tests for _format_models_markdown output."""+ """Tests for format_models_markdown output."""_FULL_RESULT: ClassVar[dict[str, Any]] = {"success": True,@@ -39,48 +37,48 @@ class TestFormatModelsMarkdown:def test_output_starts_with_heading(self) -> None:"""Output should start with the main heading."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert output.startswith("# Available Models")def test_llm_category_present(self) -> None:"""LLM category with data should appear as a section."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "## LLM" in outputdef test_preset_with_description_uses_sigil(self) -> None:"""Preset with description should show $-prefixed name and description."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "- $writing-creative: Creative writing" in outputdef test_preset_without_description_uses_sigil(self) -> None:"""Preset without description should show only the $-prefixed name."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "- $engineering-code" in outputdef test_aliases_use_sigil_and_arrow(self) -> None:"""Aliases should use @-prefix and arrow notation."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "- @fast \u2192 gpt4o-mini" in outputdef test_waterfalls_use_sigil_and_chain(self) -> None:"""Waterfalls should use ~-prefix and show the full fallback chain."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "- ~robust: gpt4o \u2192 claude-sonnet \u2192 gemini" in outputdef test_no_bold_markers(self) -> None:"""Output should not contain bold markdown markers."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "**" not in outputdef test_empty_categories_omitted(self) -> None:"""Categories with no data should not appear in output."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "## Extract" not in outputassert "## Search" not in outputdef test_img_gen_category_present(self) -> None:"""Image Generation category with presets should appear with sigil."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "## Image Generation" in outputassert "- $gen-image: Image generation" in output@@ -91,7 +89,7 @@ class TestFormatModelsMarkdown:"aliases": {"llm": {}, "img_gen": {}, "extract": {}, "search": {}},"waterfalls": {"llm": {}, "img_gen": {}, "extract": {}, "search": {}},}- output = _format_models_markdown(empty_result)+ output = format_models_markdown(empty_result)assert "# Available Models" in outputassert "## LLM" not in output@@ -102,17 +100,17 @@ class TestFormatModelsMarkdown:"aliases": {"llm": {}},"waterfalls": {"llm": {}},}- output = _format_models_markdown(result)+ output = format_models_markdown(result)assert "### Presets" in outputassert "### Aliases" not in outputassert "### Waterfalls" not in outputdef test_presets_description_line(self) -> None:"""Presets section should include the one-liner description."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "Presets are the preferred way to specify models" in outputdef test_aliases_description_line(self) -> None:"""Aliases section should include the one-liner description."""- output = _format_models_markdown(self._FULL_RESULT)+ output = format_models_markdown(self._FULL_RESULT)assert "Aliases provide stable names" in output