@mtharrison/loupe 1.5.0 → 1.7.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/client/app.js +34 -0
- 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/client/app.js
CHANGED
|
@@ -22851,6 +22851,7 @@ function TraceDetailPanel({
|
|
|
22851
22851
|
}
|
|
22852
22852
|
function renderTabContent(tab, detail, jsonMode, onApplyTagFilter, onApplyTraceFilter) {
|
|
22853
22853
|
const requestMessages = detail.request.input?.messages || [];
|
|
22854
|
+
const requestStructuredOutput = getRequestStructuredOutput(detail.request);
|
|
22854
22855
|
const responseMessage = getResponseMessage(detail);
|
|
22855
22856
|
const toolCalls = getToolCalls(detail);
|
|
22856
22857
|
const usage = getUsage(detail);
|
|
@@ -22883,6 +22884,13 @@ function renderTabContent(tab, detail, jsonMode, onApplyTagFilter, onApplyTraceF
|
|
|
22883
22884
|
messages: requestMessages
|
|
22884
22885
|
}
|
|
22885
22886
|
),
|
|
22887
|
+
requestStructuredOutput ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
22888
|
+
JsonCard,
|
|
22889
|
+
{
|
|
22890
|
+
title: requestStructuredOutput.title,
|
|
22891
|
+
value: requestStructuredOutput.value
|
|
22892
|
+
}
|
|
22893
|
+
) : null,
|
|
22886
22894
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(JsonCard, { title: "Request options", value: detail.request.options }),
|
|
22887
22895
|
(detail.request.input?.tools || []).length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
22888
22896
|
JsonCard,
|
|
@@ -23966,6 +23974,32 @@ function extractTraceRequestPreview(request) {
|
|
|
23966
23974
|
}
|
|
23967
23975
|
return summariseMessageValue(lastUserMessage.content);
|
|
23968
23976
|
}
|
|
23977
|
+
function getRequestStructuredOutput(request) {
|
|
23978
|
+
const input = request?.input;
|
|
23979
|
+
if (!input || typeof input !== "object") {
|
|
23980
|
+
return null;
|
|
23981
|
+
}
|
|
23982
|
+
if ("response_format" in input && input.response_format !== void 0) {
|
|
23983
|
+
return {
|
|
23984
|
+
title: "Response format",
|
|
23985
|
+
value: input.response_format
|
|
23986
|
+
};
|
|
23987
|
+
}
|
|
23988
|
+
if (input.text && typeof input.text === "object" && "format" in input.text && input.text.format !== void 0) {
|
|
23989
|
+
return {
|
|
23990
|
+
title: "Structured output",
|
|
23991
|
+
value: input.text.format
|
|
23992
|
+
};
|
|
23993
|
+
}
|
|
23994
|
+
const options = request?.options;
|
|
23995
|
+
if (options && typeof options === "object" && "responseFormat" in options && options.responseFormat !== void 0) {
|
|
23996
|
+
return {
|
|
23997
|
+
title: "Response format",
|
|
23998
|
+
value: options.responseFormat
|
|
23999
|
+
};
|
|
24000
|
+
}
|
|
24001
|
+
return null;
|
|
24002
|
+
}
|
|
23969
24003
|
function extractTraceResponsePreview(trace) {
|
|
23970
24004
|
if (trace.mode === "stream") {
|
|
23971
24005
|
const content2 = trace.stream?.reconstructed?.message?.content;
|
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]]
|