😴 Observe you LLM outputs and do evals without changing your code 😴
Ask us any questions, suggest features, or see what everyone is building on our Discord!
-
Install:
pip install subl
-
Throw
sublin front of your original commandsubl python your_script.py # Replace 'python your_script.py' with your actual entry point -
Pull up the dashboard:
subl server
☝️ logs will be written to ./.sublingual/logs under the same directory you launch subl ... in, so be sure to run subl server in the same directory or pass --project-dir flag
Sublingual helps you log and analyze all of your LLM calls, including the prompt template, call parameters, responses, tool calls, and more. The coolest thing? You don't have to change any of your code!
📍 All your data stays local
✂️ Disentangled logic: The reliability of your LLM calls are not dependent on the logging server
🔗 Easy integration: No code changes necessary
We automatically patch the OpenAI/Anthropic client to log all LLM calls and responses, then analyze the runtime code to extract the prompt template that you used as well. All of this so you don't have to change any of your code. When you don't want to log, you can just run your script as usual without subl, and the patch will not be applied or affect your code at all.
Adding subl before a command will trigger all python subprocesses spawned by this command to, on initialization, patch the LLM client classes to log calls and scan the runtime stack frames for info. By doing so, it can automatically (try to) find prompt templates and track server sessions.
✅ OpenAI Client (Async + Sync)
✅ Anthropic Client (Async + Sync)
⏳ LangChain calls to ChatOpenAI or ChatAnthropic are logged, but we're working on full LangChain support to trace the entire workflow!
⚠️ Other LLM clients will not be logged, but hot-swapped urls are supported. e.g. Gemini
client = OpenAI(
api_key="GEMINI_API_KEY",
base_url="https://generativelanguage.googleapis.com/v1beta/openai/"
)⚠️ Streaming responses are not currently supported for logging
⚖️ We currently offer LLM as judge evals using OpenAI models. We have prebuilt Correctness, System Prompt Obedeience, and User response sentiment metrics that you can use, but we also offer a way for you to define your own judging criteria inside the dashboard.
❗ You must provide your own api key if you want to use this feature, and can do so by setting the OPENAI_API_KEY environment variable, or just placing it in a .env in the same directory that you run subl server in.
If you are running a server that makes LLM calls, we support Flask, FastAPI, Django, and more. Just throw subl before it like
subl flask run ...MIT License - see the LICENSE file for details.
We collect very basic telemetry to understand how the product is being used. Currently we only collect how many people are downloading and running the package. You can opt out by setting the NO_TELEMETRY environment variable to 1.