Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 265686b

Browse files
AlankritVerma01copybara-github
authored andcommitted
chore: Raises error if the last event is partial, which is an unexpected state and can happen when the model output limit is maxed out.
Copybara import of the project: -- a6e3a22 by Alankrit Verma <alankrit386@gmail.com>: test(base_llm_flow): add test for infinite loop on truncated responses -- b5f2245 by Alankrit Verma <alankrit386@gmail.com>: feat(base_llm_flow): break run_async loop on partial/truncated events -- cbbae4c by Wei Sun (Jack) <Jacksunwei@gmail.com>: Raise ValueError if the last event is partial. This is invalid state for llm flow. -- 6eebae0 by Wei Sun (Jack) <Jacksunwei@gmail.com>: Delete tests/unittests/flows/llm_flows/test_base_llm_flow_truncation.py -- e08b0ab by Wei Sun (Jack) <Jacksunwei@gmail.com>: format base_llm_flow.py COPYBARA_INTEGRATE_REVIEW=google#659 from AlankritVerma01:fix/522-base-llm-flow-truncation e08b0ab PiperOrigin-RevId: 764380150
1 parent 187712f commit 265686b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/google/adk/flows/llm_flows/base_llm_flow.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,12 @@ async def run_async(
281281
yield event
282282
if not last_event or last_event.is_final_response():
283283
break
284+
if last_event.partial:
285+
# TODO: handle this in BaseLlm level.
286+
raise ValueError(
287+
f"Last event shouldn't be partial. LLM max output limit may be"
288+
f' reached.'
289+
)
284290

285291
async def _run_one_step_async(
286292
self,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /