@mtharrison/loupe 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,7 +50,7 @@ Enable tracing explicitly:
|
|
|
50
50
|
export LLM_TRACE_ENABLED=1
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Or just run your app with `NODE_ENV=development`. Loupe
|
|
53
|
+
Or just run your app with `NODE_ENV=development`. Loupe enables tracing implicitly in development and eagerly starts the dashboard when the tracer is first created, opening it automatically in an interactive local terminal.
|
|
54
54
|
|
|
55
55
|
If your app already uses a higher-level model interface or the official OpenAI client, Loupe can wrap that directly instead of requiring manual `record*` calls.
|
|
56
56
|
|
|
@@ -89,7 +89,7 @@ for await (const chunk of stream) {
|
|
|
89
89
|
}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
In `NODE_ENV=development`, you do not need to call `startServer()` explicitly. Creating the tracer is enough to start the dashboard.
|
|
93
93
|
|
|
94
94
|
When the server starts, Loupe prints the local URL:
|
|
95
95
|
|
package/dist/index.js
CHANGED
|
@@ -65,6 +65,9 @@ function getLocalLLMTracer(config = {}) {
|
|
|
65
65
|
else if (config && Object.keys(config).length > 0) {
|
|
66
66
|
singleton.configure(config);
|
|
67
67
|
}
|
|
68
|
+
if (shouldEagerStartDashboard()) {
|
|
69
|
+
void singleton.startServer();
|
|
70
|
+
}
|
|
68
71
|
return singleton;
|
|
69
72
|
}
|
|
70
73
|
function startTraceServer(config = {}) {
|
|
@@ -343,6 +346,9 @@ function shouldAutoOpenDashboard() {
|
|
|
343
346
|
&& !process.env.CI
|
|
344
347
|
&& !!process.stdout.isTTY);
|
|
345
348
|
}
|
|
349
|
+
function shouldEagerStartDashboard() {
|
|
350
|
+
return process.env.NODE_ENV === 'development';
|
|
351
|
+
}
|
|
346
352
|
function openBrowser(url) {
|
|
347
353
|
const command = process.platform === 'darwin'
|
|
348
354
|
? ['open', [url]]
|