docs: clarify batch parallelism and transcribe_batch callbacks#4
Merged
docs: clarify batch parallelism and transcribe_batch callbacks#4
Conversation
Fire callbacks for the failing item when return_exceptions=False in bounded generation, unbounded TaskGroup-wrapped coroutines, and transcription batch handling.
Add bounded, unbounded generate_batch, and transcribe_batch cases where return_exceptions=False and the failing item must still receive on_result before propagation.
Document max_parallel_requests for generate/transcribe vs embed micro-batching; widen on_result types; add JSONL streaming example for transcribe_batch.
There was a problem hiding this comment.
Pull request overview
This PR clarifies batch parallelism behavior and callback contracts in the docs, and adjusts batch execution so on_result fires for failing items even in strict (return_exceptions=False) mode.
Changes:
- Document how
max_parallel_requestsaffectsgenerate_batch/transcribe_batchvsembed_batchmicro-batching. - Ensure
on_resultis invoked for the failing item in strict mode for generation (bounded + TaskGroup paths) and transcription. - Add/extend tests covering strict-mode
on_resultbehavior; add a JSONL streaming example fortranscribe_batch.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_client_batch.py | Adds async tests ensuring on_result fires for failing items in strict mode (generation bounded/unbounded, transcription). |
| src/infermesh/_transcription.py | Refactors transcription batch task settlement to ensure strict-mode failures still trigger on_result before aborting. |
| src/infermesh/_generation.py | Ensures strict-mode failures trigger on_result (bounded + TaskGroup paths) and updates progress accounting accordingly. |
| docs/guide.md | Clarifies parallelism/micro-batching, widens documented on_result result types, and adds a JSONL streaming example for transcribe_batch. |
| README.md | Mirrors the parallelism/micro-batching clarification from the guide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
max_parallel_requestsfor generate/transcribe vs embed micro-batchingon_resulttypes