litellm/docs/my-website/docs/observability/wandb_integration.md
2024-06-17 17:31:58 -07:00

1.5 KiB
Raw Blame History

import Image from '@theme/IdealImage';

Weights & Biases - Logging LLM Input/Output

:::tip

This is community maintained, Please make an issue if you run into a bug https://github.com/BerriAI/litellm

:::

Weights & Biases helps AI developers build better models faster https://wandb.ai

<Image img={require('../../img/wandb.png')} />

:::info We want to learn how we can make the callbacks better! Meet the LiteLLM founders or join our discord :::

Pre-Requisites

Ensure you have run pip install wandb for this integration

pip install wandb litellm

Quick Start

Use just 2 lines of code, to instantly log your responses across all providers with Weights & Biases

litellm.success_callback = ["wandb"]
# pip install wandb 
import litellm
import os

os.environ["WANDB_API_KEY"] = ""
# LLM API Keys
os.environ['OPENAI_API_KEY']=""

# set wandb as a callback, litellm will send the data to Weights & Biases
litellm.success_callback = ["wandb"] 
 
# openai call
response = litellm.completion(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "user", "content": "Hi 👋 - i'm openai"}
  ]
)

Support & Talk to Founders