Skip to content

Instantly share code, notes, and snippets.

@elijahbenizzy
Last active June 26, 2024 20:53
Show Gist options
  • Save elijahbenizzy/c566c82cca6792ed15e4c8686c64d0c4 to your computer and use it in GitHub Desktop.
Save elijahbenizzy/c566c82cca6792ed15e4c8686c64d0c4 to your computer and use it in GitHub Desktop.
from hamilton import driver, base
from hamilton.io.materialization import to
json_saver = to.json(
id="saved_json_object", # name given to the saver
dependencies=["a", "b", "c"], # node returning the model
combine=base.DictResult() # put a, b, c together as a dict
)
dr = (
driver.Builder()
.with_modules(my_module)
.with_materializers(json_saver)
.build()
)
dr.execute(["saved_json_object"], inputs={"external_input" : 10})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment