Repository navigation
Raise on model responses without text - #534
Merged
Merged
Conversation
aksg87
force-pushed
the
aksg87/raise-on-empty-model-responses
branch
from
September 6, 2026 05:24
9242bc8 to
404163e
Compare
aksg87
force-pushed
the
aksg87/raise-on-empty-model-responses
branch
3 times, most recently
from
September 7, 2026 04:59
6ef6caf to
412bb47
Compare
aksg87
force-pushed
the
aksg87/raise-on-empty-model-responses
branch
from
September 7, 2026 05:21
412bb47 to
1704fe4
Compare
aksg87
force-pushed
the
aksg87/raise-on-empty-model-responses
branch
from
September 7, 2026 05:32
1704fe4 to
642c50d
Compare
This was referenced Sep 7, 2026
ojassharma7
added a commit
to ojassharma7/langextract
that referenced
this pull request
Sep 11, 2026
…ogle#534 Rebasing onto main surfaced a behavioural conflict that merged cleanly as text. google#534 added an `except InferenceRuntimeError: raise` pass-through to the parallel result loop, which returns the provider's own diagnostic unwrapped. That pass-through runs before the draining logic here, so once _process_single_prompt started wrapping failures as InferenceRuntimeError, every parallel failure short-circuited and the completed chunks were discarded again, which is the exact behaviour this branch set out to fix. Failures are now collected uniformly and the pool is allowed to drain. Which error is raised then depends on whether there is anything to preserve: - Nothing completed: re-raise the provider's own InferenceRuntimeError unchanged, so a blocked prompt or an exhausted token budget still reports its own reason rather than being buried a level down, with the drained bookkeeping attached to it. - Some chunks completed: raise the aggregate error carrying partial_results and failed_indices, with the first underlying error kept as `original` and quoted in the message. Both test suites pass together: the no-text tests added by google#534 and the partial-result tests on this branch.
5 of 6 tasks
Merged
ojassharma7
added a commit
to ojassharma7/langextract
that referenced
this pull request
Sep 16, 2026
…ogle#534 Rebasing onto main surfaced a behavioural conflict that merged cleanly as text. google#534 added an `except InferenceRuntimeError: raise` pass-through to the parallel result loop, which returns the provider's own diagnostic unwrapped. That pass-through runs before the draining logic here, so once _process_single_prompt started wrapping failures as InferenceRuntimeError, every parallel failure short-circuited and the completed chunks were discarded again, which is the exact behaviour this branch set out to fix. Failures are now collected uniformly and the pool is allowed to drain. Which error is raised then depends on whether there is anything to preserve: - Nothing completed: re-raise the provider's own InferenceRuntimeError unchanged, so a blocked prompt or an exhausted token budget still reports its own reason rather than being buried a level down, with the drained bookkeeping attached to it. - Some chunks completed: raise the aggregate error carrying partial_results and failed_indices, with the first underlying error kept as `original` and quoted in the message. Both test suites pass together: the no-text tests added by google#534 and the partial-result tests on this branch.
3 tasks done
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
Fixes #491. Fixes #508.
Gemini and OpenAI realtime inference now raise
InferenceRuntimeErrorwhen blocking, refusal, or an exhausted output budget produces no text. Provider-local adapters use typed SDK responses and preserve diagnostics through retries and parallel inference.Empty-string completions that stop normally retain existing resolver handling. Batch changes are out of scope; Gemini batch is tracked by #527.
Builds on #496, #507 and #516; thanks to @malai001, @mittalpk and @uuzzrm.
Tests
tox -p auto -e py310,py311,py313,format,lint-src,lint-tests: 828 unit tests pass per Python version; formatting and lint pass.pytest tests/gemini_retry_test.py tests/provider_schema_test.py tests/test_kwargs_passthrough.py tests/inference_test.py -q: 214 tests pass with minimum SDK versions.