Home

Awesome

<a href="https://www.ycombinator.com/companies/laminar-ai">Static Badge</a> <a href="https://x.com/lmnrai">X (formerly Twitter) Follow</a> <a href="https://discord.gg/nNFUUDAKub"> Static Badge </a>

Frame 28 (1)

Laminar

Laminar is an all-in-one open-source platform for engineering AI products. Trace, evaluate, label, and analyze LLM data.

Documentation

Check out full documentation here docs.lmnr.ai.

Getting started

The fastest and easiest way to get started is with our managed platform -> lmnr.ai

Self-hosting with Docker compose

For a quick start, clone the repo and start the services with docker compose:

git clone https://github.com/lmnr-ai/lmnr
cd lmnr
docker compose up -d

This will spin up a lightweight version of the stack with Postgres, app-server, and frontend. This is good for a quickstart or for lightweight usage. You can access the UI at http://localhost:3000 in your browser.

For production environment, we recommend using our managed platform or docker compose -f docker-compose-full.yml up -d.

docker-compose-full.yml is heavy but it will enable all the features.

Contributing

For running and building Laminar locally, or to learn more about docker compose files, follow the guide in Contributing.

Python quickstart

First, create a project and generate a Project API Key. Then,

pip install lmnr --upgrade
echo "LMNR_PROJECT_API_KEY=<YOUR_PROJECT_API_KEY>" >> .env

To automatically instrument LLM calls of popular frameworks and LLM provider libraries just add

from lmnr import Laminar
Laminar.initialize(project_api_key="<LMNR_PROJECT_API_KEY>")

To trace inputs / outputs of functions use @observe() decorator.

import os
from openai import OpenAI

from lmnr import observe, Laminar
Laminar.initialize(project_api_key="<LMNR_PROJECT_API_KEY>")

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

@observe()  # annotate all functions you want to trace
def poem_writer(topic):
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "user", "content": f"write a poem about {topic}"},
        ],
    )
    poem = response.choices[0].message.content
    return poem

if __name__ == "__main__":
    print(poem_writer(topic="laminar flow"))

Running the code above will result in the following trace.

<img width="996" alt="Screenshot 2024-10-29 at 7 52 40 PM" src="https://github.com/user-attachments/assets/df141a62-b241-4e43-844f-52d94fe4ad67">

Client libraries

To learn more about instrumenting your code, check out our client libraries:

<a href="https://www.npmjs.com/package/@lmnr-ai/lmnr"> NPM Version </a> <a href="https://pypi.org/project/lmnr/"> PyPI - Version </a>