talk-notes 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {talk_notes-0.1.0 → talk_notes-0.2.0}/AGENTS.md +1 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/GLOSSARY.md +1 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/PKG-INFO +8 -2
- {talk_notes-0.1.0 → talk_notes-0.2.0}/README.md +7 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/pyproject.toml +1 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/cli.py +1 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/llm/__init__.py +3 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/llm/claude_code.py +3 -2
- talk_notes-0.2.0/talk_notes/llm/codex.py +47 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_llm.py +71 -6
- {talk_notes-0.1.0 → talk_notes-0.2.0}/uv.lock +1 -1
- {talk_notes-0.1.0 → talk_notes-0.2.0}/.github/workflows/ci.yml +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/.github/workflows/release.yml +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/.gitignore +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/.python-version +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/CLAUDE.md +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/LICENSE +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/__init__.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/__main__.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/crop.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/llm/base.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/llm/fake.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/llm/ollama.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/prompts/report.md +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/render.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/report.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/slides.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/source.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/talk_folder.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/transcribe.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/transcript.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/talk_notes/util.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/conftest.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_cli.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_crop.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_report.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_slides.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_source.py +0 -0
- {talk_notes-0.1.0 → talk_notes-0.2.0}/tests/test_talk_folder.py +0 -0
|
@@ -7,5 +7,5 @@ CLI that turns a talk video into `slides/`, `talk.md` (transcript aligned to sli
|
|
|
7
7
|
- `av` is pinned below 16 because faster-whisper 1.2 passes an argument newer PyAV removed. Re-check this when bumping faster-whisper.
|
|
8
8
|
- `out/` holds generated talks and is gitignored.
|
|
9
9
|
- GPU path (`--extra gpu`, `--device cuda`) needs an NVIDIA host; it can't be tested on CPU-only machines.
|
|
10
|
-
- LLM backends live in `llm/`, one module per adapter, behind `ask(prompt, files) -> str` and `LLMError`. Callers pass absolute paths; the adapter decides how to deliver them. To add one
|
|
10
|
+
- LLM backends live in `llm/`, one module per adapter, behind `ask(prompt, files) -> str` and `LLMError`. Callers pass absolute paths; the adapter decides how to deliver them. To add one: write `llm/<name>.py` with a class that has `name` and `ask`, raise `LLMError` for every failure, add one entry to `ADAPTERS` in `llm/__init__.py`, and add tests next to the existing ones in `tests/test_llm.py` (stub CLI on `PATH` or stub HTTP server). Crop and report tests use `FakeLLM`; source tests replace yt-dlp through `UrlSource`'s `ydl_factory`; `tests/test_cli.py` runs the whole pipeline on a generated video.
|
|
11
11
|
- Domain terms are defined in `GLOSSARY.md`; use them in code, docs and reviews.
|
|
@@ -26,6 +26,6 @@ Terms used in talk-notes' code, docs and reviews.
|
|
|
26
26
|
|
|
27
27
|
**Label**: the tag that starts each point in a report: Problem, Cause, Evidence, Solution, Recommendation, Opinion or Caveat.
|
|
28
28
|
|
|
29
|
-
**LLM backend**: a way to ask an LLM a question about text and image files (`--llm`): Claude Code or Ollama.
|
|
29
|
+
**LLM backend**: a way to ask an LLM a question about text and image files (`--llm`): Claude Code, Codex or Ollama.
|
|
30
30
|
|
|
31
31
|
**Adapter**: the module in `llm/` that implements one LLM backend behind `ask(prompt, files)`. `FakeLLM` is the adapter for tests.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: talk-notes
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Turn a recorded tech talk into a transcript aligned with its slides, plus an LLM-written reference report
|
|
5
5
|
Project-URL: Homepage, https://github.com/ManuelCarullo/talk-notes
|
|
6
6
|
Project-URL: Issues, https://github.com/ManuelCarullo/talk-notes/issues
|
|
@@ -33,13 +33,18 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
|
|
34
34
|
# talk-notes
|
|
35
35
|
|
|
36
|
+
[](https://pypi.org/project/talk-notes/)
|
|
37
|
+
[](https://pypi.org/project/talk-notes/)
|
|
38
|
+
[](https://github.com/ManuelCarullo/talk-notes/actions/workflows/ci.yml)
|
|
39
|
+
[](https://github.com/ManuelCarullo/talk-notes/blob/main/LICENSE)
|
|
40
|
+
|
|
36
41
|
Turns a recorded tech talk into a knowledge-base entry:
|
|
37
42
|
|
|
38
43
|
- `slides/`: one image per slide, detected from the video.
|
|
39
44
|
- `talk.md`: the transcript grouped under each slide, with timestamp links back to the video.
|
|
40
45
|
- `report.md` (optional): a structured reference document written by an LLM from `talk.md` and the slides.
|
|
41
46
|
|
|
42
|
-
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default) or a local Ollama model, so the whole pipeline can run offline.
|
|
47
|
+
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default), the Codex CLI or a local Ollama model, so the whole pipeline can run offline.
|
|
43
48
|
|
|
44
49
|
## Install
|
|
45
50
|
|
|
@@ -94,6 +99,7 @@ A frame is sampled every `--slide-interval` seconds and perceptually hashed; a n
|
|
|
94
99
|
`--llm` picks the backend for `--crop auto` and the report; `--llm-model` overrides its model.
|
|
95
100
|
|
|
96
101
|
- `claude` (default): runs the Claude Code CLI (`claude -p`) read-only in the output folder.
|
|
102
|
+
- `codex`: runs the Codex CLI (`codex exec`) in a read-only sandbox in the output folder, using your Codex login and default model.
|
|
97
103
|
- `ollama`: uses a local Ollama server (`--ollama-url`, default `http://localhost:11434`; model `qwen3-vl:8b-instruct`). Start it with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve` to fit more of the model on the GPU.
|
|
98
104
|
|
|
99
105
|
> [!WARNING]
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
# talk-notes
|
|
2
2
|
|
|
3
|
+
[](https://pypi.org/project/talk-notes/)
|
|
4
|
+
[](https://pypi.org/project/talk-notes/)
|
|
5
|
+
[](https://github.com/ManuelCarullo/talk-notes/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/ManuelCarullo/talk-notes/blob/main/LICENSE)
|
|
7
|
+
|
|
3
8
|
Turns a recorded tech talk into a knowledge-base entry:
|
|
4
9
|
|
|
5
10
|
- `slides/`: one image per slide, detected from the video.
|
|
6
11
|
- `talk.md`: the transcript grouped under each slide, with timestamp links back to the video.
|
|
7
12
|
- `report.md` (optional): a structured reference document written by an LLM from `talk.md` and the slides.
|
|
8
13
|
|
|
9
|
-
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default) or a local Ollama model, so the whole pipeline can run offline.
|
|
14
|
+
Download, transcription and slide detection run locally (yt-dlp, faster-whisper, ffmpeg). The slide crop and the report use an LLM: the Claude Code CLI (default), the Codex CLI or a local Ollama model, so the whole pipeline can run offline.
|
|
10
15
|
|
|
11
16
|
## Install
|
|
12
17
|
|
|
@@ -61,6 +66,7 @@ A frame is sampled every `--slide-interval` seconds and perceptually hashed; a n
|
|
|
61
66
|
`--llm` picks the backend for `--crop auto` and the report; `--llm-model` overrides its model.
|
|
62
67
|
|
|
63
68
|
- `claude` (default): runs the Claude Code CLI (`claude -p`) read-only in the output folder.
|
|
69
|
+
- `codex`: runs the Codex CLI (`codex exec`) in a read-only sandbox in the output folder, using your Codex login and default model.
|
|
64
70
|
- `ollama`: uses a local Ollama server (`--ollama-url`, default `http://localhost:11434`; model `qwen3-vl:8b-instruct`). Start it with `OLLAMA_FLASH_ATTENTION=1 OLLAMA_KV_CACHE_TYPE=q8_0 ollama serve` to fit more of the model on the GPU.
|
|
65
71
|
|
|
66
72
|
> [!WARNING]
|
|
@@ -70,7 +70,7 @@ def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
|
|
|
70
70
|
|
|
71
71
|
m = p.add_argument_group("LLM (used by --crop auto and the report)")
|
|
72
72
|
m.add_argument("--llm", choices=sorted(ADAPTERS), default="claude",
|
|
73
|
-
help="claude runs the Claude Code CLI; ollama is fully local")
|
|
73
|
+
help="claude runs the Claude Code CLI, codex the Codex CLI; ollama is fully local")
|
|
74
74
|
m.add_argument("--llm-model", help="model name for the LLM backend (default: the backend's own default)")
|
|
75
75
|
m.add_argument("--ollama-url", default=DEFAULT_OLLAMA_URL, help="Ollama server used by --llm ollama")
|
|
76
76
|
|
|
@@ -14,11 +14,12 @@ from typing import Protocol
|
|
|
14
14
|
|
|
15
15
|
from talk_notes.llm.base import LLMError
|
|
16
16
|
from talk_notes.llm.claude_code import ClaudeCodeLLM
|
|
17
|
+
from talk_notes.llm.codex import CodexLLM
|
|
17
18
|
from talk_notes.llm.fake import FakeLLM
|
|
18
19
|
from talk_notes.llm.ollama import DEFAULT_URL as DEFAULT_OLLAMA_URL
|
|
19
20
|
from talk_notes.llm.ollama import OllamaLLM
|
|
20
21
|
|
|
21
|
-
__all__ = ["ADAPTERS", "DEFAULT_OLLAMA_URL", "LLM", "ClaudeCodeLLM", "FakeLLM", "LLMError", "OllamaLLM", "make_llm"]
|
|
22
|
+
__all__ = ["ADAPTERS", "DEFAULT_OLLAMA_URL", "LLM", "ClaudeCodeLLM", "CodexLLM", "FakeLLM", "LLMError", "OllamaLLM", "make_llm"]
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
class LLM(Protocol):
|
|
@@ -32,6 +33,7 @@ class LLM(Protocol):
|
|
|
32
33
|
# Backend name (as used by --llm) -> factory taking (model, ollama_url).
|
|
33
34
|
ADAPTERS: dict[str, Callable[[str | None, str], LLM]] = {
|
|
34
35
|
"claude": lambda model, ollama_url: ClaudeCodeLLM(model),
|
|
36
|
+
"codex": lambda model, ollama_url: CodexLLM(model),
|
|
35
37
|
"ollama": lambda model, ollama_url: OllamaLLM(model, ollama_url),
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -24,11 +24,12 @@ class ClaudeCodeLLM:
|
|
|
24
24
|
if files:
|
|
25
25
|
listing = "\n".join(f"- {f.relative_to(cwd)}" for f in files)
|
|
26
26
|
prompt += f"\n\nRead each of these files from the current folder, including every image:\n{listing}"
|
|
27
|
-
|
|
27
|
+
# The prompt goes in on stdin: as an argument, a long one could exceed the command-line length limit.
|
|
28
|
+
cmd = [exe, "-p", "--allowedTools", "Read"]
|
|
28
29
|
if self.model:
|
|
29
30
|
cmd += ["--model", self.model]
|
|
30
31
|
try:
|
|
31
|
-
result = subprocess.run(cmd, cwd=cwd,
|
|
32
|
+
result = subprocess.run(cmd, cwd=cwd, input=prompt, capture_output=True, text=True, check=False,
|
|
32
33
|
timeout=self.timeout)
|
|
33
34
|
except subprocess.TimeoutExpired:
|
|
34
35
|
raise LLMError(f"Claude Code did not answer within {self.timeout:.0f}s") from None
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import shutil
|
|
2
|
+
import subprocess
|
|
3
|
+
import tempfile
|
|
4
|
+
from collections.abc import Sequence
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
|
|
7
|
+
from talk_notes.llm.base import LLMError, common_dir
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class CodexLLM:
|
|
11
|
+
"""Runs `codex exec` in a read-only sandbox in the folder holding the files and returns its last message."""
|
|
12
|
+
|
|
13
|
+
def __init__(self, model: str | None = None, executable: str = "codex", timeout: float = 1800):
|
|
14
|
+
self.model = model
|
|
15
|
+
self.executable = executable
|
|
16
|
+
self.timeout = timeout
|
|
17
|
+
self.name = f"Codex ({model})" if model else "Codex"
|
|
18
|
+
|
|
19
|
+
def ask(self, prompt: str, files: Sequence[Path] = ()) -> str:
|
|
20
|
+
exe = shutil.which(self.executable)
|
|
21
|
+
if not exe:
|
|
22
|
+
raise LLMError(f"`{self.executable}` CLI not found; install Codex or choose another --llm")
|
|
23
|
+
files = [Path(f).resolve() for f in files]
|
|
24
|
+
cwd = common_dir(files)
|
|
25
|
+
if files:
|
|
26
|
+
listing = "\n".join(f"- {f.relative_to(cwd)}" for f in files)
|
|
27
|
+
prompt += f"\n\nRead each of these files from the current folder, including every image:\n{listing}"
|
|
28
|
+
with tempfile.TemporaryDirectory(prefix="talk-notes-codex-") as tmp:
|
|
29
|
+
answer_file = Path(tmp) / "answer.md"
|
|
30
|
+
# The prompt goes in on stdin (`-`): as an argument, a long one could exceed the command-line length limit.
|
|
31
|
+
cmd = [exe, "exec", "--sandbox", "read-only", "-c", 'approval_policy="never"', "--skip-git-repo-check",
|
|
32
|
+
"--ephemeral", "--color", "never", "-C", str(cwd), "-o", str(answer_file)]
|
|
33
|
+
if self.model:
|
|
34
|
+
cmd += ["--model", self.model]
|
|
35
|
+
cmd.append("-")
|
|
36
|
+
try:
|
|
37
|
+
result = subprocess.run(cmd, cwd=cwd, input=prompt, capture_output=True, text=True, check=False,
|
|
38
|
+
timeout=self.timeout)
|
|
39
|
+
except subprocess.TimeoutExpired:
|
|
40
|
+
raise LLMError(f"Codex did not answer within {self.timeout:.0f}s") from None
|
|
41
|
+
if result.returncode != 0:
|
|
42
|
+
detail = (result.stderr or result.stdout).strip()[-500:]
|
|
43
|
+
raise LLMError(f"Codex exited with {result.returncode}: {detail}")
|
|
44
|
+
answer = answer_file.read_text().strip() if answer_file.exists() else ""
|
|
45
|
+
if not answer:
|
|
46
|
+
raise LLMError("Codex returned an empty answer")
|
|
47
|
+
return answer
|
|
@@ -13,6 +13,7 @@ from PIL import Image
|
|
|
13
13
|
from talk_notes.llm import (
|
|
14
14
|
ADAPTERS,
|
|
15
15
|
ClaudeCodeLLM,
|
|
16
|
+
CodexLLM,
|
|
16
17
|
FakeLLM,
|
|
17
18
|
LLMError,
|
|
18
19
|
OllamaLLM,
|
|
@@ -24,8 +25,9 @@ from talk_notes.llm import ollama as ollama_module
|
|
|
24
25
|
|
|
25
26
|
def test_make_llm_returns_each_registered_backend():
|
|
26
27
|
assert isinstance(make_llm("claude"), ClaudeCodeLLM)
|
|
28
|
+
assert isinstance(make_llm("codex"), CodexLLM)
|
|
27
29
|
assert isinstance(make_llm("ollama", "some-model"), OllamaLLM)
|
|
28
|
-
assert set(ADAPTERS) == {"claude", "ollama"}
|
|
30
|
+
assert set(ADAPTERS) == {"claude", "codex", "ollama"}
|
|
29
31
|
|
|
30
32
|
|
|
31
33
|
def test_make_llm_rejects_unknown_backend():
|
|
@@ -57,7 +59,7 @@ def stub_claude(tmp_path, monkeypatch):
|
|
|
57
59
|
script = bin_dir / "claude"
|
|
58
60
|
script.write_text(f"""#!/usr/bin/env python3
|
|
59
61
|
import json, os, sys
|
|
60
|
-
json.dump({{"argv": sys.argv[1:], "cwd": os.getcwd()}}, open({str(log)!r}, "w"))
|
|
62
|
+
json.dump({{"argv": sys.argv[1:], "cwd": os.getcwd(), "stdin": sys.stdin.read()}}, open({str(log)!r}, "w"))
|
|
61
63
|
sys.stderr.write(os.environ.get("STUB_ERR", ""))
|
|
62
64
|
sys.stdout.write(os.environ.get("STUB_OUT", "answer"))
|
|
63
65
|
sys.exit(int(os.environ.get("STUB_RC", "0")))
|
|
@@ -79,10 +81,9 @@ def test_claude_runs_read_only_in_the_files_common_folder(tmp_path, stub_claude)
|
|
|
79
81
|
call = stub_claude()
|
|
80
82
|
assert answer == "answer"
|
|
81
83
|
assert Path(call["cwd"]) == talk.resolve()
|
|
82
|
-
|
|
83
|
-
assert
|
|
84
|
-
assert "- talk.md\n- slides/slide_001.jpg" in
|
|
85
|
-
assert call["argv"][-4:] == ["--allowedTools", "Read", "--model", "opus"]
|
|
84
|
+
assert call["argv"] == ["-p", "--allowedTools", "Read", "--model", "opus"]
|
|
85
|
+
assert call["stdin"].startswith("Summarise.")
|
|
86
|
+
assert "- talk.md\n- slides/slide_001.jpg" in call["stdin"]
|
|
86
87
|
|
|
87
88
|
|
|
88
89
|
@pytest.mark.parametrize(("env", "message"), [
|
|
@@ -101,6 +102,70 @@ def test_claude_missing_cli_raises_llm_error():
|
|
|
101
102
|
ClaudeCodeLLM(executable="claude-does-not-exist").ask("hi")
|
|
102
103
|
|
|
103
104
|
|
|
105
|
+
# --- Codex ---------------------------------------------------------------------------------------
|
|
106
|
+
|
|
107
|
+
@pytest.fixture
|
|
108
|
+
def stub_codex(tmp_path, monkeypatch):
|
|
109
|
+
"""A fake `codex` executable first on PATH. It records argv, cwd and stdin, then writes $STUB_OUT
|
|
110
|
+
to the file given with -o (unless $STUB_NO_FILE is set)."""
|
|
111
|
+
bin_dir = tmp_path / "bin"
|
|
112
|
+
bin_dir.mkdir()
|
|
113
|
+
log = tmp_path / "codex-call.json"
|
|
114
|
+
script = bin_dir / "codex"
|
|
115
|
+
script.write_text(f"""#!/usr/bin/env python3
|
|
116
|
+
import json, os, sys
|
|
117
|
+
args = sys.argv[1:]
|
|
118
|
+
json.dump({{"argv": args, "cwd": os.getcwd(), "stdin": sys.stdin.read()}}, open({str(log)!r}, "w"))
|
|
119
|
+
if not os.environ.get("STUB_NO_FILE"):
|
|
120
|
+
open(args[args.index("-o") + 1], "w").write(os.environ.get("STUB_OUT", "answer"))
|
|
121
|
+
sys.stderr.write(os.environ.get("STUB_ERR", ""))
|
|
122
|
+
sys.stdout.write("progress output that is not the answer")
|
|
123
|
+
sys.exit(int(os.environ.get("STUB_RC", "0")))
|
|
124
|
+
""")
|
|
125
|
+
script.chmod(script.stat().st_mode | stat.S_IEXEC)
|
|
126
|
+
monkeypatch.setenv("PATH", f"{bin_dir}{os.pathsep}{os.environ['PATH']}")
|
|
127
|
+
return lambda: json.loads(log.read_text())
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def test_codex_runs_read_only_in_the_files_common_folder(tmp_path, stub_codex):
|
|
131
|
+
talk = tmp_path / "talk"
|
|
132
|
+
(talk / "slides").mkdir(parents=True)
|
|
133
|
+
files = [talk / "talk.md", talk / "slides" / "slide_001.jpg"]
|
|
134
|
+
for f in files:
|
|
135
|
+
f.write_text("x")
|
|
136
|
+
|
|
137
|
+
answer = CodexLLM(model="gpt-test").ask("Summarise.", files)
|
|
138
|
+
|
|
139
|
+
call = stub_codex()
|
|
140
|
+
assert answer == "answer"
|
|
141
|
+
assert Path(call["cwd"]) == talk.resolve()
|
|
142
|
+
argv = call["argv"]
|
|
143
|
+
assert argv[0] == "exec" and argv[-1] == "-"
|
|
144
|
+
assert argv[argv.index("--sandbox") + 1] == "read-only"
|
|
145
|
+
assert argv[argv.index("-C") + 1] == str(talk.resolve())
|
|
146
|
+
assert argv[argv.index("--model") + 1] == "gpt-test"
|
|
147
|
+
assert "--ephemeral" in argv
|
|
148
|
+
assert call["stdin"].startswith("Summarise.")
|
|
149
|
+
assert "- talk.md\n- slides/slide_001.jpg" in call["stdin"]
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@pytest.mark.parametrize(("env", "message"), [
|
|
153
|
+
({"STUB_RC": "3", "STUB_ERR": "not logged in"}, "exited with 3: not logged in"),
|
|
154
|
+
({"STUB_OUT": " "}, "empty answer"),
|
|
155
|
+
({"STUB_NO_FILE": "1"}, "empty answer"),
|
|
156
|
+
])
|
|
157
|
+
def test_codex_failures_raise_llm_error(tmp_path, stub_codex, monkeypatch, env, message):
|
|
158
|
+
for key, value in env.items():
|
|
159
|
+
monkeypatch.setenv(key, value)
|
|
160
|
+
with pytest.raises(LLMError, match=message):
|
|
161
|
+
CodexLLM().ask("hi")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
def test_codex_missing_cli_raises_llm_error():
|
|
165
|
+
with pytest.raises(LLMError, match="not found"):
|
|
166
|
+
CodexLLM(executable="codex-does-not-exist").ask("hi")
|
|
167
|
+
|
|
168
|
+
|
|
104
169
|
# --- Ollama ---------------------------------------------------------------------------------
|
|
105
170
|
|
|
106
171
|
class _OllamaStub:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|