Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ class LLMWhispererClientV2 {
* @param {boolean} [options.addLineNos=false] - If true, adds line numbers to the extracted text
* and saves line metadata, which can be queried later
* using the highlights API.
* @param {number} [options.wordConfidenceThreshold=0.3] - The minimum OCR confidence score a word must
* have to be included in the extracted text. Any text whose confidence
* value falls below the configured threshold is ignored and excluded
* from the final output. This parameter works only with "form",
* "high_quality" and "table" modes.

* @returns {Promise<Object>} The response from the whisper API.
Comment thread
johnyrahul marked this conversation as resolved.
* @throws {LLMWhispererClientException} If there is an error in the request.
Expand All @@ -210,6 +215,7 @@ class LLMWhispererClientV2 {
waitForCompletion = false,
waitTimeout = 180,
addLineNos = false,
wordConfidenceThreshold = 0.3,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2 · behavior] Client now forces word_confidence_threshold on every request.

With wordConfidenceThreshold = 0.3 as a client-side default, the param is sent on every whisper call (line 243) — including output_mode/mode combinations where the JSDoc says it has no effect (only form/high_quality/table). For callers who upgrade without touching their code, this silently pins the threshold to 0.3 instead of letting the server apply its own default.

  • If the server default is already 0.3, this is a no-op and fine — please confirm it matches so there's no behavior change on upgrade.
  • This follows the existing convention (all params are forwarded unconditionally), so it's consistent — flagging only the divergence risk.

[P3 · validation] No range check. Confidence is expected in [0, 1]; an out-of-range value (e.g. 30 instead of 0.3) is forwarded as-is. Other numeric params aren't validated either, so this is optional — but a confidence score is more error-prone to mistype than a filter size.

} = {}) {
this.logger.debug("whisper called");
const apiUrl = `${this.baseUrl}/whisper`;
Expand All @@ -234,6 +240,7 @@ class LLMWhispererClientV2 {
wait_for_completion: waitForCompletion,
wait_timeout: waitTimeout,
add_line_nos: addLineNos,
word_confidence_threshold: wordConfidenceThreshold,
Comment thread
jaseemjaskp marked this conversation as resolved.
};

this.logger.debug(`api_url: ${apiUrl}`);
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llmwhisperer-client",
"version": "2.5.1",
"version": "2.6.0",
"description": "LLMWhisper JS Client",
"main": "index.js",
"scripts": {
Expand Down
Loading