wandb / weave

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

feat: add finish handler for ops #2633

Closed jamie-rasmussen closed 3 weeks ago

jamie-rasmussen commented 3 weeks ago

Description

Adds the ability to set a "finish" handler on an Op. The intended use is as an extension point for integrations. For example, I intend to use this functionality in the Gemini integration to copy information about token usage from the Gemini call response object (whose structure only the Gemini integration should have to know anything about) into our standard token usage format in the call's summary dictionary.

Testing

How was this PR tested?

andrewtruong commented 3 weeks ago

This is a step towards lifecycle callbacks for the op!