MCPcopy Create free account
hub / github.com/microsoft/Webwright / resolve_model_config_path

Function resolve_model_config_path

src/webwright/tools/_model_config.py:43–64  ·  view source on GitHub ↗

Return the path to a config containing a top-level ``model:`` block. Resolution order: 1. ``model_config_arg`` (absolute or relative to ``workspace_dir``). 2. `` /config_snapshot/merged_config.yaml`` (written by the CLI).

(model_config_arg: str, *, workspace_dir: str)

Source from the content-addressed store, hash-verified

41
42
43def resolve_model_config_path(model_config_arg: str, *, workspace_dir: str) -> Path:
44 """Return the path to a config containing a top-level ``model:`` block.
45
46 Resolution order:
47 1. ``model_config_arg`` (absolute or relative to ``workspace_dir``).
48 2. ``<workspace_dir>/config_snapshot/merged_config.yaml`` (written by the CLI).
49 """
50 candidates: list[Path] = []
51 if model_config_arg:
52 configured = Path(model_config_arg)
53 candidates.append(configured)
54 if workspace_dir and not configured.is_absolute():
55 candidates.append(Path(workspace_dir) / configured)
56 if workspace_dir:
57 candidates.append(Path(workspace_dir) / DEFAULT_MERGED_CONFIG_RELPATH)
58 for candidate in candidates:
59 if candidate.exists():
60 return candidate.resolve()
61 raise FileNotFoundError(
62 "No tool model config found. Pass --model-config <path> or run via the agent so "
63 f"<workspace-dir>/{DEFAULT_MERGED_CONFIG_RELPATH} is available."
64 )
65
66
67def load_tool_model(

Calls

no outgoing calls