> ## 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 Call display name

> 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.

<Tabs>
  <Tab title="Python">
    1. Change the display name at the time of calling the Op.
       The following example uses the `__weave` dictionary to set the Call display name that will take precedence over the Op display name:

    ```python lines theme={null}
    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 lines theme={null}
    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 lines theme={null}
    @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 lines theme={null}
    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 lines theme={null}
    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 lines theme={null}
    my_function.name = "My Custom Op Name"
    ```

    * Set the `name` option on the Op decorator:

    ```python lines theme={null}
    @weave.op(name="My Custom Op Name")
    ```
  </Tab>

  <Tab title="TypeScript">
    To override the default name of a call, use the `callDisplayName` option when calling `weave.op()`.

    ```typescript lines {2} theme={null}
    const extractDinosOp = weave.op(extractDinos, {
    callDisplayName: (input: string) => `Your New Display Name`
    });
    ```
  </Tab>
</Tabs>

You can also [update a call's display name](/weave/guides/tracking/update-call) after execution.
