Setting up Traceloop SDK for Middleware (Ruby)

This guide will walk you through the process of setting up the Traceloop SDK to work with Middleware for LLM Observability in a Ruby environment.

1. Install the SDK

Run one of the following commands in your terminal:

2. Initialize the SDK

In your LLM application, initialize the Traceloop tracer:

If you're using Rails, this initialization should be in config/initializers/traceloop.rb.

3. Log Your Prompts

Currently, automatic instrumentation is not available for Ruby libraries. You'll need to manually log your prompts and completions.

Here's an example of how to log prompts and completions when using the OpenAI library:

Viewing Your Traces

After setting up the Traceloop SDK with Middleware, you'll be able to view your LLM application traces in your Middleware LLM Observability Section.

This integration provides instant visibility into everything happening within your LLM, including calls to vector databases or other external services.

For more detailed information on setting up Traceloop with Ruby, please refer to the Traceloop Ruby documentation

Need assistance or want to learn more about using Traceloop with Middleware? Contact our support team in Slack.