feat: add whisper_detail method to LLMWhispererClientV2#32
Merged
johnyrahul merged 10 commits intomainfrom Mar 16, 2026
Merged
Conversation
Add whisper_detail() to retrieve extraction job metadata via the /whisper-detail API endpoint. Includes unit and integration tests. Also updates README with running tests instructions and removes outdated legacy client references. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Greptile SummaryThis PR adds a Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Caller
participant LLMWhispererClientV2
participant API as LLMWhisperer API
Caller->>LLMWhispererClientV2: whisper_detail(whisper_hash)
LLMWhispererClientV2->>API: GET /whisper-detail?whisper_hash=...
alt HTTP 200
API-->>LLMWhispererClientV2: JSON metadata dict
LLMWhispererClientV2-->>Caller: dict (completed_at, mode, pages, etc.)
else Empty body
API-->>LLMWhispererClientV2: non-200, empty body
LLMWhispererClientV2-->>Caller: raise LLMWhispererClientException("API error: empty response body", status_code)
else Non-JSON response
API-->>LLMWhispererClientV2: non-200, HTML/text body
LLMWhispererClientV2-->>Caller: raise LLMWhispererClientException("API error: non-JSON response - ...", status_code)
else JSON error body
API-->>LLMWhispererClientV2: non-200, JSON error dict
LLMWhispererClientV2-->>Caller: raise LLMWhispererClientException(err_dict, status_code)
end
Prompt To Fix All With AIThis is a comment left during a code review.
Path: src/unstract/llmwhisperer/client_v2.py
Line: 357-367
Comment:
**Missing error logging in error paths**
The `whisper_detail` method silently raises exceptions without logging the error conditions, while the template it was modelled after — `whisper_status` (lines 611–621) — calls `self.logger.error(...)` before each raise. This makes it harder to diagnose failures in production logs.
For example, `whisper_status` does:
```python
if not (response.text or "").strip():
self.logger.error(f"API error - empty response body, status code: {response.status_code}")
raise LLMWhispererClientException(...)
try:
err = json.loads(response.text)
except json.JSONDecodeError as e:
...
self.logger.error(f"API error - JSON decode failed: {e}; Response preview: {response_preview!r}")
raise LLMWhispererClientException(...)
```
Consider adding equivalent `self.logger.error(...)` calls in `whisper_detail` for the empty-body and JSON-decode-failure branches.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: tests/integration/client_v2_test.py
Line: 279
Comment:
**Unverified HTTP status code assumption**
The integration test asserts `status_code == 400` for a nonexistent `whisper_hash`, but the integration tests are explicitly marked as **not run** in the PR description (`[ ] Integration tests`). Looking at the existing `test_webhook` integration test (line 235), the API returns `404` for a not-found webhook, which is more conventional HTTP semantics.
If the real `/whisper-detail` endpoint returns `404` (or any other non-200/non-400 code) for an unknown hash, this assertion will fail at runtime. Worth verifying against the live API before merging.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 6ccfd6d |
Handle empty body and non-JSON error responses consistently with whisper_status, raising LLMWhispererClientException instead of letting json.JSONDecodeError propagate. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Signed-off-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com>
Merged
2 tasks
…sponses Align error handling with whisper_status pattern: handle empty body, non-JSON responses, and pass status_code as separate exception argument. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…d less brittle Check for status code and message key presence instead of exact error string, which may change on the API side. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
muhammad-ali-e
approved these changes
Mar 16, 2026
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jaseemjaskp
approved these changes
Mar 16, 2026
Move whisper_detail tests after usage-sensitive url_in_post tests to prevent extra extractions from inflating usage counters. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
whisper_detail(whisper_hash)method toLLMWhispererClientV2for retrieving extraction job metadata via the/whisper-detailAPI endpointTest plan
uv run --group test pytest tests/unit/client_v2_test.py -v -k "whisper_detail"uv run --group test pytest tests/integration/client_v2_test.py -v -k "whisper_detail"🤖 Generated with Claude Code