langsmith 0.4.8 → 0.4.9
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/anthropic/context.cjs +187 -0
- package/dist/experimental/anthropic/context.d.ts +5 -0
- package/dist/experimental/anthropic/context.js +183 -0
- package/dist/experimental/anthropic/index.cjs +82 -863
- package/dist/experimental/anthropic/index.d.ts +1 -1
- package/dist/experimental/anthropic/index.js +83 -864
- package/dist/experimental/anthropic/messages.cjs +102 -0
- package/dist/experimental/anthropic/messages.d.ts +6 -0
- package/dist/experimental/anthropic/messages.js +96 -0
- package/dist/experimental/anthropic/types.cjs +1 -0
- package/dist/experimental/anthropic/types.d.ts +50 -37
- package/dist/experimental/anthropic/types.js +1 -0
- package/dist/experimental/anthropic/usage.cjs +180 -0
- package/dist/experimental/anthropic/usage.d.ts +1 -0
- package/dist/experimental/anthropic/usage.js +175 -0
- package/dist/experimental/anthropic/utils.cjs +14 -0
- package/dist/experimental/anthropic/utils.d.ts +1 -1
- package/dist/experimental/anthropic/utils.js +13 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/usage.cjs +6 -7
- package/dist/utils/usage.js +6 -7
- package/experimental/anthropic.cjs +1 -0
- package/experimental/anthropic.d.cts +1 -0
- package/experimental/anthropic.d.ts +1 -0
- package/experimental/anthropic.js +1 -0
- package/package.json +14 -1
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNumberProperty = getNumberProperty;
|
|
4
|
+
exports.isIterable = isIterable;
|
|
5
|
+
/**
|
|
6
|
+
* Gets a number property from an object.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
4
9
|
function getNumberProperty(obj, key) {
|
|
5
10
|
if (!obj || typeof obj !== "object" || !(key in obj)) {
|
|
6
11
|
return undefined;
|
|
@@ -8,3 +13,12 @@ function getNumberProperty(obj, key) {
|
|
|
8
13
|
const value = Reflect.get(obj, key);
|
|
9
14
|
return typeof value === "number" ? value : undefined;
|
|
10
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Checks if a value is iterable.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
function isIterable(value) {
|
|
21
|
+
return (typeof value === "object" &&
|
|
22
|
+
value !== null &&
|
|
23
|
+
typeof value[Symbol.iterator] === "function");
|
|
24
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets a number property from an object.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
1
5
|
export function getNumberProperty(obj, key) {
|
|
2
6
|
if (!obj || typeof obj !== "object" || !(key in obj)) {
|
|
3
7
|
return undefined;
|
|
@@ -5,3 +9,12 @@ export function getNumberProperty(obj, key) {
|
|
|
5
9
|
const value = Reflect.get(obj, key);
|
|
6
10
|
return typeof value === "number" ? value : undefined;
|
|
7
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* Checks if a value is iterable.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export function isIterable(value) {
|
|
17
|
+
return (typeof value === "object" &&
|
|
18
|
+
value !== null &&
|
|
19
|
+
typeof value[Symbol.iterator] === "function");
|
|
20
|
+
}
|
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.9";
|
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.9";
|
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.9";
|
package/dist/utils/usage.cjs
CHANGED
|
@@ -2,28 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.convertAnthropicUsageToInputTokenDetails = void 0;
|
|
4
4
|
const convertAnthropicUsageToInputTokenDetails = (usage) => {
|
|
5
|
-
const
|
|
5
|
+
const result = {};
|
|
6
6
|
if (usage.cache_creation != null &&
|
|
7
7
|
typeof usage.cache_creation === "object") {
|
|
8
8
|
const cacheCreation = usage.cache_creation;
|
|
9
9
|
if (typeof cacheCreation.ephemeral_5m_input_tokens === "number") {
|
|
10
|
-
|
|
10
|
+
result.ephemeral_5m_input_tokens =
|
|
11
11
|
cacheCreation.ephemeral_5m_input_tokens;
|
|
12
12
|
}
|
|
13
13
|
if (typeof cacheCreation.ephemeral_1h_input_tokens === "number") {
|
|
14
|
-
|
|
14
|
+
result.ephemeral_1hr_input_tokens =
|
|
15
15
|
cacheCreation.ephemeral_1h_input_tokens;
|
|
16
16
|
}
|
|
17
17
|
// If cache_creation not returned (no beta header passed),
|
|
18
18
|
// fallback to assuming 5m cache tokens
|
|
19
19
|
}
|
|
20
20
|
else if (typeof usage.cache_creation_input_tokens === "number") {
|
|
21
|
-
|
|
22
|
-
usage.cache_creation_input_tokens;
|
|
21
|
+
result.ephemeral_5m_input_tokens = usage.cache_creation_input_tokens;
|
|
23
22
|
}
|
|
24
23
|
if (typeof usage.cache_read_input_tokens === "number") {
|
|
25
|
-
|
|
24
|
+
result.cache_read = usage.cache_read_input_tokens;
|
|
26
25
|
}
|
|
27
|
-
return
|
|
26
|
+
return result;
|
|
28
27
|
};
|
|
29
28
|
exports.convertAnthropicUsageToInputTokenDetails = convertAnthropicUsageToInputTokenDetails;
|
package/dist/utils/usage.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
export const convertAnthropicUsageToInputTokenDetails = (usage) => {
|
|
2
|
-
const
|
|
2
|
+
const result = {};
|
|
3
3
|
if (usage.cache_creation != null &&
|
|
4
4
|
typeof usage.cache_creation === "object") {
|
|
5
5
|
const cacheCreation = usage.cache_creation;
|
|
6
6
|
if (typeof cacheCreation.ephemeral_5m_input_tokens === "number") {
|
|
7
|
-
|
|
7
|
+
result.ephemeral_5m_input_tokens =
|
|
8
8
|
cacheCreation.ephemeral_5m_input_tokens;
|
|
9
9
|
}
|
|
10
10
|
if (typeof cacheCreation.ephemeral_1h_input_tokens === "number") {
|
|
11
|
-
|
|
11
|
+
result.ephemeral_1hr_input_tokens =
|
|
12
12
|
cacheCreation.ephemeral_1h_input_tokens;
|
|
13
13
|
}
|
|
14
14
|
// If cache_creation not returned (no beta header passed),
|
|
15
15
|
// fallback to assuming 5m cache tokens
|
|
16
16
|
}
|
|
17
17
|
else if (typeof usage.cache_creation_input_tokens === "number") {
|
|
18
|
-
|
|
19
|
-
usage.cache_creation_input_tokens;
|
|
18
|
+
result.ephemeral_5m_input_tokens = usage.cache_creation_input_tokens;
|
|
20
19
|
}
|
|
21
20
|
if (typeof usage.cache_read_input_tokens === "number") {
|
|
22
|
-
|
|
21
|
+
result.cache_read = usage.cache_read_input_tokens;
|
|
23
22
|
}
|
|
24
|
-
return
|
|
23
|
+
return result;
|
|
25
24
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('../dist/experimental/anthropic/index.cjs');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/anthropic/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/anthropic/index.js'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../dist/experimental/anthropic/index.js'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "langsmith",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
|
|
5
5
|
"packageManager": "yarn@1.22.19",
|
|
6
6
|
"files": [
|
|
@@ -85,6 +85,10 @@
|
|
|
85
85
|
"experimental/vercel.js",
|
|
86
86
|
"experimental/vercel.d.ts",
|
|
87
87
|
"experimental/vercel.d.cts",
|
|
88
|
+
"experimental/anthropic.cjs",
|
|
89
|
+
"experimental/anthropic.js",
|
|
90
|
+
"experimental/anthropic.d.ts",
|
|
91
|
+
"experimental/anthropic.d.cts",
|
|
88
92
|
"index.cjs",
|
|
89
93
|
"index.js",
|
|
90
94
|
"index.d.ts",
|
|
@@ -402,6 +406,15 @@
|
|
|
402
406
|
"import": "./experimental/vercel.js",
|
|
403
407
|
"require": "./experimental/vercel.cjs"
|
|
404
408
|
},
|
|
409
|
+
"./experimental/anthropic": {
|
|
410
|
+
"types": {
|
|
411
|
+
"import": "./experimental/anthropic.d.ts",
|
|
412
|
+
"require": "./experimental/anthropic.d.cts",
|
|
413
|
+
"default": "./experimental/anthropic.d.ts"
|
|
414
|
+
},
|
|
415
|
+
"import": "./experimental/anthropic.js",
|
|
416
|
+
"require": "./experimental/anthropic.cjs"
|
|
417
|
+
},
|
|
405
418
|
"./package.json": "./package.json"
|
|
406
419
|
},
|
|
407
420
|
"browser": {
|