Weave by Weights & Biases
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
Installation
pip install weave
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.
Metadata
Release files for andrew-test-weave 0.51.37
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| andrew_test_weave-0.51.37.tar.gz | 284.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| andrew_test_weave-0.51.37-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 655.5 kB
Release files / andrew_test_weave-0.51.37.tar.gz
| Download URL | andrew_test_weave-0.51.37.tar.gz |
|---|---|
| Size | 284.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fed715b26ec44658dc0b37263d4248ee6cedab42929a29ae1dfd71daa33eb69c
|
|
BLAKE2b-256 checksum How to use checksums |
bd9ad1215cd4c98c4841fbb22ade37eb22e9cd70d9c1b5c7b2b90bfb24ac85ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.18
|
Release files / andrew_test_weave-0.51.37-py3-none-any.whl
| Download URL | andrew_test_weave-0.51.37-py3-none-any.whl |
|---|---|
| Size | 370.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e289a02fea699a9e2e558c54695422fcb563c3a2a1aeccca989be45f13816a8
|
|
BLAKE2b-256 checksum How to use checksums |
883242e75a4f0c9077fc42ce17559ecd1347d6c3f4be34c8dbd6e417c917954a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.18
|
Security for andrew-test-weave 0.51.37
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.