mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-13 15:14:50 -06:00
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: -- a6e3a220a507a27523e427e88a803f4fec40db9c by Alankrit Verma <alankrit386@gmail.com>: test(base_llm_flow): add test for infinite loop on truncated responses -- b5f2245788b8ed51189d1ad057372989452f070d by Alankrit Verma <alankrit386@gmail.com>: feat(base_llm_flow): break run_async loop on partial/truncated events -- cbbae4c468a4de3b5a737aef07cb4615f8418c38 by Wei Sun (Jack) <Jacksunwei@gmail.com>: Raise ValueError if the last event is partial. This is invalid state for llm flow. -- 6eebae0bc27c664eee4743ff7278ae5803415c9f by Wei Sun (Jack) <Jacksunwei@gmail.com>: Delete tests/unittests/flows/llm_flows/test_base_llm_flow_truncation.py -- e08b0ab19ca6eb88eb84f044bf72e815b2cf317c by Wei Sun (Jack) <Jacksunwei@gmail.com>: format base_llm_flow.py COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/659 from AlankritVerma01:fix/522-base-llm-flow-truncation e08b0ab19ca6eb88eb84f044bf72e815b2cf317c PiperOrigin-RevId: 764380150
This commit is contained in:
parent
d83ee1a6f2
commit
2a07eefc27
@ -281,6 +281,12 @@ class BaseLlmFlow(ABC):
|
||||
yield event
|
||||
if not last_event or last_event.is_final_response():
|
||||
break
|
||||
if last_event.partial:
|
||||
# TODO: handle this in BaseLlm level.
|
||||
raise ValueError(
|
||||
f"Last event shouldn't be partial. LLM max output limit may be"
|
||||
f' reached.'
|
||||
)
|
||||
|
||||
async def _run_one_step_async(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user