Comments (3)
Reproducible example:
from burr.core import action, State, ApplicationBuilder, default
@action(reads=["val"], writes=["list", "val"])
def append(state: State) -> tuple[dict, State]:
val = state["val"] + 1
result = {"val": val}
return result, state.append(list=result["val"]).update(val=val)
app = (
ApplicationBuilder()
.with_state(list=[], val=0)
.with_actions(append=append)
.with_entrypoint("append")
.with_transitions(
("append", "append", default),
)
.build()
)
old_state = app.state
assert old_state["list"] == []
*_, new_state = app.step()
assert new_state["list"] == [1]
*_, new_state = app.step()
assert new_state["list"] == [1, 2]
from burr.
Problem is in FunctionBasedAction
-- run
takes in just the read
state, but it does both a run
and a update
. So when we pass in the write
state (which has the full list), it gets clobbered. Meanwhile, the default append
is to create an empty list, so it keeps resetting it.
Trick here is to pass in the reads
and writes
from state to the run
item in the action... This comes from the ugliness of doing both at the same time, but I think we can specify a combination
one that does both? E.G. this does both so it wants reads
and writes
? And then the framework passes it in?
Ideas:
- Make it ask for both
self._reads
andself._writes
inreads
-- this is ugly because there wouldn't be defaults, and it'll have more than it needs... - Make it specify that its a single-step process -- handle that differently.
- Move the logic for subsetting state into
Action
so this can handle it differently
My instinct says (2) as the logic feels like it should be outside (an action should say what it wants and not grab it). Will see how complicated it is.
from burr.
This is fixed -- see discussion/commits in 770c27f for design.
from burr.
Related Issues (20)
- Expand/contract all in UI state/result view HOT 1
- UI Perf improvement: don't try to render list[float] as individual fields HOT 1
- Allow Optional Inputs HOT 2
- Streaming errors in sequence ID HOT 1
- Improve persistence + debugging workflow HOT 5
- Wire through "parent app ID" when forking an application's state HOT 1
- Style visualization better
- Auto-viz application in jupyter notebook
- Pre/Post application interface calls
- OpenTelemetry (or opentracing) integration
- Add ability to inject global inputs `__foo` variables
- Langfuse integration
- Langsmith integration
- MongoDB integration HOT 2
- Dark mode in the UI HOT 2
- Delete `App Runs` button in the project section
- Improve views of missing partition key
- Add `delta` view for state
- Burr -- Google Sheets Persister
- Disable sequence ID filter default in app list
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from burr.