(project_dir: Path, saved: Mapping[str, str | None])
| 582 | |
| 583 | |
| 584 | def _python_models(project_dir: Path, saved: Mapping[str, str | None]) -> list[str]: |
| 585 | source = project_dir / "src" |
| 586 | models = [ |
| 587 | model |
| 588 | for path in sorted(source.glob("**/config/agents.yaml")) |
| 589 | for model in _YAML_LLM.findall(_text(path)) |
| 590 | ] |
| 591 | configured = _configured_model(saved, env_file_wins=False) |
| 592 | if configured: |
| 593 | models.append(configured) |
| 594 | # With no model named anywhere, agents run on crewAI's default, unless the |
| 595 | # project's code passes them an llm this check cannot read. |
| 596 | if not models and not any( |
| 597 | _CODE_LLM.search(_text(path)) for path in source.glob("**/*.py") |
| 598 | ): |
| 599 | models.append(DEFAULT_LLM_MODEL) |
| 600 | return models |
| 601 | |
| 602 | |
| 603 | def _text(path: Path) -> str: |
no test coverage detected