@weave.op. By default, the Op’s name is the function name, and the associated Calls have the same display name.
You can override the display name for all Calls of a given Op in several ways.
- Python
- TypeScript
- Change the display name at the time of calling the Op.
The following example uses the
__weavedictionary to set the Call display name that will take precedence over the Op display name:
- Change the display name on a per-Call basis.
The following example uses the
Op.callmethod to return acallobject, which you can then use to set the display name usingcall.set_display_name:
- Change the display name for all Calls of a given Op.
The following example sets the new display name in the
@weave.opfunction decorator itself to affect all Calls for the Op:
call_display_name can also be a function that takes in a call object and returns a string. Weave passes the call object automatically when the function runs, so you can use it to dynamically generate names based on the function’s name, Call inputs, fields, and so on.One common use case is appending a timestamp to the function’s name..attributes.- Change the display name of the Op itself. Calls associated with an Op have the same display name. If you override the name of the Op itself, the display name of the Call also changes. You can do this in two ways:
- Set the
nameproperty of the Op before any Calls are logged:
- Set the
nameoption on the Op decorator: