fix: Populate context_view in COMPONENT_PRE_EXECUTE payload#941
fix: Populate context_view in COMPONENT_PRE_EXECUTE payload#941araujof wants to merge 1 commit intogenerative-computing:mainfrom
context_view in COMPONENT_PRE_EXECUTE payload#941Conversation
Signed-off-by: Frederico Araujo <frederico.araujo@ibm.com>
|
The PR description has been updated. Please fill out the template for your PR to be reviewed. |
|
I also had a fix for this in #921 - we can merge either PR, doesn't matter to me. |
Thanks @psschwei . I wasn't sure what method to use, and decided to go with backend = _MockBackend()
ctx = SimpleContext.from_previous(SimpleContext(), CBlock("prior turn"))
action = Instruction("Context view test")
await aact(action, ctx, backend, strategy=None)If the correct behavior is to return an empty view in this case, we could change it to use @jakelorocco any thoughts? Happy to merge #921 into this PR if I could be wrong, but if we are using |
|
My thought with using view_for_generation was just to mirror what the model sees, but I don't have super strong opinions here and will defer to you and @jakelorocco |
planetf1
left a comment
There was a problem hiding this comment.
no notable issues noted - defer to jake on approval
There was a problem hiding this comment.
I think I would prefer context.view_for_generation. My reasoning is that that view is what the generation will see (same as Paul's logic).
If we need additional information to do something in the hook, I think we should modify the hook to pass along the full context and let the user call the necessary functions.
Misc PR
Type of PR
Description
COMPONENT_PRE_EXECUTEpayload has emptycontext_view#940Summary
COMPONENT_PRE_EXECUTEdeliveringNoneforpayload.context_viewby passingcontext.as_list()when constructing the payload inaact()Changes
mellea/stdlib/functional.pycontext_view=context.as_list()to theComponentPreExecutePayloadconstructor inaact()test/plugins/test_hook_call_sites.pytest_component_pre_execute_payload_has_context_view— non-empty context produces a populated listtest_component_pre_execute_empty_context_gives_empty_list— fresh context gives[], notNoneTesting
Test plan
uv run pytest test/plugins/test_hook_call_sites.py -v -k component_pre_execute— all tests passuv run pytest test/plugins/test_all_payloads.py -v— no regressionuv run ruff check/ruff format— cleanAttribution
Related
Part of #920.