Skip to main content

Weave by Weights & Biases

Open in Colab Stable Version Download Stats Github Checks codecov

Weave is a toolkit for developing Generative AI applications, built by Weights & Biases.


You can use Weave to:

  • Log and debug language model inputs, outputs, and traces
  • Build rigorous, apples-to-apples evaluations for language model use cases
  • Organize all the information generated across the LLM workflow, from experimentation to evaluations to production

Our goal is to bring rigor, best-practices, and composability to the inherently experimental process of developing Generative AI software, without introducing cognitive overhead.

Documentation

Our documentation site can be found here.

Prerequisites

Quick Start

  1. Install Weave:

    pip install weave
    
  2. Import and initialize:

    import weave
    weave.init("my-project-name")
    
  3. Trace your functions:

    @weave.op
    def my_function():
        # Your tracked code!
        pass
    

Usage

Tracing

You can trace any function using weave.op - from api calls to OpenAI, Anthropic, Google AI Studio etc to generation calls from Hugging Face and other open source models to any other validation functions or data transformations in your code you'd like to keep track of.

Decorate all the functions you want to trace, this will generate a trace tree of the inputs and outputs of all your functions:

import weave
weave.init("weave-example")

@weave.op
def sum_nine(value_one: int):
    return value_one + 9

@weave.op
def multiply_two(value_two: int):
    return value_two * 2

@weave.op
def main():
    output = sum_nine(3)
    final_output = multiply_two(output)
    return final_output

main()

Fuller Example

import weave
import json
from openai import OpenAI

@weave.op
def extract_fruit(sentence: str) -> dict:
    client = OpenAI()

    response = client.chat.completions.create(
    model="gpt-3.5-turbo-1106",
    messages=[
        {
            "role": "system",
            "content": "You will be provided with unstructured data, and your task is to parse it one JSON dictionary with fruit, color and flavor as keys."
        },
        {
            "role": "user",
            "content": sentence
        }
        ],
        temperature=0.7,
        response_format={ "type": "json_object" }
    )
    extracted = response.choices[0].message.content
    return json.loads(extracted)

weave.init('intro-example')

sentence = "There are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy."

extract_fruit(sentence)

Contributing

Interested in pulling back the hood or contributing? Awesome, before you dive in, here's what you need to know.

We're in the process of 🧹 cleaning up 🧹. This codebase contains a large amount code for the "Weave engine" and "Weave boards", which we've put on pause as we focus on Tracing and Evaluations.

The Weave Tracing code is mostly in: weave/trace and weave/trace_server.

The Weave Evaluations code is mostly in weave/flow.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weave-0.53.8.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weave-0.53.8-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file weave-0.53.8.tar.gz.

File metadata

  • Download URL: weave-0.53.8.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for weave-0.53.8.tar.gz
Algorithm Hash digest
SHA256 3009c94456a61be6a4fb386d5faab2c3091a8a55aef3f8abcc249f5cc5982128
MD5 9224b40af63270a6c5ae6643324d73e0
BLAKE2b-256 aa503bacea41b6e4073375983594f5c55a7a735e230023b3088e4a4d49ba01d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for weave-0.53.8.tar.gz:

Publisher: release.yaml on wandb/weave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file weave-0.53.8-py3-none-any.whl.

File metadata

  • Download URL: weave-0.53.8-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for weave-0.53.8-py3-none-any.whl
Algorithm Hash digest
SHA256 0ec73554d42d6437a1a88c4364d970ee182783269241d1f2779862bfcc571fd4
MD5 2151b8a3cd64191c5ddae2968ce0ac80
BLAKE2b-256 eea68c400e698d30b6c8936234290138239985952fc2a84bf7a9fc5411da562e

See more details on using hashes here.

Provenance

The following attestation bundles were made for weave-0.53.8-py3-none-any.whl:

Publisher: release.yaml on wandb/weave

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.53.8 This release

2 files

0.53.7

2 files

0.53.6

2 files

0.53.4

2 files

0.53.3

2 files

0.53.2

2 files

0.53.1

2 files

0.53.0

2 files

0.52.43

2 files

0.52.42

2 files

0.52.41

2 files

0.52.40

2 files

0.52.39

2 files

0.52.38

2 files

0.52.37

2 files

0.52.36

2 files

0.52.35

2 files

0.52.33

2 files

0.52.31

2 files

0.52.30

2 files

0.52.29

2 files

0.52.28

2 files

0.52.27

2 files

0.52.26

2 files

0.52.25

2 files

0.52.24

2 files

0.52.23

2 files

0.52.22

2 files

0.52.20

2 files

0.52.17

2 files

0.52.16

2 files

0.52.14

2 files

0.52.11

2 files

0.52.10

2 files

0.52.9

2 files

0.52.8

2 files

0.52.7

2 files

0.52.6

2 files

0.52.5

2 files

0.52.4

2 files

0.52.3

2 files

0.52.2

2 files

0.52.1

2 files

0.51.59

2 files

0.51.56

2 files

0.51.55

2 files

0.51.54

2 files

0.51.53

2 files

0.51.52

2 files

0.51.51

2 files

0.51.50

2 files

0.51.49

2 files

0.51.48

2 files

0.51.47

2 files

0.51.46

2 files

0.51.45

2 files

0.51.44

2 files

0.51.43

2 files

0.51.42

2 files

0.51.41

2 files

0.51.39

2 files

0.51.38

2 files

0.51.37

2 files

0.51.36

2 files

0.51.35

2 files

0.51.34

2 files

0.51.33

2 files

0.51.32

2 files

0.51.31

2 files

0.51.30

2 files

0.51.29

2 files

0.51.28

2 files

0.51.27

2 files

0.51.25

2 files

0.51.24

2 files

0.51.23

2 files

0.51.22

2 files

0.51.21

2 files

0.51.20

2 files

0.51.19

2 files

0.51.18

2 files

0.51.17

2 files

0.51.16

2 files

0.51.14

2 files

0.51.12

2 files

0.51.10

2 files

0.51.9

2 files

0.51.8

2 files

0.51.7

2 files

0.51.6

2 files

0.51.5

2 files

0.51.2

2 files

0.51.1

2 files

0.51.0

2 files

0.50.15

2 files

0.50.14

2 files

0.50.13

2 files

0.50.12

2 files

0.50.11

2 files

0.50.10

2 files

0.50.9

2 files

0.50.8

2 files

0.50.7

2 files

0.50.6

2 files

0.50.5

2 files

0.50.4

2 files

0.50.3

2 files

0.50.2

2 files

0.50.1

2 files

0.50.0

2 files

0.49.0

2 files

0.48.0

2 files

0.47.0

2 files

0.46.0

2 files

0.45.0

2 files

0.44.0

2 files

0.43.0

2 files

0.42.0

2 files

0.41.0

2 files

0.40.0

2 files

0.39.0

2 files

0.38.0

2 files

0.37.0

2 files

0.36.0

2 files

0.35.0

2 files

0.34.0

2 files

0.33.0

2 files

0.32.0

2 files

0.31.0

2 files

0.30.0

2 files

0.29.0

2 files

0.28.0

2 files

0.27.0

2 files

0.26.0

2 files

0.25.0

2 files

0.24.1

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page