burr icon indicating copy to clipboard operation
burr copied to clipboard

Hamilton action improvements for taking state in/out

Open elijahbenizzy opened this issue 1 year ago • 0 comments

Problems with Hamilton integration:

  • [ ] We can't modify inputs from state
  • [ ] We can't modify outputs to state

Idea:

h = Hamilton( 
    inputs={"most_recent_item": from_state("all_items", process=lambda x: x[-1]) # get the last one
    outputs={"count": update_state("count", process=lambda count: count + 1)} # increments it
)

Also:

h = Hamilton(
    inputs=...,
    outputs=...,
    extra_updates=lambda result, state: ...
)

elijahbenizzy avatar Feb 14 '24 00:02 elijahbenizzy