langsmith 0.2.12 → 0.2.13
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/client.cjs +32 -5
- package/dist/client.js +32 -5
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas.d.ts +8 -1
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -834,7 +834,16 @@ class Client {
|
|
|
834
834
|
const attachments = allAttachments[payload.id];
|
|
835
835
|
if (attachments) {
|
|
836
836
|
delete allAttachments[payload.id];
|
|
837
|
-
for (const [name,
|
|
837
|
+
for (const [name, attachment] of Object.entries(attachments)) {
|
|
838
|
+
let contentType;
|
|
839
|
+
let content;
|
|
840
|
+
if (Array.isArray(attachment)) {
|
|
841
|
+
[contentType, content] = attachment;
|
|
842
|
+
}
|
|
843
|
+
else {
|
|
844
|
+
contentType = attachment.mimeType;
|
|
845
|
+
content = attachment.data;
|
|
846
|
+
}
|
|
838
847
|
// Validate that the attachment name doesn't contain a '.'
|
|
839
848
|
if (name.includes(".")) {
|
|
840
849
|
console.warn(`Skipping attachment '${name}' for run ${payload.id}: Invalid attachment name. ` +
|
|
@@ -1948,7 +1957,7 @@ class Client {
|
|
|
1948
1957
|
if (attachment_urls) {
|
|
1949
1958
|
// add attachments back to the example
|
|
1950
1959
|
example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
1951
|
-
acc[key] = {
|
|
1960
|
+
acc[key.slice("attachment.".length)] = {
|
|
1952
1961
|
presigned_url: value.presigned_url,
|
|
1953
1962
|
};
|
|
1954
1963
|
return acc;
|
|
@@ -2015,7 +2024,7 @@ class Client {
|
|
|
2015
2024
|
const example = rest;
|
|
2016
2025
|
if (attachment_urls) {
|
|
2017
2026
|
example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
2018
|
-
acc[key] = {
|
|
2027
|
+
acc[key.slice("attachment.".length)] = {
|
|
2019
2028
|
presigned_url: value.presigned_url,
|
|
2020
2029
|
};
|
|
2021
2030
|
return acc;
|
|
@@ -2732,7 +2741,16 @@ class Client {
|
|
|
2732
2741
|
}
|
|
2733
2742
|
// Add attachments if present
|
|
2734
2743
|
if (example.attachments) {
|
|
2735
|
-
for (const [name,
|
|
2744
|
+
for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2745
|
+
let mimeType;
|
|
2746
|
+
let data;
|
|
2747
|
+
if (Array.isArray(attachment)) {
|
|
2748
|
+
[mimeType, data] = attachment;
|
|
2749
|
+
}
|
|
2750
|
+
else {
|
|
2751
|
+
mimeType = attachment.mimeType;
|
|
2752
|
+
data = attachment.data;
|
|
2753
|
+
}
|
|
2736
2754
|
const attachmentBlob = new Blob([data], {
|
|
2737
2755
|
type: `${mimeType}; length=${data.byteLength}`,
|
|
2738
2756
|
});
|
|
@@ -2795,7 +2813,16 @@ class Client {
|
|
|
2795
2813
|
}
|
|
2796
2814
|
// Add attachments if present
|
|
2797
2815
|
if (example.attachments) {
|
|
2798
|
-
for (const [name,
|
|
2816
|
+
for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2817
|
+
let mimeType;
|
|
2818
|
+
let data;
|
|
2819
|
+
if (Array.isArray(attachment)) {
|
|
2820
|
+
[mimeType, data] = attachment;
|
|
2821
|
+
}
|
|
2822
|
+
else {
|
|
2823
|
+
mimeType = attachment.mimeType;
|
|
2824
|
+
data = attachment.data;
|
|
2825
|
+
}
|
|
2799
2826
|
const attachmentBlob = new Blob([data], {
|
|
2800
2827
|
type: `${mimeType}; length=${data.byteLength}`,
|
|
2801
2828
|
});
|
package/dist/client.js
CHANGED
|
@@ -806,7 +806,16 @@ export class Client {
|
|
|
806
806
|
const attachments = allAttachments[payload.id];
|
|
807
807
|
if (attachments) {
|
|
808
808
|
delete allAttachments[payload.id];
|
|
809
|
-
for (const [name,
|
|
809
|
+
for (const [name, attachment] of Object.entries(attachments)) {
|
|
810
|
+
let contentType;
|
|
811
|
+
let content;
|
|
812
|
+
if (Array.isArray(attachment)) {
|
|
813
|
+
[contentType, content] = attachment;
|
|
814
|
+
}
|
|
815
|
+
else {
|
|
816
|
+
contentType = attachment.mimeType;
|
|
817
|
+
content = attachment.data;
|
|
818
|
+
}
|
|
810
819
|
// Validate that the attachment name doesn't contain a '.'
|
|
811
820
|
if (name.includes(".")) {
|
|
812
821
|
console.warn(`Skipping attachment '${name}' for run ${payload.id}: Invalid attachment name. ` +
|
|
@@ -1920,7 +1929,7 @@ export class Client {
|
|
|
1920
1929
|
if (attachment_urls) {
|
|
1921
1930
|
// add attachments back to the example
|
|
1922
1931
|
example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
1923
|
-
acc[key] = {
|
|
1932
|
+
acc[key.slice("attachment.".length)] = {
|
|
1924
1933
|
presigned_url: value.presigned_url,
|
|
1925
1934
|
};
|
|
1926
1935
|
return acc;
|
|
@@ -1987,7 +1996,7 @@ export class Client {
|
|
|
1987
1996
|
const example = rest;
|
|
1988
1997
|
if (attachment_urls) {
|
|
1989
1998
|
example.attachments = Object.entries(attachment_urls).reduce((acc, [key, value]) => {
|
|
1990
|
-
acc[key] = {
|
|
1999
|
+
acc[key.slice("attachment.".length)] = {
|
|
1991
2000
|
presigned_url: value.presigned_url,
|
|
1992
2001
|
};
|
|
1993
2002
|
return acc;
|
|
@@ -2704,7 +2713,16 @@ export class Client {
|
|
|
2704
2713
|
}
|
|
2705
2714
|
// Add attachments if present
|
|
2706
2715
|
if (example.attachments) {
|
|
2707
|
-
for (const [name,
|
|
2716
|
+
for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2717
|
+
let mimeType;
|
|
2718
|
+
let data;
|
|
2719
|
+
if (Array.isArray(attachment)) {
|
|
2720
|
+
[mimeType, data] = attachment;
|
|
2721
|
+
}
|
|
2722
|
+
else {
|
|
2723
|
+
mimeType = attachment.mimeType;
|
|
2724
|
+
data = attachment.data;
|
|
2725
|
+
}
|
|
2708
2726
|
const attachmentBlob = new Blob([data], {
|
|
2709
2727
|
type: `${mimeType}; length=${data.byteLength}`,
|
|
2710
2728
|
});
|
|
@@ -2767,7 +2785,16 @@ export class Client {
|
|
|
2767
2785
|
}
|
|
2768
2786
|
// Add attachments if present
|
|
2769
2787
|
if (example.attachments) {
|
|
2770
|
-
for (const [name,
|
|
2788
|
+
for (const [name, attachment] of Object.entries(example.attachments)) {
|
|
2789
|
+
let mimeType;
|
|
2790
|
+
let data;
|
|
2791
|
+
if (Array.isArray(attachment)) {
|
|
2792
|
+
[mimeType, data] = attachment;
|
|
2793
|
+
}
|
|
2794
|
+
else {
|
|
2795
|
+
mimeType = attachment.mimeType;
|
|
2796
|
+
data = attachment.data;
|
|
2797
|
+
}
|
|
2771
2798
|
const attachmentBlob = new Blob([data], {
|
|
2772
2799
|
type: `${mimeType}; length=${data.byteLength}`,
|
|
2773
2800
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "RunTree", { enumerable: true, get: function () {
|
|
|
8
8
|
var fetch_js_1 = require("./singletons/fetch.cjs");
|
|
9
9
|
Object.defineProperty(exports, "overrideFetchImplementation", { enumerable: true, get: function () { return fetch_js_1.overrideFetchImplementation; } });
|
|
10
10
|
// Update using yarn bump-version
|
|
11
|
-
exports.__version__ = "0.2.
|
|
11
|
+
exports.__version__ = "0.2.13";
|
package/dist/index.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ export { Client, type ClientConfig, type LangSmithTracingClientInterface, } from
|
|
|
2
2
|
export type { Dataset, Example, TracerSession, Run, Feedback, RetrieverOutput, } from "./schemas.js";
|
|
3
3
|
export { RunTree, type RunTreeConfig } from "./run_trees.js";
|
|
4
4
|
export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
5
|
-
export declare const __version__ = "0.2.
|
|
5
|
+
export declare const __version__ = "0.2.13";
|
package/dist/index.js
CHANGED
package/dist/schemas.d.ts
CHANGED
|
@@ -36,7 +36,14 @@ export interface AttachmentInfo {
|
|
|
36
36
|
presigned_url: string;
|
|
37
37
|
}
|
|
38
38
|
export type AttachmentData = Uint8Array | ArrayBuffer;
|
|
39
|
-
export type
|
|
39
|
+
export type AttachmentDescription = {
|
|
40
|
+
mimeType: string;
|
|
41
|
+
data: AttachmentData;
|
|
42
|
+
};
|
|
43
|
+
export type Attachments = Record<string, [
|
|
44
|
+
string,
|
|
45
|
+
AttachmentData
|
|
46
|
+
] | AttachmentDescription>;
|
|
40
47
|
/**
|
|
41
48
|
* A run can represent either a trace (root run)
|
|
42
49
|
* or a child run (~span).
|