A JSON crew crewAI builds for real, its one agent on LLM.
(folder: Path, llm: str | dict[str, str])
| 1285 | |
| 1286 | |
| 1287 | def buildable_json_crew(folder: Path, llm: str | dict[str, str]) -> Path: |
| 1288 | """A JSON crew crewAI builds for real, its one agent on LLM.""" |
| 1289 | # crewAI loads a `.env` when it is first imported: import it before a test |
| 1290 | # sets the keys. |
| 1291 | import crewai.project.crew_loader # noqa: F401 |
| 1292 | |
| 1293 | write(folder / "pyproject.toml", JSON_CREW_PYPROJECT) |
| 1294 | write( |
| 1295 | folder / "agents" / "researcher.jsonc", |
| 1296 | json.dumps( |
| 1297 | {"role": "Researcher", "goal": "Research", "backstory": "Curious", "llm": llm} |
| 1298 | ), |
| 1299 | ) |
| 1300 | return write( |
| 1301 | folder / "crew.jsonc", |
| 1302 | '{"name": "Demo", "agents": ["researcher"], "memory": false, "tasks": ' |
| 1303 | '[{"description": "Say hi", "expected_output": "hi", "agent": "researcher"}]}', |
| 1304 | ) |
| 1305 | |
| 1306 | |
| 1307 | def keyless_json_crew(folder: Path, monkeypatch: pytest.MonkeyPatch, llm: str) -> None: |
no test coverage detected