langsmith 0.7.7 → 0.7.8
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/evaluation/_runner.cjs +31 -3
- package/dist/evaluation/_runner.d.ts +2 -0
- package/dist/evaluation/_runner.js +30 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox/errors.cjs +2 -1
- package/dist/sandbox/errors.d.ts +2 -1
- package/dist/sandbox/errors.js +2 -1
- package/package.json +1 -1
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports._ExperimentManager = void 0;
|
|
4
4
|
exports.evaluate = evaluate;
|
|
5
5
|
exports._reorderResultRowsByExampleIndex = _reorderResultRowsByExampleIndex;
|
|
6
|
+
exports._extractEvaluatorFeedbackKeys = _extractEvaluatorFeedbackKeys;
|
|
7
|
+
exports._collectEvaluatorKeys = _collectEvaluatorKeys;
|
|
6
8
|
exports._mapWithConcurrency = _mapWithConcurrency;
|
|
7
9
|
const index_js_1 = require("../index.cjs");
|
|
8
10
|
const traceable_js_1 = require("../traceable.cjs");
|
|
@@ -888,14 +890,40 @@ Try setting "LANGSMITH_TRACING=true" in your environment.`);
|
|
|
888
890
|
example,
|
|
889
891
|
};
|
|
890
892
|
}
|
|
893
|
+
// best effort feedback key extraction using regex parsing.
|
|
894
|
+
// may be fragile but seems okay as a best effort option and doesn't break anything significant.
|
|
895
|
+
// TODO: find a better way to resolve this.
|
|
896
|
+
function _extractEvaluatorFeedbackKeys(evaluator) {
|
|
897
|
+
const name = evaluator.name;
|
|
898
|
+
const fallback = name && name.length > 0 ? [name] : [];
|
|
899
|
+
try {
|
|
900
|
+
const source = typeof evaluator === "function" ? evaluator.toString() : "";
|
|
901
|
+
if (!source)
|
|
902
|
+
return fallback;
|
|
903
|
+
// Match `key: "literal"`, `"key": "literal"`, or backtick literals without
|
|
904
|
+
// interpolation. Word boundaries avoid matching `keys`, and the required
|
|
905
|
+
// colon + quoted value avoids matching destructuring/`for (const key of)`.
|
|
906
|
+
const regex = /["']?\bkey\b["']?\s*:\s*(?:"([^"]+)"|'([^']+)'|`([^`$]+)`)/g;
|
|
907
|
+
const keys = [];
|
|
908
|
+
let match;
|
|
909
|
+
while ((match = regex.exec(source)) !== null) {
|
|
910
|
+
const value = match[1] ?? match[2] ?? match[3];
|
|
911
|
+
if (value)
|
|
912
|
+
keys.push(value);
|
|
913
|
+
}
|
|
914
|
+
const unique = [...new Set(keys)];
|
|
915
|
+
return unique.length > 0 ? unique : fallback;
|
|
916
|
+
}
|
|
917
|
+
catch {
|
|
918
|
+
return fallback;
|
|
919
|
+
}
|
|
920
|
+
}
|
|
891
921
|
function _collectEvaluatorKeys(evaluators) {
|
|
892
922
|
if (!evaluators)
|
|
893
923
|
return [];
|
|
894
924
|
const keys = [];
|
|
895
925
|
for (const ev of evaluators) {
|
|
896
|
-
|
|
897
|
-
if (name && name.length > 0)
|
|
898
|
-
keys.push(name);
|
|
926
|
+
keys.push(..._extractEvaluatorFeedbackKeys(ev));
|
|
899
927
|
}
|
|
900
928
|
return keys;
|
|
901
929
|
}
|
|
@@ -265,6 +265,8 @@ declare class ExperimentResults implements AsyncIterableIterator<ExperimentResul
|
|
|
265
265
|
processData(manager: _ExperimentManager): Promise<void>;
|
|
266
266
|
get length(): number;
|
|
267
267
|
}
|
|
268
|
+
export declare function _extractEvaluatorFeedbackKeys(evaluator: EvaluatorT | RunEvaluator): string[];
|
|
269
|
+
export declare function _collectEvaluatorKeys(evaluators: Array<EvaluatorT | RunEvaluator> | undefined): string[];
|
|
268
270
|
/**
|
|
269
271
|
* Map over an iterable with bounded concurrency using p-queue.
|
|
270
272
|
* Results are yielded as soon as they resolve (input order is not preserved).
|
|
@@ -881,14 +881,40 @@ Try setting "LANGSMITH_TRACING=true" in your environment.`);
|
|
|
881
881
|
example,
|
|
882
882
|
};
|
|
883
883
|
}
|
|
884
|
-
|
|
884
|
+
// best effort feedback key extraction using regex parsing.
|
|
885
|
+
// may be fragile but seems okay as a best effort option and doesn't break anything significant.
|
|
886
|
+
// TODO: find a better way to resolve this.
|
|
887
|
+
export function _extractEvaluatorFeedbackKeys(evaluator) {
|
|
888
|
+
const name = evaluator.name;
|
|
889
|
+
const fallback = name && name.length > 0 ? [name] : [];
|
|
890
|
+
try {
|
|
891
|
+
const source = typeof evaluator === "function" ? evaluator.toString() : "";
|
|
892
|
+
if (!source)
|
|
893
|
+
return fallback;
|
|
894
|
+
// Match `key: "literal"`, `"key": "literal"`, or backtick literals without
|
|
895
|
+
// interpolation. Word boundaries avoid matching `keys`, and the required
|
|
896
|
+
// colon + quoted value avoids matching destructuring/`for (const key of)`.
|
|
897
|
+
const regex = /["']?\bkey\b["']?\s*:\s*(?:"([^"]+)"|'([^']+)'|`([^`$]+)`)/g;
|
|
898
|
+
const keys = [];
|
|
899
|
+
let match;
|
|
900
|
+
while ((match = regex.exec(source)) !== null) {
|
|
901
|
+
const value = match[1] ?? match[2] ?? match[3];
|
|
902
|
+
if (value)
|
|
903
|
+
keys.push(value);
|
|
904
|
+
}
|
|
905
|
+
const unique = [...new Set(keys)];
|
|
906
|
+
return unique.length > 0 ? unique : fallback;
|
|
907
|
+
}
|
|
908
|
+
catch {
|
|
909
|
+
return fallback;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
export function _collectEvaluatorKeys(evaluators) {
|
|
885
913
|
if (!evaluators)
|
|
886
914
|
return [];
|
|
887
915
|
const keys = [];
|
|
888
916
|
for (const ev of evaluators) {
|
|
889
|
-
|
|
890
|
-
if (name && name.length > 0)
|
|
891
|
-
keys.push(name);
|
|
917
|
+
keys.push(..._extractEvaluatorFeedbackKeys(ev));
|
|
892
918
|
}
|
|
893
919
|
return keys;
|
|
894
920
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -18,6 +18,6 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using pnpm bump-version
|
|
21
|
-
exports.__version__ = "0.7.
|
|
21
|
+
exports.__version__ = "0.7.8";
|
|
22
22
|
// Metadata key to hide a traced run from LangSmith's Messages View.
|
|
23
23
|
exports.LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ 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, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.7.
|
|
8
|
+
export declare const __version__ = "0.7.8";
|
|
9
9
|
export declare const LS_MESSAGE_VIEW_EXCLUDE: "ls_message_view_exclude";
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,6 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using pnpm bump-version
|
|
8
|
-
export const __version__ = "0.7.
|
|
8
|
+
export const __version__ = "0.7.8";
|
|
9
9
|
// Metadata key to hide a traced run from LangSmith's Messages View.
|
|
10
10
|
export const LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
|
package/dist/sandbox/errors.cjs
CHANGED
|
@@ -197,7 +197,8 @@ exports.LangSmithValidationError = LangSmithValidationError;
|
|
|
197
197
|
/**
|
|
198
198
|
* Raised when organization quota limits are exceeded.
|
|
199
199
|
*
|
|
200
|
-
* Users should contact support
|
|
200
|
+
* Users should contact technical support via our Support Portal
|
|
201
|
+
* (https://support.langchain.com) to increase quotas.
|
|
201
202
|
*/
|
|
202
203
|
class LangSmithQuotaExceededError extends LangSmithSandboxError {
|
|
203
204
|
constructor(message, quotaType) {
|
package/dist/sandbox/errors.d.ts
CHANGED
|
@@ -85,7 +85,8 @@ export declare class LangSmithValidationError extends LangSmithSandboxError {
|
|
|
85
85
|
/**
|
|
86
86
|
* Raised when organization quota limits are exceeded.
|
|
87
87
|
*
|
|
88
|
-
* Users should contact support
|
|
88
|
+
* Users should contact technical support via our Support Portal
|
|
89
|
+
* (https://support.langchain.com) to increase quotas.
|
|
89
90
|
*/
|
|
90
91
|
export declare class LangSmithQuotaExceededError extends LangSmithSandboxError {
|
|
91
92
|
quotaType?: string;
|
package/dist/sandbox/errors.js
CHANGED
|
@@ -184,7 +184,8 @@ export class LangSmithValidationError extends LangSmithSandboxError {
|
|
|
184
184
|
/**
|
|
185
185
|
* Raised when organization quota limits are exceeded.
|
|
186
186
|
*
|
|
187
|
-
* Users should contact support
|
|
187
|
+
* Users should contact technical support via our Support Portal
|
|
188
|
+
* (https://support.langchain.com) to increase quotas.
|
|
188
189
|
*/
|
|
189
190
|
export class LangSmithQuotaExceededError extends LangSmithSandboxError {
|
|
190
191
|
constructor(message, quotaType) {
|