Notebooks
W
Weights and Biases
OpenAI API Autologger Quickstart

OpenAI API Autologger Quickstart

openaiwandb-examplescolabs

Open In Colab

Weights & Biases

🏃‍♀️ OpenAI API Logger

Use the Weights & Biases OpenAI API logger to seamlessly log all all inputs and outputs to your OpenAI API. See the full Weights & Biases OpenAI Autologger Documentationhere for more

Logging with just 1 line of code

With just 1 line of code you can log all of the inputs and outputs from your OpenAI python libray to Weights & Biases for analysis later

1️⃣. Call autolog and login to wandb with your wandb api key

2️⃣. Run OpenAI API to generate preductions as normal

3️⃣. Visualize results by doing to the wandb run link generated in step 1️⃣

🪄 1. Install wandb and openai

[ ]

🪄 2. Import and call autolog

When you call autolog you will be prompted to login to Weights & Biases. If you haven't already, create a new API key at wandb.ai/settings and store it securely. API keys can only be viewed once when created.

You can optionally pass a dictionary with arguments for wandb.init() such as a project name, team name, entity, and more. For more information about wandb.init, see the API Reference Guide.

[ ]

Once you login, a Weights & Biases run link will be generated. This will take you to your workspace where you will be able to see all of the inputs and outputs to your OpenAI API calls.

🪄 3. Use the OpenAI API as normal

[ ]
[ ]

🪄 4. View your logged results in Weights & Biases

  • You can find your interactive dashboard by clicking the 👆 wandb links above in step (2)

🪄 5. Disable autolog

Call disable() to close all W&B processes when you are finished using the OpenAI API.

[ ]

What's next 🚀 ?

Doing more advanced LLM system chaining or using LangChain?

👉 Try W&B Prompts to understand your LLM systems