Set Call display name ↗
noSummary: Set or override the display name for a Call in W&B Weave tracing
Original Documentation
Documentation Index#
Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt Use this file to discover all available pages before exploring further.
Set or override the display name for a Call in W&B Weave tracing
Ops produce Calls. An Op is a function or method that you decorate with @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.
- 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:
result = my_function("World", __weave={"display_name": "My Custom Display Name"})
```
2. Change the display name on a per-Call basis.
The following example uses the [`Op.call`](/weave/reference/python-sdk/trace/op#function-call) method to return a `call` object, which you can then use to set the display name using [`call.set_display_name`](/weave/reference/python-sdk/trace/weave_client#method-set_display_name):
```python
result, call = my_function.call("World")
call.set_display_name("My Custom Display Name")
```
3. Change the display name for all Calls of a given Op.
The following example sets the new display name in the `@weave.op` function decorator itself to affect all Calls for the Op:
```python
@weave.op(call_display_name="My Custom Display Name")
def my_function(name: str):
return f"Hello, {name}!"
```
The `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.
```python
from datetime import datetime
@weave.op(call_display_name=lambda call: f"{call.func_name}__{datetime.now()}")
def func():
return ...
```
You can also log custom metadata using `.attributes`.
```python
def custom_attribute_name(call):
model = call.attributes["model"]
revision = call.attributes["revision"]
now = call.attributes["date"]
return f"{model}__{revision}__{now}"
@weave.op(call_display_name=custom_attribute_name)
def func():
return ...
with weave.attributes(
{
"model": "finetuned-llama-3.1-8b",
"revision": "v0.1.2",
"date": "2024-08-01",
}
):
func() # the display name will be "finetuned-llama-3.1-8b__v0.1.2__2024-08-01"
with weave.attributes(
{
"model": "finetuned-gpt-4o",
"revision": "v0.1.3",
"date": "2024-08-02",
}
):
func() # the display name will be "finetuned-gpt-4o__v0.1.3__2024-08-02"
```
4. 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 `name` property of the Op before any Calls are logged:
```python
my_function.name = "My Custom Op Name"
```
* Set the `name` option on the Op decorator:
```python
@weave.op(name="My Custom Op Name")
```
<span class="tab-end"></span>
<span class="tab-start" data-tab-title="TypeScript"></span>
To override the default name of a call, use the `callDisplayName` option when calling `weave.op()`.
```typescript
const extractDinosOp = weave.op(extractDinos, {
callDisplayName: (input: string) => `Your New Display Name`
});
```
<span class="tab-end"></span>
<span class="tab-group-end"></span>
You can also [update a call's display name](/weave/guides/tracking/update-call) after execution.Link last verified
June 7, 2026.
View original ↗
Source: Weights & Biases Docs
Link last verified: 2026-04-05