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.6.tar.gz (1.2 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.6-py3-none-any.whl (1.4 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: weave-0.53.6.tar.gz
  • Upload date:
  • Size: 1.2 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.6.tar.gz
Algorithm Hash digest
SHA256 f91b54a3bd5abbb455d4f047f53ba93deb9940819d7278107559ca9f71235742
MD5 1e9c653442616e6e9d863839281ab892
BLAKE2b-256 a44a5a016b2bf6bd177ffa92f24a915eaf7f642d7e5e32e17021e57f2b138ddc

See more details on using hashes here.

Provenance

The following attestation bundles were made for weave-0.53.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: weave-0.53.6-py3-none-any.whl
  • Upload date:
  • Size: 1.4 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 284de065a738f5620bf0d4f060b2bef4257f1afa8008685fd3b4f006012e9806
MD5 b05099d1125c00044f90be46f8291140
BLAKE2b-256 2a4f9aecfc3b456294ed371bc6484b404aece22d2a3f096a60c0ae956b23f5f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for weave-0.53.6-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.6 This release

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page