Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow just state update + Parallel tracking #225

Merged
merged 15 commits into from
Jun 5, 2024

Conversation

elijahbenizzy
Copy link
Contributor

@elijahbenizzy elijahbenizzy commented Jun 1, 2024

Multi-PR (sorry, rebasing was too much of a pain to not group this. Kids, don't do this at home.)

Changes

  • Forking/spawning with tracking
  • Simplifying documentation
  • Fixes tests so that they can always run locally
  • Adds clipboard to json view (so you can copy)
  • Allows actions to return State instead of a tuple

How I tested this

  • Manually
  • Unit tests

Notes

Some sample code:

@action(reads=[], writes=["some_data"])
def simpler_action(state: State) -> State:
    return state.upate(some_data=...)

image
image

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@elijahbenizzy elijahbenizzy changed the base branch from main to spawn-applications June 1, 2024 23:24
@elijahbenizzy elijahbenizzy changed the title Allow just state update Allow just state update (WIP) Jun 1, 2024
@elijahbenizzy
Copy link
Contributor Author

elijahbenizzy commented Jun 1, 2024

TODO in this PR:

  • Change any more documentation
    • Examples/getting started
    • Docstrings for actions
    • Misc places
  • Change README to have a very simple example (hello world with human/AI)
  • Add tests for this -- should be easy
  • Change examples in repo to have some not show intermediate state

@elijahbenizzy elijahbenizzy changed the title Allow just state update (WIP) Allow just state update Jun 3, 2024
burr/core/application.py Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
burr/core/application.py Show resolved Hide resolved
A node can now query for application context by setting an input
as __context -- this is of type ApplicationContext. This will allow
forking (+ any other information we may need from inside the node).
This is one of two __ variables (the other being tracer).

The dependency factory is a bit in flux but the way these are
constructed is not yet public-facing (we cannot arbitrarily add global
injectors), so we can change it.

This also fixes a bug in which dependency factories were not allowed to
be optional/have defaults. This enables the user to build out a
function that can be run outside the app (with a null context)..
child=PointerModel(
app_id=app_id,
sequence_id=None,
partition_key=None, # TODO -- get partition key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will this impact without it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the case that app IDs are non-unique it will be ambiguous

This can enable the following use-cases (among many others):

1. Parallel results to different LLMs for comparison
2. Multi simultaneous tasks/chains for an LLM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
2. Multi simultaneous tasks/chains for an LLM
2. Multiple simultaneous tasks/chains for an LLM

1. Parallel results to different LLMs for comparison
2. Multi simultaneous tasks/chains for an LLM
3. Black-boxing an action as a subset of tasks
4. Running multiple queries simultaneously and getting an LLM to synthesize.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this the same as (2) but more simply worded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No on is different questions and the other is the same question but muliple queries

docs/concepts/recursion.rst Outdated Show resolved Hide resolved
Field level serialization/deserialization is handled by a registration function in the state module.
Fields will be first checked to see if there is a custom serializer/deserializer registered for that field,
before delegating to the default serialization/deserialization mechanism.
Field level serialization/deserialization is for when you want to further customize your state serialization
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this in here? bad rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed

@elijahbenizzy elijahbenizzy changed the title Allow just state update Allow just state update + Application Spawning Jun 4, 2024
@elijahbenizzy elijahbenizzy changed the base branch from spawn-applications to main June 4, 2024 23:20
@elijahbenizzy elijahbenizzy mentioned this pull request Jun 4, 2024
18 tasks
@elijahbenizzy elijahbenizzy changed the title Allow just state update + Application Spawning Allow just state update + Parallel tracking Jun 4, 2024
@elijahbenizzy
Copy link
Contributor Author

This one replaced #218 -- same stuff.

elijahbenizzy added a commit to DAGWorks-Inc/Scrapegraph-ai that referenced this pull request Jun 5, 2024
This enables an application to specify the app that spawned it.

- Adds tracking of spawning parent to child app. This enables us to track from child app the parents that spawned it
- Adds pointers from parent app to child app. This does a little trickiness with the local tracker, but will allow the
UI to display bidirectional links for forks/spawns.
- Adds visualization for spawning parents to App list. This allows us to expand/focus on children in the app list. This also hides the partition key if it doesn't exist

See #211

Adds bidirectional linking to the UI for spawning/forking apps

This adds the proper UI component + fixes logging/server to log
correctly when spawning.
This is potentially backwards compatible, but people should really not
be doing this -- in standard python convention (and burr, specifically),
these are reserved for internal/special cases.
This was always confusing. We've decided to allow just a single output
to make onboarding easier. See
#53.

- Updates the actions docstring to have examples just show State return
- Updates the hello world example to not return results for simplicity
- Updates the docs to prefer the only-state return format for actions
When we built this initially, we were validating type annotation for
action functions. We now no longer do this, so this removes unecessary
code.
Not doing everything cause I'm lazy and I want there to be a variation.
This enables the user to do what scrapegraph is doing -- run Burr in
more buried places. This is not the main approach (it should be wired in
directly), but it'll work in a pinch and is very low effort.
This way we can just run tests locally
@elijahbenizzy elijahbenizzy merged commit 0a8133a into main Jun 5, 2024
12 checks passed
@elijahbenizzy elijahbenizzy deleted the allow-just-state-update branch June 5, 2024 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants