langsmith 0.0.10 → 0.0.11
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 +19 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +19 -0
- package/dist/schemas.d.ts +1 -0
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -105,6 +105,17 @@ class Client {
|
|
|
105
105
|
throw new Error("API key must be provided when using hosted LangSmith API");
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
getHostUrl() {
|
|
109
|
+
if (isLocalhost(this.apiUrl)) {
|
|
110
|
+
return "http://localhost";
|
|
111
|
+
}
|
|
112
|
+
else if (this.apiUrl.split(".", 1)[0].includes("dev")) {
|
|
113
|
+
return "https://dev.smith.langchain.com";
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
return "https://smith.langchain.com";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
108
119
|
get headers() {
|
|
109
120
|
const headers = {};
|
|
110
121
|
if (this.apiKey) {
|
|
@@ -193,6 +204,14 @@ class Client {
|
|
|
193
204
|
}
|
|
194
205
|
return run;
|
|
195
206
|
}
|
|
207
|
+
async getRunUrl({ runId, }) {
|
|
208
|
+
const run = await this.readRun(runId);
|
|
209
|
+
if (!run.app_path) {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
const baseUrl = this.getHostUrl();
|
|
213
|
+
return `${baseUrl}${run.app_path}`;
|
|
214
|
+
}
|
|
196
215
|
async _loadChildRuns(run) {
|
|
197
216
|
const childRuns = await toArray(this.listRuns({ id: run.child_run_ids }));
|
|
198
217
|
const treemap = {};
|
package/dist/client.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export declare class Client {
|
|
|
62
62
|
apiKey?: string;
|
|
63
63
|
};
|
|
64
64
|
private validateApiKeyIfHosted;
|
|
65
|
+
private getHostUrl;
|
|
65
66
|
private get headers();
|
|
66
67
|
private _get;
|
|
67
68
|
private _getPaginated;
|
|
@@ -70,6 +71,9 @@ export declare class Client {
|
|
|
70
71
|
readRun(runId: string, { loadChildRuns }?: {
|
|
71
72
|
loadChildRuns: boolean;
|
|
72
73
|
}): Promise<Run>;
|
|
74
|
+
getRunUrl({ runId, }: {
|
|
75
|
+
runId: string;
|
|
76
|
+
}): Promise<string | undefined>;
|
|
73
77
|
private _loadChildRuns;
|
|
74
78
|
listRuns({ projectId, projectName, parentRunId, referenceExampleId, datasetId, startTime, endTime, executionOrder, runType, error, id, limit, offset, query, filter, orderBy, }: ListRunsParams): AsyncIterable<Run>;
|
|
75
79
|
deleteRun(runId: string): Promise<void>;
|
package/dist/client.js
CHANGED
|
@@ -79,6 +79,17 @@ export class Client {
|
|
|
79
79
|
throw new Error("API key must be provided when using hosted LangSmith API");
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
getHostUrl() {
|
|
83
|
+
if (isLocalhost(this.apiUrl)) {
|
|
84
|
+
return "http://localhost";
|
|
85
|
+
}
|
|
86
|
+
else if (this.apiUrl.split(".", 1)[0].includes("dev")) {
|
|
87
|
+
return "https://dev.smith.langchain.com";
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
return "https://smith.langchain.com";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
82
93
|
get headers() {
|
|
83
94
|
const headers = {};
|
|
84
95
|
if (this.apiKey) {
|
|
@@ -167,6 +178,14 @@ export class Client {
|
|
|
167
178
|
}
|
|
168
179
|
return run;
|
|
169
180
|
}
|
|
181
|
+
async getRunUrl({ runId, }) {
|
|
182
|
+
const run = await this.readRun(runId);
|
|
183
|
+
if (!run.app_path) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
const baseUrl = this.getHostUrl();
|
|
187
|
+
return `${baseUrl}${run.app_path}`;
|
|
188
|
+
}
|
|
170
189
|
async _loadChildRuns(run) {
|
|
171
190
|
const childRuns = await toArray(this.listRuns({ id: run.child_run_ids }));
|
|
172
191
|
const treemap = {};
|
package/dist/schemas.d.ts
CHANGED