@cetra-ai/sdk 0.1.0-rc.2 → 0.1.0-rc.3
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/index.d.ts +1 -1
- package/dist/index.js +21 -5
- package/package.json +14 -14
package/dist/index.d.ts
CHANGED
|
@@ -581,5 +581,5 @@ export declare function withLlmSpan<T>(name: string, options: LlmSpanOptions, fn
|
|
|
581
581
|
*/
|
|
582
582
|
export declare function uuid7(): string;
|
|
583
583
|
/** Package version. Kept equal to package.json. */
|
|
584
|
-
export declare const VERSION = "0.1.0-rc.
|
|
584
|
+
export declare const VERSION = "0.1.0-rc.3";
|
|
585
585
|
export { type AddedQueueItems, type AiTelemetry, type AiTelemetryOptions, type AnnotationQueue, type AnnotationQueueItem, type AnnotationQueues, type CetraOptions, type ChatEntry, type ChatMessage, type ClientOptions, ConfigError, type ContextOptions, type DatasetInfo, type DatasetItem, type Datasets, type EvaluateOptions, type GetPromptOptions, type Instrumentation, type LlmSpanHandle, type LlmSpanOptions, type NewDatasetItem, type ObserveOptions, type PromptValues, type Prompts, type QueueCounts, type QueueItemStatus, type QueueTarget, type QueueTargets, type Run, type Score, type ScoreOptions, type Scorer, type ScorerArgs, type SkippedQueueItem, type SpanHandle, type SpanKind, type SpanOptions, type Usage, flush, init, score, shutdown, spanProcessor, tracerProvider };
|
package/dist/index.js
CHANGED
|
@@ -382,7 +382,8 @@ var FetchTraceExporter = class {
|
|
|
382
382
|
if (body === void 0) return failure("serialize");
|
|
383
383
|
const headers = {
|
|
384
384
|
"Content-Type": "application/x-protobuf",
|
|
385
|
-
Authorization: `Bearer ${this.apiKey}
|
|
385
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
386
|
+
"User-Agent": userAgent()
|
|
386
387
|
};
|
|
387
388
|
let payload = body;
|
|
388
389
|
const compressed = await gzip(body).catch(() => void 0);
|
|
@@ -1835,7 +1836,10 @@ var Client = class {
|
|
|
1835
1836
|
async request(method, template, path, options = {}) {
|
|
1836
1837
|
const url = this.#url(path, options.query);
|
|
1837
1838
|
const attempts = options.retry ?? (method === "GET" || method === "DELETE") ? 4 : 1;
|
|
1838
|
-
const headers = {
|
|
1839
|
+
const headers = {
|
|
1840
|
+
Authorization: `Bearer ${this.#apiKey}`,
|
|
1841
|
+
"User-Agent": userAgent()
|
|
1842
|
+
};
|
|
1839
1843
|
let body;
|
|
1840
1844
|
if (options.body !== void 0) {
|
|
1841
1845
|
headers["Content-Type"] = "application/json";
|
|
@@ -2067,7 +2071,10 @@ var PromptCache = class {
|
|
|
2067
2071
|
};
|
|
2068
2072
|
const selector = t.version !== void 0 ? `version=${t.version}` : `label=${encodeURIComponent(t.label)}`;
|
|
2069
2073
|
const url = `${config.baseUrl}/api/v1/projects/current/prompts/${segment(name)}/resolve?${selector}`;
|
|
2070
|
-
const headers = {
|
|
2074
|
+
const headers = {
|
|
2075
|
+
Authorization: `Bearer ${config.apiKey ?? ""}`,
|
|
2076
|
+
"User-Agent": userAgent()
|
|
2077
|
+
};
|
|
2071
2078
|
if (etag !== void 0) headers["If-None-Match"] = etag;
|
|
2072
2079
|
for (let attempt = 0;; attempt += 1) {
|
|
2073
2080
|
const last = attempt + 1 >= ATTEMPTS;
|
|
@@ -2654,7 +2661,8 @@ var ScoreQueue = class {
|
|
|
2654
2661
|
method: "POST",
|
|
2655
2662
|
headers: {
|
|
2656
2663
|
"Content-Type": "application/json",
|
|
2657
|
-
Authorization: `Bearer ${this.apiKey}
|
|
2664
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
2665
|
+
"User-Agent": userAgent()
|
|
2658
2666
|
},
|
|
2659
2667
|
body: JSON.stringify({ scores: batch }),
|
|
2660
2668
|
signal: timeoutSignal(ATTEMPT_TIMEOUT_MILLIS)
|
|
@@ -2697,6 +2705,14 @@ var ScoreQueue = class {
|
|
|
2697
2705
|
* `AsyncLocalStorageContextManager` and keeps whatever manager was already
|
|
2698
2706
|
* registered (D-F-4).
|
|
2699
2707
|
*/
|
|
2708
|
+
/**
|
|
2709
|
+
* The `User-Agent` of every request the SDK sends itself (spec 10 §
|
|
2710
|
+
* Lifecycle, User agent). A function, not a constant: `index.js` imports this module, so
|
|
2711
|
+
* `VERSION` is only initialized once the whole module graph has loaded.
|
|
2712
|
+
*/
|
|
2713
|
+
function userAgent() {
|
|
2714
|
+
return `cetra-sdk-js/${VERSION}`;
|
|
2715
|
+
}
|
|
2700
2716
|
var Runtime = class Runtime {
|
|
2701
2717
|
config;
|
|
2702
2718
|
provider;
|
|
@@ -4052,5 +4068,5 @@ function errorName(error) {
|
|
|
4052
4068
|
}
|
|
4053
4069
|
// src/index.ts
|
|
4054
4070
|
/** Package version. Kept equal to package.json. */
|
|
4055
|
-
const VERSION = "0.1.0-rc.
|
|
4071
|
+
const VERSION = "0.1.0-rc.3";
|
|
4056
4072
|
export { ApiError, Client, ConfigError, Dataset, ExperimentResult, Prompt, PromptCompileError, PromptNotAvailable, VERSION, aiTelemetry, currentSpanId, currentTraceId, evaluate, flush, getPrompt, init, observe, score, shutdown, spanProcessor, tracerProvider, uuid7, withContext, withLlmSpan, withSpan };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cetra-ai/sdk",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.3",
|
|
4
4
|
"description": "TypeScript SDK for cetra.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -51,30 +51,30 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@anthropic-ai/sdk": "1.
|
|
54
|
+
"@anthropic-ai/sdk": "1.11.0",
|
|
55
55
|
"@arethetypeswrong/cli": "0.18.5",
|
|
56
|
-
"@arizeai/openinference-instrumentation-anthropic": "1.0.
|
|
57
|
-
"@arizeai/openinference-instrumentation-langchain": "4.
|
|
58
|
-
"@arizeai/openinference-instrumentation-openai": "4.
|
|
59
|
-
"@langchain/core": "1.
|
|
56
|
+
"@arizeai/openinference-instrumentation-anthropic": "1.0.4",
|
|
57
|
+
"@arizeai/openinference-instrumentation-langchain": "4.2.2",
|
|
58
|
+
"@arizeai/openinference-instrumentation-openai": "4.6.0",
|
|
59
|
+
"@langchain/core": "1.4.2",
|
|
60
60
|
"@opentelemetry/api": "1.9.1",
|
|
61
61
|
"@types/node": "26.6.6",
|
|
62
|
-
"openai": "7.
|
|
62
|
+
"openai": "7.62.0",
|
|
63
63
|
"publint": "0.3.25",
|
|
64
64
|
"tsdown": "0.23.7",
|
|
65
65
|
"typescript": "5.9.3",
|
|
66
|
-
"vitest": "5.1.
|
|
66
|
+
"vitest": "5.1.1"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@opentelemetry/context-async-hooks": "2.12.
|
|
70
|
-
"@opentelemetry/core": "2.12.
|
|
71
|
-
"@opentelemetry/otlp-transformer": "0.223.
|
|
72
|
-
"@opentelemetry/resources": "2.12.
|
|
73
|
-
"@opentelemetry/sdk-trace": "2.12.
|
|
69
|
+
"@opentelemetry/context-async-hooks": "2.12.1",
|
|
70
|
+
"@opentelemetry/core": "2.12.1",
|
|
71
|
+
"@opentelemetry/otlp-transformer": "0.223.2",
|
|
72
|
+
"@opentelemetry/resources": "2.12.1",
|
|
73
|
+
"@opentelemetry/sdk-trace": "2.12.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@anthropic-ai/sdk": "^1.0.0",
|
|
77
|
-
"@arizeai/openinference-instrumentation-anthropic": "^1.0.
|
|
77
|
+
"@arizeai/openinference-instrumentation-anthropic": "^1.0.1",
|
|
78
78
|
"@arizeai/openinference-instrumentation-langchain": "^4.1.5",
|
|
79
79
|
"@arizeai/openinference-instrumentation-openai": "^4.4.3",
|
|
80
80
|
"@langchain/core": "^1.0.0",
|