mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Bug when callback_context_invocation_context is missing in GlobalInstructionPlugin
Merge #3163
END_PUBLIC
Hello,
Since global_instruction has been deprecated, I’m migrating to GlobalInstructionPlugin.
During the migration, I encountered an error and am submitting this PR to fix it.
In [df05ed6](https://github.com/google/adk-python/commit/df05ed6b3b7b218d85fddc1acd6617802cdf6f2a) ,
GlobalInstructionPlugin references invocation_context, but CallbackContext actually contains _invocation_context.
This mismatch always causes an error during execution.
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3180 from UlookEE:fix_global_instruction_plugin e289a12d69812f0abcfe77db0114fdb2045b31bc
PiperOrigin-RevId: 827682501
This commit is contained in:
committed by
Copybara-Service
parent
c33a680b54
commit
f81ebdb622
@@ -79,9 +79,8 @@ class GlobalInstructionPlugin(BasePlugin):
|
||||
return None
|
||||
|
||||
# Resolve the global instruction (handle both string and InstructionProvider)
|
||||
readonly_context = ReadonlyContext(callback_context.invocation_context)
|
||||
final_global_instruction = await self._resolve_global_instruction(
|
||||
readonly_context
|
||||
callback_context
|
||||
)
|
||||
|
||||
if not final_global_instruction:
|
||||
|
||||
Reference in New Issue
Block a user