langsmith 0.5.22 → 0.5.24
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 +365 -19
- package/dist/client.d.ts +116 -1
- package/dist/client.js +369 -23
- package/dist/evaluation/_runner.cjs +4 -7
- package/dist/evaluation/_runner.js +2 -5
- package/dist/evaluation/evaluate_comparative.cjs +10 -10
- package/dist/evaluation/evaluate_comparative.js +1 -1
- package/dist/evaluation/evaluator.cjs +2 -2
- package/dist/evaluation/evaluator.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/run_trees.cjs +8 -7
- package/dist/run_trees.d.ts +7 -0
- package/dist/run_trees.js +7 -6
- package/dist/schemas.d.ts +54 -0
- package/dist/singletons/otel.cjs +3 -2
- package/dist/singletons/otel.js +4 -3
- package/dist/traceable.cjs +1 -2
- package/dist/traceable.js +1 -2
- package/dist/utils/_uuid.cjs +2 -2
- package/dist/utils/_uuid.js +1 -1
- package/dist/utils/env.cjs +33 -0
- package/dist/utils/env.d.ts +9 -0
- package/dist/utils/env.js +32 -0
- package/dist/utils/error.cjs +7 -0
- package/dist/utils/error.d.ts +1 -0
- package/dist/utils/error.js +6 -0
- package/dist/utils/fast-safe-stringify/index.cjs +203 -0
- package/dist/utils/fast-safe-stringify/index.d.ts +46 -0
- package/dist/utils/fast-safe-stringify/index.js +202 -0
- package/dist/utils/jestlike/index.cjs +5 -5
- package/dist/utils/jestlike/index.js +1 -1
- package/dist/utils/jestlike/vendor/evaluatedBy.cjs +3 -3
- package/dist/utils/jestlike/vendor/evaluatedBy.js +1 -1
- package/dist/utils/prompts.cjs +7 -2
- package/dist/utils/prompts.d.ts +6 -1
- package/dist/utils/prompts.js +6 -1
- package/dist/utils/serialize_worker.cjs +389 -0
- package/dist/utils/serialize_worker.d.ts +67 -0
- package/dist/utils/serialize_worker.js +383 -0
- package/dist/utils/uuid/src/index.cjs +24 -0
- package/dist/utils/uuid/src/index.d.ts +10 -0
- package/dist/utils/uuid/src/index.js +9 -0
- package/dist/utils/uuid/src/max.cjs +3 -0
- package/dist/utils/uuid/src/max.d.ts +2 -0
- package/dist/utils/uuid/src/max.js +1 -0
- package/dist/utils/uuid/src/nil.cjs +3 -0
- package/dist/utils/uuid/src/nil.d.ts +2 -0
- package/dist/utils/uuid/src/nil.js +1 -0
- package/dist/utils/uuid/src/parse.cjs +23 -0
- package/dist/utils/uuid/src/parse.d.ts +3 -0
- package/dist/utils/uuid/src/parse.js +18 -0
- package/dist/utils/uuid/src/regex.cjs +3 -0
- package/dist/utils/uuid/src/regex.d.ts +2 -0
- package/dist/utils/uuid/src/regex.js +1 -0
- package/dist/utils/uuid/src/rng.cjs +10 -0
- package/dist/utils/uuid/src/rng.d.ts +1 -0
- package/dist/utils/uuid/src/rng.js +7 -0
- package/dist/utils/uuid/src/sha1.cjs +75 -0
- package/dist/utils/uuid/src/sha1.d.ts +2 -0
- package/dist/utils/uuid/src/sha1.js +73 -0
- package/dist/utils/uuid/src/stringify.cjs +55 -0
- package/dist/utils/uuid/src/stringify.d.ts +3 -0
- package/dist/utils/uuid/src/stringify.js +49 -0
- package/dist/utils/uuid/src/types.cjs +2 -0
- package/dist/utils/uuid/src/types.d.ts +22 -0
- package/dist/utils/uuid/src/types.js +1 -0
- package/dist/utils/uuid/src/v35.cjs +52 -0
- package/dist/utils/uuid/src/v35.d.ts +7 -0
- package/dist/utils/uuid/src/v35.js +44 -0
- package/dist/utils/uuid/src/v4.cjs +40 -0
- package/dist/utils/uuid/src/v4.d.ts +4 -0
- package/dist/utils/uuid/src/v4.js +35 -0
- package/dist/utils/uuid/src/v5.cjs +50 -0
- package/dist/utils/uuid/src/v5.d.ts +9 -0
- package/dist/utils/uuid/src/v5.js +9 -0
- package/dist/utils/uuid/src/v7.cjs +88 -0
- package/dist/utils/uuid/src/v7.d.ts +9 -0
- package/dist/utils/uuid/src/v7.js +82 -0
- package/dist/utils/uuid/src/validate.cjs +10 -0
- package/dist/utils/uuid/src/validate.d.ts +2 -0
- package/dist/utils/uuid/src/validate.js +5 -0
- package/dist/utils/uuid/src/version.cjs +13 -0
- package/dist/utils/uuid/src/version.d.ts +2 -0
- package/dist/utils/uuid/src/version.js +8 -0
- package/dist/utils/worker_threads.browser.cjs +16 -0
- package/dist/utils/worker_threads.browser.d.ts +14 -0
- package/dist/utils/worker_threads.browser.js +13 -0
- package/dist/utils/worker_threads.cjs +16 -0
- package/dist/utils/worker_threads.d.ts +13 -0
- package/dist/utils/worker_threads.js +13 -0
- package/dist/uuid.cjs +2 -2
- package/dist/uuid.js +1 -1
- package/package.json +7 -5
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { OTELContext } from "./experimental/otel/types.js";
|
|
2
2
|
import { AsyncCallerParams } from "./utils/async_caller.js";
|
|
3
|
-
import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleCreate, ExampleUpdate, ExampleUpdateWithoutId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, TimeDelta, TracerSession, TracerSessionResult, ValueType, AnnotationQueue, RunWithAnnotationQueueInfo, Attachments, UploadExamplesResponse, UpdateExamplesResponse, DatasetVersion, AnnotationQueueWithDetails, AnnotationQueueRubricItem, FeedbackConfigSchema } from "./schemas.js";
|
|
3
|
+
import { ComparativeExperiment, DataType, Dataset, DatasetDiffInfo, DatasetShareSchema, Example, ExampleCreate, ExampleUpdate, ExampleUpdateWithoutId, Feedback, FeedbackConfig, FeedbackIngestToken, KVMap, LangChainBaseMessage, LangSmithSettings, LikePromptResponse, Prompt, PromptCommit, PromptSortField, Run, RunCreate, RunUpdate, ScoreType, TimeDelta, TracerSession, TracerSessionResult, ValueType, AnnotationQueue, RunWithAnnotationQueueInfo, Attachments, UploadExamplesResponse, UpdateExamplesResponse, DatasetVersion, AnnotationQueueWithDetails, AnnotationQueueRubricItem, FeedbackConfigSchema, AgentContext, SkillContext, Entry } from "./schemas.js";
|
|
4
|
+
import { type TracingMode } from "./utils/env.js";
|
|
4
5
|
import { EvaluationResult, EvaluationResults } from "./evaluation/evaluator.js";
|
|
5
6
|
import { PromptCache } from "./utils/prompt_cache/index.js";
|
|
6
7
|
export interface ClientConfig {
|
|
@@ -56,6 +57,17 @@ export interface ClientConfig {
|
|
|
56
57
|
* By default, prompt caching is enabled globally.
|
|
57
58
|
*/
|
|
58
59
|
disablePromptCache?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Where to send traces. One of:
|
|
62
|
+
*
|
|
63
|
+
* - `"langsmith"` (default) — LangSmith REST API only.
|
|
64
|
+
* - `"otel"` — OpenTelemetry export only.
|
|
65
|
+
*
|
|
66
|
+
* Falls back to the `LANGSMITH_TRACING_MODE` env var, then to the
|
|
67
|
+
* legacy `OTEL_ENABLED` / `LANGSMITH_OTEL_ENABLED` env vars, then to
|
|
68
|
+
* `"langsmith"`.
|
|
69
|
+
*/
|
|
70
|
+
tracingMode?: TracingMode;
|
|
59
71
|
/**
|
|
60
72
|
* Additional HTTP headers to include in all requests.
|
|
61
73
|
* These headers will be merged with the default headers (User-Agent,
|
|
@@ -414,11 +426,37 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
414
426
|
private _serverInfo;
|
|
415
427
|
private _getServerInfoPromise?;
|
|
416
428
|
private manualFlushMode;
|
|
429
|
+
private _serializeWorker?;
|
|
430
|
+
/**
|
|
431
|
+
* Tracks in-flight drainAutoBatchQueue promises so awaitPendingTraceBatches
|
|
432
|
+
* can wait on them even if the flush involves async work (worker-thread
|
|
433
|
+
* serialize) that hasn't yet registered with batchIngestCaller.queue.
|
|
434
|
+
*/
|
|
435
|
+
private _pendingDrains;
|
|
417
436
|
private langSmithToOTELTranslator?;
|
|
437
|
+
private _tracingMode;
|
|
438
|
+
get tracingMode(): TracingMode;
|
|
418
439
|
private fetchImplementation?;
|
|
419
440
|
private cachedLSEnvVarsForMetadata?;
|
|
420
441
|
private _promptCache?;
|
|
421
442
|
private get _fetch();
|
|
443
|
+
/**
|
|
444
|
+
* Serialize a payload for tracing, optionally offloading the work to a
|
|
445
|
+
* Node worker thread when LANGSMITH_PERF_OPTIMIZATION=true and the runtime
|
|
446
|
+
* supports worker_threads.
|
|
447
|
+
*
|
|
448
|
+
* Falls back to synchronous serialization when:
|
|
449
|
+
* - the perf flag is off
|
|
450
|
+
* - manualFlushMode is enabled (serverless: worker boot cost > benefit)
|
|
451
|
+
* - worker_threads is unavailable (non-Node runtimes)
|
|
452
|
+
* - the payload contains values that can't be structured-cloned across
|
|
453
|
+
* threads (functions, non-cloneable class instances, streams, etc.)
|
|
454
|
+
* - the worker throws for any other reason
|
|
455
|
+
*
|
|
456
|
+
* In all fallback cases the returned bytes are identical to the sync path.
|
|
457
|
+
*/
|
|
458
|
+
private _trackDrain;
|
|
459
|
+
private _serializeBody;
|
|
422
460
|
private multipartStreamingDisabled;
|
|
423
461
|
private _multipartDisabled;
|
|
424
462
|
private _runCompressionDisabled;
|
|
@@ -1306,6 +1344,83 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
1306
1344
|
tags?: string[];
|
|
1307
1345
|
commitDescription?: string;
|
|
1308
1346
|
}): Promise<string>;
|
|
1347
|
+
/**
|
|
1348
|
+
* Check if an agent repo exists.
|
|
1349
|
+
*/
|
|
1350
|
+
agentExists(identifier: string): Promise<boolean>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Check if a skill repo exists.
|
|
1353
|
+
*/
|
|
1354
|
+
skillExists(identifier: string): Promise<boolean>;
|
|
1355
|
+
/**
|
|
1356
|
+
* Pull an agent directory from Hub.
|
|
1357
|
+
* @param identifier The identifier (owner/name[:version]).
|
|
1358
|
+
* @param options.version Commit hash or tag; overrides identifier's version.
|
|
1359
|
+
*/
|
|
1360
|
+
pullAgent(identifier: string, options?: {
|
|
1361
|
+
version?: string;
|
|
1362
|
+
}): Promise<AgentContext>;
|
|
1363
|
+
/**
|
|
1364
|
+
* Pull a skill directory from Hub.
|
|
1365
|
+
*/
|
|
1366
|
+
pullSkill(identifier: string, options?: {
|
|
1367
|
+
version?: string;
|
|
1368
|
+
}): Promise<SkillContext>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Push an agent to Hub. Creates the repo if missing, patches metadata if
|
|
1371
|
+
* provided, then commits the given files.
|
|
1372
|
+
* @returns The URL of the resulting commit.
|
|
1373
|
+
*/
|
|
1374
|
+
pushAgent(identifier: string, options: {
|
|
1375
|
+
files: Record<string, Entry | null>;
|
|
1376
|
+
parentCommit?: string;
|
|
1377
|
+
description?: string;
|
|
1378
|
+
readme?: string;
|
|
1379
|
+
tags?: string[];
|
|
1380
|
+
isPublic?: boolean;
|
|
1381
|
+
}): Promise<string>;
|
|
1382
|
+
/**
|
|
1383
|
+
* Push a skill to Hub.
|
|
1384
|
+
*/
|
|
1385
|
+
pushSkill(identifier: string, options: {
|
|
1386
|
+
files: Record<string, Entry | null>;
|
|
1387
|
+
parentCommit?: string;
|
|
1388
|
+
description?: string;
|
|
1389
|
+
readme?: string;
|
|
1390
|
+
tags?: string[];
|
|
1391
|
+
isPublic?: boolean;
|
|
1392
|
+
}): Promise<string>;
|
|
1393
|
+
/**
|
|
1394
|
+
* Delete an agent and all its owned child file repos.
|
|
1395
|
+
*/
|
|
1396
|
+
deleteAgent(identifier: string): Promise<void>;
|
|
1397
|
+
/**
|
|
1398
|
+
* Delete a skill and all its owned child file repos.
|
|
1399
|
+
*/
|
|
1400
|
+
deleteSkill(identifier: string): Promise<void>;
|
|
1401
|
+
/**
|
|
1402
|
+
* List agent repos. Yields one at a time, auto-paginating.
|
|
1403
|
+
*/
|
|
1404
|
+
listAgents(options?: {
|
|
1405
|
+
isPublic?: boolean;
|
|
1406
|
+
isArchived?: boolean;
|
|
1407
|
+
query?: string;
|
|
1408
|
+
}): AsyncIterableIterator<Prompt>;
|
|
1409
|
+
/**
|
|
1410
|
+
* List skill repos. Yields one at a time, auto-paginating.
|
|
1411
|
+
*/
|
|
1412
|
+
listSkills(options?: {
|
|
1413
|
+
isPublic?: boolean;
|
|
1414
|
+
isArchived?: boolean;
|
|
1415
|
+
query?: string;
|
|
1416
|
+
}): AsyncIterableIterator<Prompt>;
|
|
1417
|
+
private _listReposByType;
|
|
1418
|
+
private _pullDirectory;
|
|
1419
|
+
private _pushDirectory;
|
|
1420
|
+
private _deleteDirectory;
|
|
1421
|
+
private _repoExists;
|
|
1422
|
+
private _createRepo;
|
|
1423
|
+
private _updateRepoMetadata;
|
|
1309
1424
|
/**
|
|
1310
1425
|
* Clone a public dataset to your own langsmith tenant.
|
|
1311
1426
|
* This operation is idempotent. If you already have a dataset with the given name,
|