Using Langtrace to monitor your Gemini backed LLM apps is quick and easy. Follow these steps:

Setup

  1. Install Langtrace’s SDK and initialize the SDK in your code.

Note: You’ll need API keys from Langtrace and Gemini. Sign up for Langtrace and/or Gemini if you haven’t done so already.

Python
# Install the SDK
pip install -U langtrace-python-sdk
Shell
pip install -q -U google-generativeai
  1. Setup environment variables:
Shell
export LANGTRACE_API_KEY=YOUR_LANGTRACE_API_KEY
export GEMINI_API_KEY=YOUR_GEMINI_API_KEY

Usage

Generate a simple output with your deployment’s model: