adk-python icon indicating copy to clipboard operation
adk-python copied to clipboard

audio blobs being saved into events as base64

Open ac-machache opened this issue 1 year ago • 1 comments

Hello,

I’m not sure if this is the intended behavior, but when using bidirectional streaming, the audio blobs (via inline_data in event.content.parts) are being saved into the session history — both in Vertex and DB session services.

In my use case, this isn't ideal — I believe the audio data shouldn't be persisted in the event store by default, as it increases storage and isn't typically useful post-session.

As a workaround, I added a filter in the append method of each session service to skip saving events that contain inline_data. Here's a rough version of the logic I used:

if event.content and event.content.parts:
    for part in event.content.parts:
        if part.inline_data:
            return  # Skip this event; don't save audio blobs

ac-machache avatar Jul 25 '25 08:07 ac-machache

the correct code is

if event.content and event.content.parts:
    for part in event.content.parts:
        if part.inline_data:
            return  event # Skip this event; don't save audio blobs

ac-machache avatar Jul 25 '25 08:07 ac-machache