ai-interview-assistant 2.3.3__tar.gz → 2.3.4__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.
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/PKG-INFO +2 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/pyproject.toml +2 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/__init__.py +1 -1
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/config.py +16 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/daemon.py +5 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/screens/dashboard.py +3 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/screens/settings.py +2 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/llm_clients.py +43 -11
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/PKG-INFO +2 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/SOURCES.txt +1 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/requires.txt +1 -1
- ai_interview_assistant-2.3.4/tests/test_config_transcriber.py +52 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/tests/test_llm_clients.py +63 -2
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/README.md +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/setup.cfg +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/__main__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/ai_client.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/__init__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/capture.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/transcriber.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/buffer.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/cli.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/__init__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/__main__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/app.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/screens/__init__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/screens/hotkeys.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/screens/scripts.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/hotkey_config.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/hotkeys.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/i18n.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/menubar.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/metrics.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/ollama_utils.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/overlay.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/screenshot.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/__init__.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/app.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/routes.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/websocket.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/state.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/utils.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/watchdog.py +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/dependency_links.txt +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/entry_points.txt +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview_assistant.egg-info/top_level.txt +0 -0
- {ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/tests/test_transcription_phase.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-interview-assistant
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Ghost background AI assistant for live code challenges
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: click>=8.0
|
|
@@ -28,7 +28,7 @@ Requires-Dist: datadog>=0.49.0
|
|
|
28
28
|
Requires-Dist: psutil>=5.9
|
|
29
29
|
Requires-Dist: httpx>=0.27.0
|
|
30
30
|
Requires-Dist: h2>=4.0
|
|
31
|
-
Requires-Dist: flet<0.84,>=0.25.0
|
|
31
|
+
Requires-Dist: flet[desktop]<0.84,>=0.25.0
|
|
32
32
|
Requires-Dist: PyPDF2>=3.0
|
|
33
33
|
Provides-Extra: dev
|
|
34
34
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ai-interview-assistant"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.4"
|
|
8
8
|
description = "Ghost background AI assistant for live code challenges"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
dependencies = [
|
|
@@ -33,7 +33,7 @@ dependencies = [
|
|
|
33
33
|
"psutil>=5.9",
|
|
34
34
|
"httpx>=0.27.0",
|
|
35
35
|
"h2>=4.0",
|
|
36
|
-
"flet>=0.25.0,<0.84",
|
|
36
|
+
"flet[desktop]>=0.25.0,<0.84",
|
|
37
37
|
"PyPDF2>=3.0",
|
|
38
38
|
]
|
|
39
39
|
|
|
@@ -286,6 +286,20 @@ def save_config(data: dict) -> None:
|
|
|
286
286
|
CONFIG_FILE.write_text(json.dumps(data, indent=2))
|
|
287
287
|
|
|
288
288
|
|
|
289
|
+
def resolve_transcriber(saved: dict) -> str:
|
|
290
|
+
"""Effective transcriber for a saved config dict.
|
|
291
|
+
|
|
292
|
+
An explicit ``preferred_transcriber`` always wins. When none is set (fresh
|
|
293
|
+
installs: the setup wizard never writes one), prefer Deepgram if a key is
|
|
294
|
+
configured, otherwise Whisper. Defaulting to Whisper unconditionally made
|
|
295
|
+
new installs ignore the Deepgram key the user just entered.
|
|
296
|
+
"""
|
|
297
|
+
pref = (saved.get("preferred_transcriber") or "").strip().lower()
|
|
298
|
+
if pref in ("deepgram", "whisper"):
|
|
299
|
+
return pref
|
|
300
|
+
return "deepgram" if (saved.get("deepgram_api_key") or "").strip() else "whisper"
|
|
301
|
+
|
|
302
|
+
|
|
289
303
|
# ---------------------------------------------------------------------------
|
|
290
304
|
# Runtime config dataclass
|
|
291
305
|
# ---------------------------------------------------------------------------
|
|
@@ -318,7 +332,7 @@ class Config:
|
|
|
318
332
|
cv_path: str = "" # optional CV/resume PDF path
|
|
319
333
|
max_history_turns: int = 10
|
|
320
334
|
preferred_provider: str = "local" # "claude", "gemini", "local" (ollama)
|
|
321
|
-
preferred_transcriber: str = "whisper" # "deepgram", "whisper"
|
|
335
|
+
preferred_transcriber: str = "whisper" # "deepgram", "whisper"; from_saved() resolves via resolve_transcriber()
|
|
322
336
|
local_model: str = "qwen2.5-coder:3b" # Ollama model for local provider
|
|
323
337
|
ollama_host: str = "http://localhost:11434" # Ollama server URL (local or remote)
|
|
324
338
|
ollama_managed: bool = False # True if we installed/manage ollama lifecycle
|
|
@@ -411,7 +425,7 @@ class Config:
|
|
|
411
425
|
context_path=context_path,
|
|
412
426
|
cv_path=merged.get("_session_cv_path", merged.get("cv_path", "")),
|
|
413
427
|
preferred_provider=merged.get("preferred_provider", "local"),
|
|
414
|
-
preferred_transcriber=merged
|
|
428
|
+
preferred_transcriber=resolve_transcriber(merged),
|
|
415
429
|
local_model=merged.get("local_model", "qwen2.5-coder:3b"),
|
|
416
430
|
ollama_host=merged.get("ollama_host", "http://localhost:11434"),
|
|
417
431
|
ollama_managed=merged.get("ollama_managed", False),
|
|
@@ -229,6 +229,11 @@ def run_daemon(config: Config) -> None:
|
|
|
229
229
|
logger.error("Audio capture failed: %s — continuing without audio", exc)
|
|
230
230
|
|
|
231
231
|
# Start transcriber (Deepgram preferred, Whisper fallback)
|
|
232
|
+
logger.info(
|
|
233
|
+
"Transcriber preference: %s (deepgram key: %s)",
|
|
234
|
+
config.preferred_transcriber,
|
|
235
|
+
"set" if config.deepgram_api_key else "missing",
|
|
236
|
+
)
|
|
232
237
|
transcriber = create_transcriber(
|
|
233
238
|
audio_capture=audio_capture,
|
|
234
239
|
transcript_buffer=state.transcript_buffer,
|
|
@@ -18,6 +18,7 @@ from ai_interview.config import (
|
|
|
18
18
|
GEMINI_MODELS,
|
|
19
19
|
DEFAULT_SCRIPTS,
|
|
20
20
|
load_saved_config,
|
|
21
|
+
resolve_transcriber,
|
|
21
22
|
save_config,
|
|
22
23
|
_build_system_prompt,
|
|
23
24
|
)
|
|
@@ -129,7 +130,7 @@ class DashboardScreen(ft.Column):
|
|
|
129
130
|
|
|
130
131
|
self._transcriber_dropdown = ft.Dropdown(
|
|
131
132
|
label=t("transcriber"),
|
|
132
|
-
value=saved_config
|
|
133
|
+
value=resolve_transcriber(saved_config),
|
|
133
134
|
options=transcriber_options,
|
|
134
135
|
border_radius=8, text_size=SZ, expand=True,
|
|
135
136
|
on_select=self._on_transcriber_change,
|
|
@@ -344,7 +345,7 @@ class DashboardScreen(ft.Column):
|
|
|
344
345
|
if fresh.get("deepgram_api_key"):
|
|
345
346
|
transcriber_options.append(ft.dropdown.Option("deepgram", "Deepgram"))
|
|
346
347
|
self._transcriber_dropdown.options = transcriber_options
|
|
347
|
-
self._transcriber_dropdown.value = fresh
|
|
348
|
+
self._transcriber_dropdown.value = resolve_transcriber(fresh)
|
|
348
349
|
self._update_trans_lang_options()
|
|
349
350
|
|
|
350
351
|
# Refresh CV checkbox
|
|
@@ -9,7 +9,7 @@ from pathlib import Path
|
|
|
9
9
|
import flet as ft
|
|
10
10
|
from ai_interview.i18n import t
|
|
11
11
|
|
|
12
|
-
from ai_interview.config import save_config
|
|
12
|
+
from ai_interview.config import resolve_transcriber, save_config
|
|
13
13
|
|
|
14
14
|
TEAL = "#4ec9b0"
|
|
15
15
|
MUTED = "#8b949e"
|
|
@@ -211,7 +211,7 @@ class SettingsScreen(ft.Column):
|
|
|
211
211
|
self._all_trans_langs = ["en", "es", "pt", "fr", "de", "it", "ja", "ko", "zh", "auto"]
|
|
212
212
|
self._transcriber_dropdown = ft.Dropdown(
|
|
213
213
|
label=t("default_transcriber"),
|
|
214
|
-
value=saved_config
|
|
214
|
+
value=resolve_transcriber(saved_config),
|
|
215
215
|
options=[
|
|
216
216
|
ft.dropdown.Option("whisper", t("whisper_free")),
|
|
217
217
|
ft.dropdown.Option("deepgram", "Deepgram"),
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/llm_clients.py
RENAMED
|
@@ -38,33 +38,65 @@ _h2_unavailable_logged = False
|
|
|
38
38
|
_h2_enabled_logged = False
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
def _sdk_http_stack():
|
|
42
|
+
"""Return ``(http_module, client_cls)`` matching the installed anthropic SDK.
|
|
43
|
+
|
|
44
|
+
anthropic 0.x is built on ``httpx``; anthropic 2.x moved to ``httpx2`` and
|
|
45
|
+
rejects an ``httpx.AsyncClient`` passed as ``http_client``. The SDK's public
|
|
46
|
+
``DefaultAsyncHttpxClient`` always subclasses the right ``AsyncClient`` (and
|
|
47
|
+
carries the SDK's own timeout/keepalive defaults), so we use it and take
|
|
48
|
+
``Limits`` from the module its base class lives in.
|
|
49
|
+
"""
|
|
50
|
+
import importlib
|
|
51
|
+
|
|
52
|
+
import anthropic
|
|
53
|
+
|
|
54
|
+
client_cls = getattr(anthropic, "DefaultAsyncHttpxClient", None)
|
|
55
|
+
if client_cls is not None:
|
|
56
|
+
for base in client_cls.__mro__:
|
|
57
|
+
root = base.__module__.split(".")[0]
|
|
58
|
+
if base.__name__ == "AsyncClient" and root in ("httpx", "httpx2"):
|
|
59
|
+
return importlib.import_module(root), client_cls
|
|
60
|
+
|
|
61
|
+
import httpx
|
|
62
|
+
|
|
63
|
+
return httpx, httpx.AsyncClient
|
|
64
|
+
|
|
65
|
+
|
|
41
66
|
def _httpx_client():
|
|
42
|
-
"""A connection-pooled async
|
|
67
|
+
"""A connection-pooled async HTTP client tuned to stay warm across the gaps
|
|
43
68
|
between queries. HTTP/2 multiplexes and keeps the connection open;
|
|
44
69
|
``keepalive_expiry`` outlives a typical idle gap.
|
|
45
70
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
71
|
+
The client class comes from ``_sdk_http_stack`` so it always matches the
|
|
72
|
+
installed anthropic SDK (httpx for 0.x, httpx2 for 2.x).
|
|
73
|
+
|
|
74
|
+
HTTP/2 needs the optional ``h2`` package. If it is not installed, the client
|
|
75
|
+
raises ``ImportError`` when ``http2=True``; we degrade to HTTP/1.1 (still
|
|
76
|
+
pooled + keep-alive) instead of breaking queries.
|
|
49
77
|
"""
|
|
50
78
|
global _h2_unavailable_logged, _h2_enabled_logged
|
|
51
|
-
|
|
79
|
+
http_mod, client_cls = _sdk_http_stack()
|
|
52
80
|
|
|
53
|
-
limits =
|
|
81
|
+
limits = http_mod.Limits(max_keepalive_connections=10, keepalive_expiry=300.0)
|
|
54
82
|
try:
|
|
55
|
-
client =
|
|
83
|
+
client = client_cls(http2=True, limits=limits)
|
|
56
84
|
if not _h2_enabled_logged:
|
|
57
85
|
_h2_enabled_logged = True
|
|
58
|
-
logger.info(
|
|
86
|
+
logger.info(
|
|
87
|
+
"LLM transport: HTTP/2 enabled with connection reuse (%s)",
|
|
88
|
+
http_mod.__name__,
|
|
89
|
+
)
|
|
59
90
|
return client
|
|
60
91
|
except ImportError:
|
|
61
92
|
if not _h2_unavailable_logged:
|
|
62
93
|
_h2_unavailable_logged = True
|
|
63
94
|
logger.info(
|
|
64
|
-
"HTTP/2 unavailable (install 'h2'
|
|
65
|
-
"using HTTP/1.1 with connection reuse"
|
|
95
|
+
"HTTP/2 unavailable (install 'h2'), "
|
|
96
|
+
"using HTTP/1.1 with connection reuse (%s)",
|
|
97
|
+
http_mod.__name__,
|
|
66
98
|
)
|
|
67
|
-
return
|
|
99
|
+
return client_cls(http2=False, limits=limits)
|
|
68
100
|
|
|
69
101
|
|
|
70
102
|
def _build_anthropic(api_key: str):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ai-interview-assistant
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.4
|
|
4
4
|
Summary: Ghost background AI assistant for live code challenges
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: click>=8.0
|
|
@@ -28,7 +28,7 @@ Requires-Dist: datadog>=0.49.0
|
|
|
28
28
|
Requires-Dist: psutil>=5.9
|
|
29
29
|
Requires-Dist: httpx>=0.27.0
|
|
30
30
|
Requires-Dist: h2>=4.0
|
|
31
|
-
Requires-Dist: flet<0.84,>=0.25.0
|
|
31
|
+
Requires-Dist: flet[desktop]<0.84,>=0.25.0
|
|
32
32
|
Requires-Dist: PyPDF2>=3.0
|
|
33
33
|
Provides-Extra: dev
|
|
34
34
|
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
@@ -40,5 +40,6 @@ src/ai_interview_assistant.egg-info/dependency_links.txt
|
|
|
40
40
|
src/ai_interview_assistant.egg-info/entry_points.txt
|
|
41
41
|
src/ai_interview_assistant.egg-info/requires.txt
|
|
42
42
|
src/ai_interview_assistant.egg-info/top_level.txt
|
|
43
|
+
tests/test_config_transcriber.py
|
|
43
44
|
tests/test_llm_clients.py
|
|
44
45
|
tests/test_transcription_phase.py
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""resolve_transcriber: fresh installs must use Deepgram when a key is set."""
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from ai_interview import config as cfg
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@pytest.mark.parametrize(
|
|
9
|
+
"saved, expected",
|
|
10
|
+
[
|
|
11
|
+
({}, "whisper"),
|
|
12
|
+
({"deepgram_api_key": ""}, "whisper"),
|
|
13
|
+
({"deepgram_api_key": " "}, "whisper"),
|
|
14
|
+
({"deepgram_api_key": "dg-key"}, "deepgram"),
|
|
15
|
+
({"deepgram_api_key": "dg-key", "preferred_transcriber": ""}, "deepgram"),
|
|
16
|
+
({"deepgram_api_key": "dg-key", "preferred_transcriber": None}, "deepgram"),
|
|
17
|
+
({"deepgram_api_key": "dg-key", "preferred_transcriber": "whisper"}, "whisper"),
|
|
18
|
+
({"deepgram_api_key": "dg-key", "preferred_transcriber": "Deepgram"}, "deepgram"),
|
|
19
|
+
({"preferred_transcriber": "deepgram"}, "deepgram"),
|
|
20
|
+
({"deepgram_api_key": "dg-key", "preferred_transcriber": "bogus"}, "deepgram"),
|
|
21
|
+
],
|
|
22
|
+
)
|
|
23
|
+
def test_resolve_transcriber(saved, expected):
|
|
24
|
+
assert cfg.resolve_transcriber(saved) == expected
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def test_from_saved_fresh_install_with_deepgram_key_uses_deepgram(monkeypatch):
|
|
28
|
+
# Mirrors what the setup wizard writes: no preferred_transcriber field.
|
|
29
|
+
fresh = {
|
|
30
|
+
"anthropic_api_key": "sk-ant-api03-x",
|
|
31
|
+
"deepgram_api_key": "dg-key",
|
|
32
|
+
"preferred_provider": "claude",
|
|
33
|
+
"interview_language": "Kotlin",
|
|
34
|
+
}
|
|
35
|
+
monkeypatch.setattr(cfg, "load_saved_config", lambda: dict(fresh))
|
|
36
|
+
|
|
37
|
+
assert cfg.Config.from_saved().preferred_transcriber == "deepgram"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_from_saved_respects_explicit_whisper(monkeypatch):
|
|
41
|
+
saved = {"deepgram_api_key": "dg-key", "preferred_transcriber": "whisper"}
|
|
42
|
+
monkeypatch.setattr(cfg, "load_saved_config", lambda: dict(saved))
|
|
43
|
+
|
|
44
|
+
assert cfg.Config.from_saved().preferred_transcriber == "whisper"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def test_from_saved_cli_deepgram_override_switches_to_deepgram(monkeypatch):
|
|
48
|
+
monkeypatch.setattr(cfg, "load_saved_config", lambda: {})
|
|
49
|
+
|
|
50
|
+
c = cfg.Config.from_saved({"deepgram_api_key": "dg-key"})
|
|
51
|
+
|
|
52
|
+
assert c.preferred_transcriber == "deepgram"
|
|
@@ -135,7 +135,7 @@ def test_httpx_client_requests_http2(monkeypatch):
|
|
|
135
135
|
def __init__(self, **kwargs):
|
|
136
136
|
calls.append(kwargs)
|
|
137
137
|
|
|
138
|
-
monkeypatch.setattr(
|
|
138
|
+
monkeypatch.setattr(llm_clients, "_sdk_http_stack", lambda: (httpx, FakeAsyncClient))
|
|
139
139
|
|
|
140
140
|
llm_clients._httpx_client()
|
|
141
141
|
|
|
@@ -154,7 +154,7 @@ def test_httpx_client_falls_back_to_http1_when_h2_missing(monkeypatch):
|
|
|
154
154
|
raise ImportError("Using http2=True, but the 'h2' package is not installed")
|
|
155
155
|
calls.append(kwargs)
|
|
156
156
|
|
|
157
|
-
monkeypatch.setattr(
|
|
157
|
+
monkeypatch.setattr(llm_clients, "_sdk_http_stack", lambda: (httpx, FakeAsyncClient))
|
|
158
158
|
|
|
159
159
|
llm_clients._httpx_client() # must not raise
|
|
160
160
|
|
|
@@ -162,6 +162,67 @@ def test_httpx_client_falls_back_to_http1_when_h2_missing(monkeypatch):
|
|
|
162
162
|
assert llm_clients._h2_unavailable_logged is True
|
|
163
163
|
|
|
164
164
|
|
|
165
|
+
# --------------------------------------------------------------------------
|
|
166
|
+
# SDK HTTP stack detection (anthropic 0.x uses httpx, 2.x uses httpx2)
|
|
167
|
+
# --------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
def test_sdk_http_stack_matches_installed_sdk():
|
|
170
|
+
"""The client class must be the one the installed anthropic SDK accepts."""
|
|
171
|
+
import anthropic
|
|
172
|
+
|
|
173
|
+
http_mod, client_cls = llm_clients._sdk_http_stack()
|
|
174
|
+
|
|
175
|
+
assert client_cls is anthropic.DefaultAsyncHttpxClient
|
|
176
|
+
assert http_mod.__name__ in ("httpx", "httpx2")
|
|
177
|
+
assert any(
|
|
178
|
+
b.__name__ == "AsyncClient" and b.__module__.split(".")[0] == http_mod.__name__
|
|
179
|
+
for b in client_cls.__mro__
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
def test_real_anthropic_client_accepts_pooled_http_client():
|
|
184
|
+
"""Regression: anthropic 2.x raised 'Invalid http_client argument' for httpx."""
|
|
185
|
+
assert llm_clients._build_anthropic("sk-ant-api03-test") is not None
|
|
186
|
+
assert llm_clients._build_anthropic("sk-ant-oat-test") is not None
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def test_sdk_http_stack_follows_sdk_base_module(monkeypatch):
|
|
190
|
+
import sys
|
|
191
|
+
import types
|
|
192
|
+
|
|
193
|
+
import anthropic
|
|
194
|
+
|
|
195
|
+
fake_mod = types.ModuleType("httpx2")
|
|
196
|
+
|
|
197
|
+
class AsyncClient: # stands in for httpx2.AsyncClient
|
|
198
|
+
pass
|
|
199
|
+
|
|
200
|
+
AsyncClient.__module__ = "httpx2._client"
|
|
201
|
+
|
|
202
|
+
class SdkClient(AsyncClient):
|
|
203
|
+
pass
|
|
204
|
+
|
|
205
|
+
monkeypatch.setattr(anthropic, "DefaultAsyncHttpxClient", SdkClient)
|
|
206
|
+
monkeypatch.setitem(sys.modules, "httpx2", fake_mod)
|
|
207
|
+
|
|
208
|
+
http_mod, client_cls = llm_clients._sdk_http_stack()
|
|
209
|
+
|
|
210
|
+
assert http_mod is fake_mod
|
|
211
|
+
assert client_cls is SdkClient
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
def test_sdk_http_stack_falls_back_to_httpx_without_default_client(monkeypatch):
|
|
215
|
+
import anthropic
|
|
216
|
+
import httpx
|
|
217
|
+
|
|
218
|
+
monkeypatch.delattr(anthropic, "DefaultAsyncHttpxClient")
|
|
219
|
+
|
|
220
|
+
http_mod, client_cls = llm_clients._sdk_http_stack()
|
|
221
|
+
|
|
222
|
+
assert http_mod is httpx
|
|
223
|
+
assert client_cls is httpx.AsyncClient
|
|
224
|
+
|
|
225
|
+
|
|
165
226
|
# --------------------------------------------------------------------------
|
|
166
227
|
# Keepalive — best-effort
|
|
167
228
|
# --------------------------------------------------------------------------
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/__init__.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/capture.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/audio/transcriber.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/__init__.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/__main__.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/flet_gui/app.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/hotkey_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/ollama_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/screenshot.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/__init__.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/app.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/routes.py
RENAMED
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/src/ai_interview/server/websocket.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{ai_interview_assistant-2.3.3 → ai_interview_assistant-2.3.4}/tests/test_transcription_phase.py
RENAMED
|
File without changes
|