tracia 0.3.8 → 0.3.10
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.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -11,6 +11,12 @@ interface RunOptions {
|
|
|
11
11
|
tags?: string[];
|
|
12
12
|
userId?: string;
|
|
13
13
|
sessionId?: string;
|
|
14
|
+
/** Trace ID to group related spans together */
|
|
15
|
+
traceId?: string;
|
|
16
|
+
/** Parent span ID for chaining spans in a sequence */
|
|
17
|
+
parentSpanId?: string;
|
|
18
|
+
/** Full conversation messages for multi-turn (skips template rendering) */
|
|
19
|
+
messages?: LocalPromptMessage[];
|
|
14
20
|
}
|
|
15
21
|
interface TokenUsage {
|
|
16
22
|
inputTokens: number;
|
|
@@ -27,6 +33,14 @@ interface RunResult {
|
|
|
27
33
|
latencyMs: number;
|
|
28
34
|
usage: TokenUsage;
|
|
29
35
|
cost: number;
|
|
36
|
+
/** Reason the model stopped generating */
|
|
37
|
+
finishReason?: FinishReason;
|
|
38
|
+
/** Tool calls made by the model */
|
|
39
|
+
toolCalls?: ToolCall[];
|
|
40
|
+
/** Parsed JSON when the prompt has an output schema configured */
|
|
41
|
+
structuredOutput?: Record<string, unknown>;
|
|
42
|
+
/** Full conversation messages for multi-turn continuation */
|
|
43
|
+
messages?: LocalPromptMessage[];
|
|
30
44
|
}
|
|
31
45
|
declare enum TraciaErrorCode {
|
|
32
46
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
@@ -57,6 +71,10 @@ interface ApiSuccessResponse {
|
|
|
57
71
|
latencyMs: number;
|
|
58
72
|
usage: TokenUsage;
|
|
59
73
|
cost: number;
|
|
74
|
+
finishReason?: FinishReason;
|
|
75
|
+
toolCalls?: ToolCall[];
|
|
76
|
+
structuredOutput?: Record<string, unknown>;
|
|
77
|
+
messages?: LocalPromptMessage[];
|
|
60
78
|
}
|
|
61
79
|
type MessageRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool';
|
|
62
80
|
interface PromptMessage {
|
|
@@ -103,7 +121,7 @@ type SpanStatus = 'SUCCESS' | 'ERROR';
|
|
|
103
121
|
interface SpanListItem {
|
|
104
122
|
id: string;
|
|
105
123
|
spanId: string;
|
|
106
|
-
traceId: string;
|
|
124
|
+
traceId: string | null;
|
|
107
125
|
parentSpanId: string | null;
|
|
108
126
|
promptSlug: string;
|
|
109
127
|
model: string;
|
|
@@ -118,7 +136,7 @@ interface SpanListItem {
|
|
|
118
136
|
interface Span {
|
|
119
137
|
id: string;
|
|
120
138
|
spanId: string;
|
|
121
|
-
traceId: string;
|
|
139
|
+
traceId: string | null;
|
|
122
140
|
parentSpanId: string | null;
|
|
123
141
|
promptSlug: string;
|
|
124
142
|
promptVersion: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,12 @@ interface RunOptions {
|
|
|
11
11
|
tags?: string[];
|
|
12
12
|
userId?: string;
|
|
13
13
|
sessionId?: string;
|
|
14
|
+
/** Trace ID to group related spans together */
|
|
15
|
+
traceId?: string;
|
|
16
|
+
/** Parent span ID for chaining spans in a sequence */
|
|
17
|
+
parentSpanId?: string;
|
|
18
|
+
/** Full conversation messages for multi-turn (skips template rendering) */
|
|
19
|
+
messages?: LocalPromptMessage[];
|
|
14
20
|
}
|
|
15
21
|
interface TokenUsage {
|
|
16
22
|
inputTokens: number;
|
|
@@ -27,6 +33,14 @@ interface RunResult {
|
|
|
27
33
|
latencyMs: number;
|
|
28
34
|
usage: TokenUsage;
|
|
29
35
|
cost: number;
|
|
36
|
+
/** Reason the model stopped generating */
|
|
37
|
+
finishReason?: FinishReason;
|
|
38
|
+
/** Tool calls made by the model */
|
|
39
|
+
toolCalls?: ToolCall[];
|
|
40
|
+
/** Parsed JSON when the prompt has an output schema configured */
|
|
41
|
+
structuredOutput?: Record<string, unknown>;
|
|
42
|
+
/** Full conversation messages for multi-turn continuation */
|
|
43
|
+
messages?: LocalPromptMessage[];
|
|
30
44
|
}
|
|
31
45
|
declare enum TraciaErrorCode {
|
|
32
46
|
UNAUTHORIZED = "UNAUTHORIZED",
|
|
@@ -57,6 +71,10 @@ interface ApiSuccessResponse {
|
|
|
57
71
|
latencyMs: number;
|
|
58
72
|
usage: TokenUsage;
|
|
59
73
|
cost: number;
|
|
74
|
+
finishReason?: FinishReason;
|
|
75
|
+
toolCalls?: ToolCall[];
|
|
76
|
+
structuredOutput?: Record<string, unknown>;
|
|
77
|
+
messages?: LocalPromptMessage[];
|
|
60
78
|
}
|
|
61
79
|
type MessageRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool';
|
|
62
80
|
interface PromptMessage {
|
|
@@ -103,7 +121,7 @@ type SpanStatus = 'SUCCESS' | 'ERROR';
|
|
|
103
121
|
interface SpanListItem {
|
|
104
122
|
id: string;
|
|
105
123
|
spanId: string;
|
|
106
|
-
traceId: string;
|
|
124
|
+
traceId: string | null;
|
|
107
125
|
parentSpanId: string | null;
|
|
108
126
|
promptSlug: string;
|
|
109
127
|
model: string;
|
|
@@ -118,7 +136,7 @@ interface SpanListItem {
|
|
|
118
136
|
interface Span {
|
|
119
137
|
id: string;
|
|
120
138
|
spanId: string;
|
|
121
|
-
traceId: string;
|
|
139
|
+
traceId: string | null;
|
|
122
140
|
parentSpanId: string | null;
|
|
123
141
|
promptSlug: string;
|
|
124
142
|
promptVersion: number;
|
package/dist/index.js
CHANGED
|
@@ -76,7 +76,7 @@ var LLMProvider = /* @__PURE__ */ ((LLMProvider2) => {
|
|
|
76
76
|
})(LLMProvider || {});
|
|
77
77
|
|
|
78
78
|
// src/client.ts
|
|
79
|
-
var SDK_VERSION = "0.3.
|
|
79
|
+
var SDK_VERSION = "0.3.10";
|
|
80
80
|
var DEFAULT_TIMEOUT_MS = 12e4;
|
|
81
81
|
function mapApiErrorCodeToTraciaErrorCode(apiCode) {
|
|
82
82
|
const codeMap = {
|
|
@@ -210,6 +210,15 @@ var Prompts = class {
|
|
|
210
210
|
if (options?.sessionId) {
|
|
211
211
|
requestBody.sessionId = options.sessionId;
|
|
212
212
|
}
|
|
213
|
+
if (options?.traceId) {
|
|
214
|
+
requestBody.traceId = options.traceId;
|
|
215
|
+
}
|
|
216
|
+
if (options?.parentSpanId) {
|
|
217
|
+
requestBody.parentSpanId = options.parentSpanId;
|
|
218
|
+
}
|
|
219
|
+
if (options?.messages && options.messages.length > 0) {
|
|
220
|
+
requestBody.messages = options.messages;
|
|
221
|
+
}
|
|
213
222
|
const response = await this.client.post(
|
|
214
223
|
`/api/v1/prompts/${encodeURIComponent(slug)}/run`,
|
|
215
224
|
requestBody
|
|
@@ -221,7 +230,11 @@ var Prompts = class {
|
|
|
221
230
|
promptVersion: response.promptVersion,
|
|
222
231
|
latencyMs: response.latencyMs,
|
|
223
232
|
usage: response.usage,
|
|
224
|
-
cost: response.cost
|
|
233
|
+
cost: response.cost,
|
|
234
|
+
finishReason: response.finishReason,
|
|
235
|
+
toolCalls: response.toolCalls,
|
|
236
|
+
structuredOutput: response.structuredOutput,
|
|
237
|
+
messages: response.messages
|
|
225
238
|
};
|
|
226
239
|
}
|
|
227
240
|
};
|