[MISC] Surface LLMWhisperer adapter env knobs in workers sample.env#2113
[MISC] Surface LLMWhisperer adapter env knobs in workers sample.env#2113
Conversation
Text extraction now runs in-process inside the file-processing workers (via the SDK x2text adapter), not in a separate tool container. The ADAPTER_LLMW_* knobs are read with os.getenv from the worker process, so they must be present in the worker env; previously they were only set on the backend/prompt envs and silently fell back to SDK defaults. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SBT1USHvaBLqEi9Xd8NoBP
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Summary by CodeRabbit
WalkthroughAdded adapter LLM environment variable examples for wait timeout, retry behavior, polling interval, and maximum poll count. ChangesAdapter LLM Configuration
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
| Filename | Overview |
|---|---|
| workers/sample.env | Adds 6 ADAPTER_LLMW_* env knobs for the in-process LLMWhisperer adapter running inside file-processing workers; values match SDK V2 defaults. Missing ADAPTER_LLMW_STATUS_RETRIES and inline comments present in the other service sample.env files. |
Sequence Diagram
%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Ops as Operator
participant Env as workers/sample.env
participant Worker as File-Processing Worker
participant SDK as SDK x2text Adapter (llm_whisperer_v2)
participant LLMW as LLMWhisperer API
Ops->>Env: Set ADAPTER_LLMW_WAIT_TIMEOUT, MAX_RETRIES, RETRY_MIN/MAX_WAIT
Env->>Worker: Env vars injected at startup
Worker->>SDK: _handle_extract() calls adapter in-process
Note over SDK: os.getenv reads ADAPTER_LLMW_* at import time (WhispererDefaults)
SDK->>LLMW: POST /whisper (extraction request)
LLMW-->>SDK: Processing...
loop Poll until WAIT_TIMEOUT
SDK->>LLMW: GET /whisper-status
LLMW-->>SDK: "status=processing"
end
LLMW-->>SDK: "status=processed"
SDK-->>Worker: Extracted text
Worker-->>Ops: Result
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Ops as Operator
participant Env as workers/sample.env
participant Worker as File-Processing Worker
participant SDK as SDK x2text Adapter (llm_whisperer_v2)
participant LLMW as LLMWhisperer API
Ops->>Env: Set ADAPTER_LLMW_WAIT_TIMEOUT, MAX_RETRIES, RETRY_MIN/MAX_WAIT
Env->>Worker: Env vars injected at startup
Worker->>SDK: _handle_extract() calls adapter in-process
Note over SDK: os.getenv reads ADAPTER_LLMW_* at import time (WhispererDefaults)
SDK->>LLMW: POST /whisper (extraction request)
LLMW-->>SDK: Processing...
loop Poll until WAIT_TIMEOUT
SDK->>LLMW: GET /whisper-status
LLMW-->>SDK: "status=processing"
end
LLMW-->>SDK: "status=processed"
SDK-->>Worker: Extracted text
Worker-->>Ops: Result
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
workers/sample.env:304-309
The new LLMW entries have no section header or per-variable comments. Both `prompt-service/sample.env` and `backend/sample.env` wrap these knobs in a descriptive block with comments explaining units and acceptable ranges (e.g. the 500-min justification for `MAX_POLLS`). An operator tuning the worker without that context may misread the semantics of, say, `RETRY_MIN_WAIT` (seconds, not milliseconds) or `WAIT_TIMEOUT` (overall extraction wait, not per-HTTP-call). Additionally, `ADAPTER_LLMW_STATUS_RETRIES=5` (present in both other service sample files) is absent here — while the variable has no Python reader today, omitting it creates an inconsistency that could confuse operators aligning configs across services.
```suggestion
# LLMWhisperer Adapter Tuning
# Timeout for LLMW (v2) overall extraction wait in seconds
ADAPTER_LLMW_WAIT_TIMEOUT=900 # 15 mins
# Retry backoff for LLMWhisperer client (v2)
# Max retry attempts for transient HTTP errors (429, 5xx). Set 0 to disable.
ADAPTER_LLMW_MAX_RETRIES=3
# Min backoff wait in seconds between retries
ADAPTER_LLMW_RETRY_MIN_WAIT=1.0
# Max backoff wait in seconds between retries
ADAPTER_LLMW_RETRY_MAX_WAIT=60.0
# Control async extraction of LLMWhisperer (v1, deprecated)
# Time in seconds to wait before polling LLMWhisperer's status API
ADAPTER_LLMW_POLL_INTERVAL=30
# Total number of times to poll the status API
# 500 mins to allow 1500 (max pages limit) * 20 (approx time in sec to process a page)
ADAPTER_LLMW_MAX_POLLS=1000
# Number of times to retry the /whisper-status API before failing the extraction
ADAPTER_LLMW_STATUS_RETRIES=5
```
Reviews (1): Last reviewed commit: "[FIX] Surface LLMWhisperer adapter env k..." | Re-trigger Greptile
Unstract test resultsPer-group results
Critical paths
|
|
What
ADAPTER_LLMW_*control knobs toworkers/sample.envso the in-process LLMWhisperer extraction running inside the file-processing workers can actually be tuned.Why
workers/executor/executors/legacy_executor.py:_handle_extract).os.getenvin the SDK (unstract/sdk1/.../x2text/llm_whisperer_v2/src/constants.py) at import time, from the worker process env.Whisper client operation timed outand there was no surfaced way to raise the wait in the worker.How
workers/sample.env:ADAPTER_LLMW_WAIT_TIMEOUT=900(V2 — overall wait-for-completion; the timeout knob)ADAPTER_LLMW_MAX_RETRIES=3,ADAPTER_LLMW_RETRY_MIN_WAIT=1.0,ADAPTER_LLMW_RETRY_MAX_WAIT=60.0(V2 — per-HTTP-call transient retry backoff)ADAPTER_LLMW_POLL_INTERVAL=30,ADAPTER_LLMW_MAX_POLLS=1000(V1 deprecated — status polling)Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
ADAPTER_LLMW_WAIT_TIMEOUT,ADAPTER_LLMW_MAX_RETRIES,ADAPTER_LLMW_RETRY_MIN_WAIT,ADAPTER_LLMW_RETRY_MAX_WAIT,ADAPTER_LLMW_POLL_INTERVAL,ADAPTER_LLMW_MAX_POLLS.Relevant Docs
Related Issues or PRs
feat/llmw-worker-envs(wires the same knobs into the worker configMap).Dependencies Versions
Notes on Testing
ADAPTER_LLMW_WAIT_TIMEOUTto a low value on a file-processing worker and confirm a slow LLMWhisperer V2 extraction times out at that bound; raise it and confirm the extraction completes.Screenshots
Checklist
I have read and understood the Contribution Guidelines.
🤖 Generated with Claude Code