langsmith 0.4.6 → 0.4.7
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/experimental/vercel/utils.d.ts +2 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/async_caller.cjs +23 -14
- package/dist/utils/async_caller.js +23 -14
- package/package.json +1 -1
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { LanguageModelV2DataContent
|
|
2
|
-
import type { ModelMessage } from "ai";
|
|
1
|
+
import type { LanguageModelV2DataContent } from "@ai-sdk/provider";
|
|
3
2
|
export declare const normalizeFileDataAsDataURL: (fileData: LanguageModelV2DataContent | ArrayBuffer, mimeType?: string) => string;
|
|
4
|
-
export declare const convertMessageToTracedFormat: (message:
|
|
3
|
+
export declare const convertMessageToTracedFormat: (message: Record<string, unknown>, responseMetadata?: Record<string, unknown>) => Record<string, unknown>;
|
package/dist/index.cjs
CHANGED
|
@@ -15,4 +15,4 @@ Object.defineProperty(exports, "uuid7FromTime", { enumerable: true, get: functio
|
|
|
15
15
|
var prompts_cache_js_1 = require("./utils/prompts_cache.cjs");
|
|
16
16
|
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return prompts_cache_js_1.Cache; } });
|
|
17
17
|
// Update using yarn bump-version
|
|
18
|
-
exports.__version__ = "0.4.
|
|
18
|
+
exports.__version__ = "0.4.7";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, type CacheConfig, type CacheMetrics, } from "./utils/prompts_cache.js";
|
|
8
|
-
export declare const __version__ = "0.4.
|
|
8
|
+
export declare const __version__ = "0.4.7";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, } from "./utils/prompts_cache.js";
|
|
7
7
|
// Update using yarn bump-version
|
|
8
|
-
export const __version__ = "0.4.
|
|
8
|
+
export const __version__ = "0.4.7";
|
|
@@ -109,29 +109,38 @@ class AsyncCaller {
|
|
|
109
109
|
throw new Error(error);
|
|
110
110
|
}
|
|
111
111
|
}), {
|
|
112
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
113
112
|
async onFailedAttempt({ error }) {
|
|
114
|
-
if
|
|
115
|
-
|
|
116
|
-
error
|
|
117
|
-
|
|
113
|
+
// Rethrow the value if it's not an object
|
|
114
|
+
if (typeof error !== "object" || error == null)
|
|
115
|
+
throw error;
|
|
116
|
+
const errorMessage = "message" in error && typeof error.message === "string"
|
|
117
|
+
? error.message
|
|
118
|
+
: undefined;
|
|
119
|
+
if (errorMessage?.startsWith("Cancel") ||
|
|
120
|
+
errorMessage?.startsWith("TimeoutError") ||
|
|
121
|
+
errorMessage?.startsWith("AbortError")) {
|
|
118
122
|
throw error;
|
|
119
123
|
}
|
|
120
|
-
if (error
|
|
124
|
+
if ("name" in error && error.name === "TimeoutError") {
|
|
121
125
|
throw error;
|
|
122
126
|
}
|
|
123
|
-
|
|
127
|
+
if ("code" in error && error.code === "ECONNABORTED") {
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
const response = "response" in error
|
|
131
|
+
? error.response
|
|
132
|
+
: undefined;
|
|
124
133
|
if (onFailedResponseHook) {
|
|
125
134
|
const handled = await onFailedResponseHook(response);
|
|
126
|
-
if (handled)
|
|
135
|
+
if (handled)
|
|
127
136
|
return;
|
|
128
|
-
}
|
|
129
137
|
}
|
|
130
|
-
const status = response?.status ??
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
const status = response?.status ??
|
|
139
|
+
("status" in error ? error.status : undefined);
|
|
140
|
+
if (status != null &&
|
|
141
|
+
(typeof status === "number" || typeof status === "string") &&
|
|
142
|
+
!STATUS_RETRYABLE.includes(+status)) {
|
|
143
|
+
throw error;
|
|
135
144
|
}
|
|
136
145
|
},
|
|
137
146
|
retries: this.maxRetries,
|
|
@@ -103,29 +103,38 @@ export class AsyncCaller {
|
|
|
103
103
|
throw new Error(error);
|
|
104
104
|
}
|
|
105
105
|
}), {
|
|
106
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
107
106
|
async onFailedAttempt({ error }) {
|
|
108
|
-
if
|
|
109
|
-
|
|
110
|
-
error
|
|
111
|
-
|
|
107
|
+
// Rethrow the value if it's not an object
|
|
108
|
+
if (typeof error !== "object" || error == null)
|
|
109
|
+
throw error;
|
|
110
|
+
const errorMessage = "message" in error && typeof error.message === "string"
|
|
111
|
+
? error.message
|
|
112
|
+
: undefined;
|
|
113
|
+
if (errorMessage?.startsWith("Cancel") ||
|
|
114
|
+
errorMessage?.startsWith("TimeoutError") ||
|
|
115
|
+
errorMessage?.startsWith("AbortError")) {
|
|
112
116
|
throw error;
|
|
113
117
|
}
|
|
114
|
-
if (error
|
|
118
|
+
if ("name" in error && error.name === "TimeoutError") {
|
|
115
119
|
throw error;
|
|
116
120
|
}
|
|
117
|
-
|
|
121
|
+
if ("code" in error && error.code === "ECONNABORTED") {
|
|
122
|
+
throw error;
|
|
123
|
+
}
|
|
124
|
+
const response = "response" in error
|
|
125
|
+
? error.response
|
|
126
|
+
: undefined;
|
|
118
127
|
if (onFailedResponseHook) {
|
|
119
128
|
const handled = await onFailedResponseHook(response);
|
|
120
|
-
if (handled)
|
|
129
|
+
if (handled)
|
|
121
130
|
return;
|
|
122
|
-
}
|
|
123
131
|
}
|
|
124
|
-
const status = response?.status ??
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
const status = response?.status ??
|
|
133
|
+
("status" in error ? error.status : undefined);
|
|
134
|
+
if (status != null &&
|
|
135
|
+
(typeof status === "number" || typeof status === "string") &&
|
|
136
|
+
!STATUS_RETRYABLE.includes(+status)) {
|
|
137
|
+
throw error;
|
|
129
138
|
}
|
|
130
139
|
},
|
|
131
140
|
retries: this.maxRetries,
|