Skip to content

feat: add whisperDetail method and remove deprecated V1 client#19

Merged
johnyrahul merged 8 commits intomainfrom
feat/add-whisper-detail-api
Mar 16, 2026
Merged

feat: add whisperDetail method and remove deprecated V1 client#19
johnyrahul merged 8 commits intomainfrom
feat/add-whisper-detail-api

Conversation

@johnyrahul
Copy link
Copy Markdown
Contributor

@johnyrahul johnyrahul commented Mar 16, 2026

Summary

  • Add whisperDetail(whisperHash) method to LLMWhispererClientV2 for retrieving extraction job metadata via the /whisper-detail API endpoint
  • Remove deprecated LLMWhispererClient (V1) class and all its usages (including test/v1test.js and V1 tests in retry.test.js)
  • Update README with test running instructions, environment setup, and test descriptions

Equivalent of Zipstack/llm-whisperer-python-client#32 for the JS client.

Test plan

  • All existing tests pass (npm test — 21 passed, 1 skipped)
  • Integration test for whisperDetail with a valid whisper hash

🤖 Generated with Claude Code

Add whisperDetail(whisperHash) method to LLMWhispererClientV2 for
retrieving extraction job metadata via the /whisper-detail API endpoint.
Remove deprecated LLMWhispererClient (V1) and all its usages.
Update README with test running instructions and environment setup.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 16, 2026

Greptile Summary

This PR adds the whisperDetail(whisperHash) method to LLMWhispererClientV2, removes the deprecated V1 LLMWhispererClient class and all its tests, fixes a pre-existing header mutation bug in whisper(), and improves the README with environment setup and test-running documentation.

Key changes:

  • New whisperDetail method — issues a GET to /whisper-detail with whisper_hash as a query param, returns raw response.data. Includes retry test coverage (whisperDetail retries on 503 then succeeds).
  • Header mutation fixwhisper() now uses headers: { ...this.headers } (spread copy) instead of directly passing this.headers, preventing Content-Type/Content-Length from leaking into subsequent GET requests. The previously necessary delete this.headers["Content-Length"] guard in whisperStatus is correctly removed as a result.
  • V1 removalLLMWhispererClient, test/v1test.js, and all V1-specific retry tests are deleted; module.exports updated to export only LLMWhispererClientV2.
  • READMEwhisperDetail appears in the API methods list; the "Running Tests" section correctly documents LLMWHISPERER_LOGGING_LEVEL matching the constructor's process.env.LLMWHISPERER_LOGGING_LEVEL read (line 64 of index.js).
  • whisperDetail response shape — returns response.data directly with no statusCode field appended, which is consistent with getUsageInfo but differs from whisperStatus/whisperRetrieve which augment the returned object. This is not a bug but is worth being aware of for consumers.

Confidence Score: 4/5

  • Safe to merge — the changes are well-scoped, the header mutation bug is correctly fixed at the root, and the new method has retry test coverage.
  • The PR fixes a real bug (header mutation in whisper()), correctly removes the now-redundant defensive workaround in whisperStatus, adds a properly implemented whisperDetail method, and includes a retry test. Most concerns raised in prior review threads have been addressed in this revision. A minor inconsistency remains: whisperDetail returns response.data without a statusCode field, unlike several sibling methods — but this is intentional design rather than a defect, and is consistent with getUsageInfo. No critical new logic issues were found.
  • No files require special attention; index.js carries the core logic change and is the most important file to verify.

Important Files Changed

Filename Overview
index.js Adds whisperDetail() method (GET /whisper-detail), removes entire V1 LLMWhispererClient class, and fixes the long-standing header mutation bug in whisper() by switching to { ...this.headers }. The delete this.headers["Content-Length"] workaround in whisperStatus is correctly removed as a result. whisperDetail uses this.headers directly (consistent with other GET methods), which is now safe since the root mutation in whisper() is fixed.
test/retry.test.js Removes all V1 client test suites and adds a whisperDetail retries on 503 then succeeds test. The "Retry-After header" and "onRetry re-creates file stream" tests are correctly migrated from V1 to V2 client; the file-stream test response is updated from { status: 200, ... } to { status: 202, ... } to match V2 async behavior.
README.md Adds whisperDetail to the API methods list, and adds a comprehensive "Running Tests" section with environment setup, run commands, and test descriptions. The documented env var LLMWHISPERER_LOGGING_LEVEL correctly matches what the code reads at constructor line 64.
test/v1test.js File deleted entirely — correct cleanup of V1 integration tests that are no longer relevant after removing the V1 client class.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant LLMWhispererClientV2
    participant AxiosRetry
    participant LLMWhispererAPI

    Note over Caller,LLMWhispererAPI: Typical async extraction + detail flow

    Caller->>LLMWhispererClientV2: whisper({ filePath, waitForCompletion: false })
    LLMWhispererClientV2->>AxiosRetry: POST /whisper (headers: { ...this.headers })
    Note right of LLMWhispererClientV2: Spread copy — this.headers NOT mutated
    AxiosRetry->>LLMWhispererAPI: POST /whisper
    LLMWhispererAPI-->>AxiosRetry: 202 { whisper_hash }
    AxiosRetry-->>LLMWhispererClientV2: response
    LLMWhispererClientV2-->>Caller: { whisper_hash, statusCode: 202 }

    Caller->>LLMWhispererClientV2: whisperStatus(whisperHash)
    LLMWhispererClientV2->>AxiosRetry: GET /whisper-status?whisper_hash=...
    AxiosRetry->>LLMWhispererAPI: GET /whisper-status
    LLMWhispererAPI-->>AxiosRetry: 200 { status: "processed" }
    AxiosRetry-->>LLMWhispererClientV2: response
    LLMWhispererClientV2-->>Caller: { status: "processed", statusCode: 200 }

    Caller->>LLMWhispererClientV2: whisperDetail(whisperHash)
    LLMWhispererClientV2->>AxiosRetry: GET /whisper-detail?whisper_hash=...
    alt 503 / 429 / 5xx
        AxiosRetry->>LLMWhispererAPI: retry (up to maxRetries)
    end
    AxiosRetry->>LLMWhispererAPI: GET /whisper-detail
    LLMWhispererAPI-->>AxiosRetry: 200 { mode, processed_pages, whisper_hash, ... }
    AxiosRetry-->>LLMWhispererClientV2: response
    LLMWhispererClientV2-->>Caller: response.data (extraction metadata)
Loading

Last reviewed commit: bbf2080

Comment thread README.md
Comment thread index.js
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>
Comment thread README.md Outdated
johnyrahul and others added 2 commits March 16, 2026 13:50
Co-Authored-By: Claude Opus 4.6 (1M context) <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>
Comment thread index.js
johnyrahul and others added 2 commits March 16, 2026 14:06
Use a spread copy of this.headers in whisper() so file-upload headers
(Content-Type, Content-Length) don't leak into subsequent GET calls.
Remove the now-unnecessary delete workaround in whisperStatus().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread README.md Outdated
Comment thread index.js
johnyrahul and others added 2 commits March 16, 2026 14:25
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>
@johnyrahul johnyrahul merged commit 5a24f71 into main Mar 16, 2026
3 checks passed
@johnyrahul johnyrahul deleted the feat/add-whisper-detail-api branch March 16, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants