mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-07-14 09:51:25 -06:00
fix: Generate event id at beginning, and regen for every new yield event. This is because trace module requires an event id.
PiperOrigin-RevId: 756905471
This commit is contained in:
parent
415104743d
commit
c4ecef54bc
@ -267,6 +267,7 @@ class BaseLlmFlow(ABC):
|
||||
|
||||
# Calls the LLM.
|
||||
model_response_event = Event(
|
||||
id=Event.new_id(),
|
||||
invocation_id=invocation_context.invocation_id,
|
||||
author=invocation_context.agent.name,
|
||||
branch=invocation_context.branch,
|
||||
@ -278,8 +279,8 @@ class BaseLlmFlow(ABC):
|
||||
async for event in self._postprocess_async(
|
||||
invocation_context, llm_request, llm_response, model_response_event
|
||||
):
|
||||
# Use a new id for every event.
|
||||
event.id = Event.new_id()
|
||||
# Update the mutable event id to avoid conflict
|
||||
model_response_event.id = Event.new_id()
|
||||
yield event
|
||||
|
||||
async def _preprocess_async(
|
||||
|
Loading…
Reference in New Issue
Block a user