fix: Remove thoughts from contents in llm requests

Merge https://github.com/google/adk-python/pull/2320

Fix #843

COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/2320 from CAROLZXYZXY:cazheng/fix-843 5b4a4b256928cb766a44a3e18d4300b7ee5f779f
PiperOrigin-RevId: 790592793
This commit is contained in:
Carol Zheng
2025-08-03 22:47:48 -07:00
committed by Copybara-Service
parent 90b9193a20
commit d620bcb384
+2 -1
View File
@@ -322,7 +322,8 @@ def _convert_foreign_event(event: Event) -> Event:
content.role = 'user'
content.parts = [types.Part(text='For context:')]
for part in event.content.parts:
if part.text:
# Exclude thoughts from the context.
if part.text and not part.thought:
content.parts.append(
types.Part(text=f'[{event.author}] said: {part.text}')
)