fix: Use new id for every event.

Fixes #297

PiperOrigin-RevId: 755901205
This commit is contained in:
Shangjie Chen 2025-05-07 10:06:32 -07:00 committed by Copybara-Service
parent a4adb739c0
commit 26f55fb5ab

View File

@ -261,7 +261,6 @@ class BaseLlmFlow(ABC):
# Calls the LLM. # Calls the LLM.
model_response_event = Event( model_response_event = Event(
id=Event.new_id(),
invocation_id=invocation_context.invocation_id, invocation_id=invocation_context.invocation_id,
author=invocation_context.agent.name, author=invocation_context.agent.name,
branch=invocation_context.branch, branch=invocation_context.branch,
@ -273,6 +272,8 @@ class BaseLlmFlow(ABC):
async for event in self._postprocess_async( async for event in self._postprocess_async(
invocation_context, llm_request, llm_response, model_response_event invocation_context, llm_request, llm_response, model_response_event
): ):
# Use a new id for every event.
event.id = Event.new_id()
yield event yield event
async def _preprocess_async( async def _preprocess_async(