neatlogs 1.1.10 → 1.1.11

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/dist/index.cjs CHANGED
@@ -6009,7 +6009,7 @@ function _resetMastraCache() {
6009
6009
  }
6010
6010
 
6011
6011
  // src/version.ts
6012
- var __version__ = "1.1.10";
6012
+ var __version__ = "1.1.11";
6013
6013
 
6014
6014
  // src/init.ts
6015
6015
  var logger13 = getLogger();
@@ -9621,6 +9621,7 @@ function patchModelInPlace(model) {
9621
9621
  if (isStream) attrs["neatlogs.llm.is_streaming"] = true;
9622
9622
  const promptInput = callOpts?.prompt ?? callOpts?.messages;
9623
9623
  if (promptInput !== void 0) attrs["input.value"] = safeStringify11(promptInput);
9624
+ setModelInputMessages(attrs, promptInput);
9624
9625
  captureInvocationParams(attrs, callOpts);
9625
9626
  const spanName = `mastra.llm.${modelId || "model"}.${fn}`;
9626
9627
  if (isStream) {
@@ -10161,6 +10162,20 @@ function captureInvocationParams(attrs, callOpts) {
10161
10162
  attrs["neatlogs.llm.invocation_parameters"] = safeStringify11(invocation);
10162
10163
  }
10163
10164
  }
10165
+ function setModelInputMessages(attrs, promptInput) {
10166
+ if (!Array.isArray(promptInput)) return;
10167
+ for (let i = 0; i < promptInput.length; i++) {
10168
+ const msg = promptInput[i];
10169
+ if (!msg || typeof msg !== "object") continue;
10170
+ attrs[`neatlogs.llm.input_messages.${i}.role`] = msg.role ?? "user";
10171
+ attrs[`neatlogs.llm.input_messages.${i}.content`] = messagePartsToText(msg.content);
10172
+ }
10173
+ }
10174
+ function messagePartsToText(content) {
10175
+ if (typeof content === "string") return content;
10176
+ if (!Array.isArray(content)) return "";
10177
+ return content.filter((p) => p?.type === "text" && typeof p.text === "string").map((p) => p.text).join("");
10178
+ }
10164
10179
  function setToolCall(span2, i, name, args, id) {
10165
10180
  span2.setAttribute(`neatlogs.llm.tool_calls.${i}.name`, name ?? "");
10166
10181
  span2.setAttribute(`neatlogs.llm.tool_calls.${i}.arguments`, safeStringify11(args ?? {}));