langsmith 0.3.58 → 0.3.59

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.
@@ -142,6 +142,17 @@ function LangSmithMiddleware(config) {
142
142
  const chunks = [];
143
143
  const transformStream = new TransformStream({
144
144
  async transform(chunk, controller) {
145
+ if (chunk.type === "tool-input-start" ||
146
+ chunk.type === "text-start") {
147
+ // Only necessary to log the first token event
148
+ if (runTree?.events == null ||
149
+ (Array.isArray(runTree.events) && runTree.events.length === 0)) {
150
+ runTree?.addEvent({ name: "new_token" });
151
+ }
152
+ }
153
+ else if (chunk.type === "finish") {
154
+ runTree?.addEvent({ name: "end" });
155
+ }
145
156
  chunks.push(chunk);
146
157
  controller.enqueue(chunk);
147
158
  },
@@ -137,6 +137,17 @@ export function LangSmithMiddleware(config) {
137
137
  const chunks = [];
138
138
  const transformStream = new TransformStream({
139
139
  async transform(chunk, controller) {
140
+ if (chunk.type === "tool-input-start" ||
141
+ chunk.type === "text-start") {
142
+ // Only necessary to log the first token event
143
+ if (runTree?.events == null ||
144
+ (Array.isArray(runTree.events) && runTree.events.length === 0)) {
145
+ runTree?.addEvent({ name: "new_token" });
146
+ }
147
+ }
148
+ else if (chunk.type === "finish") {
149
+ runTree?.addEvent({ name: "end" });
150
+ }
140
151
  chunks.push(chunk);
141
152
  controller.enqueue(chunk);
142
153
  },
package/dist/index.cjs CHANGED
@@ -10,4 +10,4 @@ Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true
10
10
  var project_js_1 = require("./utils/project.cjs");
11
11
  Object.defineProperty(exports, "getDefaultProjectName", { enumerable: true, get: function () { return project_js_1.getDefaultProjectName; } });
12
12
  // Update using yarn bump-version
13
- exports.__version__ = "0.3.58";
13
+ exports.__version__ = "0.3.59";
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, }
3
3
  export { RunTree, type RunTreeConfig } from "./run_trees.js";
4
4
  export { overrideFetchImplementation } from "./singletons/fetch.js";
5
5
  export { getDefaultProjectName } from "./utils/project.js";
6
- export declare const __version__ = "0.3.58";
6
+ export declare const __version__ = "0.3.59";
package/dist/index.js CHANGED
@@ -3,4 +3,4 @@ export { RunTree } from "./run_trees.js";
3
3
  export { overrideFetchImplementation } from "./singletons/fetch.js";
4
4
  export { getDefaultProjectName } from "./utils/project.js";
5
5
  // Update using yarn bump-version
6
- export const __version__ = "0.3.58";
6
+ export const __version__ = "0.3.59";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.3.58",
3
+ "version": "0.3.59",
4
4
  "description": "Client library to connect to the LangSmith LLM Tracing and Evaluation Platform.",
5
5
  "packageManager": "yarn@1.22.19",
6
6
  "files": [