Weave with TypeScript Quickstart Guide
You can use W&B Weave with Typescript 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
Function tracking
To use Weave in your Typescript code, initialize a new Weave project and add theweave.op wrapper to the functions you want to track.
After adding weave.op and calling the function, visit the W&B dashboard to see it tracked within your project.
We automatically track your code - check the code tab in the UI!
OpenAI integration
Weave automatically tracks all OpenAI calls, including:- Token usage
- API costs
- Request/response pairs
- Model configurations
In addition to OpenAI, Weave supports automatic logging of other LLM providers, such as Anthropic and Mistral. For the full list, see LLM Providers in the Integrations documentation.
Nested function tracking
Weave allows you to track complex workflows by combining multiple tracked functions and LLM calls while preserving the entire execution trace. The benefits of this include:- Full visibility into your application’s logic flow
- Easy debugging of complex chains of operations
- Performance optimization opportunities
Dataset management
You can create and manage datasets with Weave using theweave.Dataset class. Similar to Weave Models, weave.Dataset helps:
- Track and version your data
- Organize test cases
- Share datasets between team members
- Power systematic evaluations
Evaluation framework
Weave supports evaluation-driven development with theEvaluation class. Evaluations help you reliably iterate on your GenAI application. The Evaluation class does the following:
- Assesses
Modelperformance on aDataset - Applies custom scoring functions
- Generates detailed performance reports
- Enables comparison between model versions
main function runs all demonstrations: