Track and version objects

no
Summary: Track and version any JSON-serializable object in Weave

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.

Track and version any JSON-serializable object in Weave

Objects#

An Object is versioned, serializable data. Weave automatically versions objects when they change, creating an immutable history. Objects include:

  • Datasets: Collections of examples for evaluation
  • Models: Configurations and parameters for your LLM logic
  • Prompts: Versioned prompt templates
dataset = weave.Dataset(
    name="test-cases",
    rows=[
        {"input": "What is 2+2?", "expected": "4"},
        {"input": "What is the capital of France?", "expected": "Paris"},
    ]
)
weave.publish(dataset)

Publishing an object#

Weave’s serialization layer saves and versions objects.

    import weave
    # Initialize tracking to the project 'intro-example'
    weave.init('intro-example')
    # Save a list, giving it the name 'cat-names'
    weave.publish(['felix', 'jimbo', 'billie'], 'cat-names')
    ```
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="TypeScript"></span>
Publishing in TypeScript is still early, so not all objects are fully supported yet.

```typescript
    import * as weave from 'weave'

    // Initialize tracking to the project 'intro-example'
    const client = await weave.init('intro-example')

    // Save an array, giving it the name 'cat-names'
    client.publish(['felix', 'jimbo', 'billie'], 'cat-names')
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

Saving an object with a name will create the first version of that object if it doesn't exist.

## Getting an object back

<span class="tab-group-start"></span>
  <span class="tab-start" data-tab-title="Python"></span>
`weave.publish` returns a Ref. You can call `.get()` on any Ref to get the object back.

You can construct a ref and then fetch the object back.

```python
    weave.init('intro-example')
    cat_names = weave.ref('cat-names').get()
    ```
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="TypeScript"></span>
```plaintext
    This feature is not available in TypeScript yet.
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

## Deleting an object

<span class="tab-group-start"></span>
  <span class="tab-start" data-tab-title="Python"></span>
To delete a version of an object, call `.delete()` on the object ref.

```python
    weave.init('intro-example')
    cat_names_ref = weave.ref('cat-names:v1')
    cat_names_ref.delete()
    ```

Trying to access a deleted object will result in an error. Resolving an object that has a reference to a deleted object will return a `DeletedRef` object in place of the deleted object.
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="TypeScript"></span>
```plaintext
    This feature is not available in TypeScript yet.
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

## Ref styles

A fully qualified Weave object ref URI looks like this:

weave:////object/<object_name>:<object_version>


* *entity*: wandb entity (username or team)
* *project*: wandb project
* *object\_name*: object name
* *object\_version*: either a version hash, a string like v0, v1..., or an alias like ":latest". All objects have the ":latest" alias.

Refs can be constructed with a few different styles

* `weave.ref(<name>)`: requires `weave.init(<project>)` to have been called. Refers to the ":latest" version
* `weave.ref(<name>:<version>)`: requires `weave.init(<project>)` to have been called.
* `weave.ref(<fully_qualified_ref_uri>)`: can be constructed without calling weave.init
Link last verified June 7, 2026. View original ↗
Source: Weights & Biases Docs
Link last verified: 2026-03-04