MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / _python_models

Function _python_models

lib/cli/src/crewai_cli/api_keys.py:584–600  ·  view source on GitHub ↗
(project_dir: Path, saved: Mapping[str, str | None])

Source from the content-addressed store, hash-verified

582
583
584def _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
603def _text(path: Path) -> str:

Callers 1

ask_for_missing_api_keysFunction · 0.85

Calls 4

_configured_modelFunction · 0.85
_textFunction · 0.70
appendMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected