wandb / weave

Weave is a toolkit for developing AI-powered applications, built by Weights & Biases.
https://wandb.me/weave
Apache License 2.0
604 stars 43 forks source link

fix(weave): Add support for class saving in ipython #1864

Closed andrewtruong closed 2 weeks ago

andrewtruong commented 2 weeks ago

Resolves:

This PR adds support for saving classes that are created inside an interactive environment.

Previously, we would raise an error like:

TypeError: Source for <class '__main__.MyClass'> not found

This seems to be a common issue raised in ipython:

The solution suggested in the threads above will not work with classes that don't have methods. The approach here works for all classes, which is helpful because BaseModels can be used like plain structs (with no methods)

TODO: This PR needs a nb test

circle-job-mirror[bot] commented 2 weeks ago

Preview this PR with FeatureBee: https://beta.wandb.ai/?betaVersion=ef937615a33adf2ba135190d404b536de96f3dc4