@latitude-data/telemetry 1.0.1 → 1.0.2
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.cjs +28 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +28 -26
- package/dist/index.js +28 -45
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -35,37 +35,18 @@ declare class RedactSpanProcessor implements SpanProcessor {
|
|
|
35
35
|
}
|
|
36
36
|
declare const DEFAULT_REDACT_SPAN_PROCESSOR: () => RedactSpanProcessor;
|
|
37
37
|
|
|
38
|
-
declare const traceContextSchema: z.ZodObject<{
|
|
39
|
-
traceparent: z.ZodString;
|
|
40
|
-
tracestate: z.ZodOptional<z.ZodString>;
|
|
41
|
-
baggage: z.ZodOptional<z.ZodString>;
|
|
42
|
-
}, "strip", z.ZodTypeAny, {
|
|
43
|
-
traceparent: string;
|
|
44
|
-
tracestate?: string | undefined;
|
|
45
|
-
baggage?: string | undefined;
|
|
46
|
-
}, {
|
|
47
|
-
traceparent: string;
|
|
48
|
-
tracestate?: string | undefined;
|
|
49
|
-
baggage?: string | undefined;
|
|
50
|
-
}>;
|
|
51
|
-
type TraceContext = z.infer<typeof traceContextSchema>;
|
|
52
|
-
type TraceBaggage = {
|
|
53
|
-
segment: Pick<SegmentBaggage, 'id' | 'parentId'>;
|
|
54
|
-
segments: (SegmentBaggage & Pick<TraceContext, 'traceparent' | 'tracestate'> & {
|
|
55
|
-
paused?: boolean;
|
|
56
|
-
})[];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
38
|
declare enum SegmentSource {
|
|
60
39
|
API = "api",
|
|
61
|
-
|
|
40
|
+
AgentAsTool = "agent_as_tool",// TODO(tracing): deprecated, use SegmentType.Document with DocumentType.Agent instead
|
|
41
|
+
Copilot = "copilot",
|
|
42
|
+
EmailTrigger = "email_trigger",
|
|
62
43
|
Evaluation = "evaluation",// Note: from prompts of llm evaluations
|
|
63
44
|
Experiment = "experiment",
|
|
64
|
-
|
|
45
|
+
Playground = "playground",
|
|
46
|
+
ScheduledTrigger = "scheduled_trigger",
|
|
47
|
+
IntegrationTrigger = "integration_trigger",
|
|
65
48
|
SharedPrompt = "shared_prompt",
|
|
66
|
-
|
|
67
|
-
EmailTrigger = "email_trigger",
|
|
68
|
-
ScheduledTrigger = "scheduled_trigger"
|
|
49
|
+
User = "user"
|
|
69
50
|
}
|
|
70
51
|
declare enum SegmentType {
|
|
71
52
|
Document = "document",
|
|
@@ -144,6 +125,27 @@ type SegmentBaggage<T extends SegmentType = SegmentType> = Extract<z.infer<typeo
|
|
|
144
125
|
type: T;
|
|
145
126
|
}>;
|
|
146
127
|
|
|
128
|
+
declare const traceContextSchema: z.ZodObject<{
|
|
129
|
+
traceparent: z.ZodString;
|
|
130
|
+
tracestate: z.ZodOptional<z.ZodString>;
|
|
131
|
+
baggage: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, "strip", z.ZodTypeAny, {
|
|
133
|
+
traceparent: string;
|
|
134
|
+
tracestate?: string | undefined;
|
|
135
|
+
baggage?: string | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
traceparent: string;
|
|
138
|
+
tracestate?: string | undefined;
|
|
139
|
+
baggage?: string | undefined;
|
|
140
|
+
}>;
|
|
141
|
+
type TraceContext = z.infer<typeof traceContextSchema>;
|
|
142
|
+
type TraceBaggage = {
|
|
143
|
+
segment: Pick<SegmentBaggage, 'id' | 'parentId'>;
|
|
144
|
+
segments: (SegmentBaggage & Pick<TraceContext, 'traceparent' | 'tracestate'> & {
|
|
145
|
+
paused?: boolean;
|
|
146
|
+
})[];
|
|
147
|
+
};
|
|
148
|
+
|
|
147
149
|
type LatitudeInstrumentationOptions = {
|
|
148
150
|
module: typeof latitude.Latitude;
|
|
149
151
|
completions?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -121,14 +121,16 @@ const env = { GATEWAY_BASE_URL: GET_GATEWAY_BASE_URL() };
|
|
|
121
121
|
var SegmentSource;
|
|
122
122
|
(function (SegmentSource) {
|
|
123
123
|
SegmentSource["API"] = "api";
|
|
124
|
-
SegmentSource["Playground"] = "playground";
|
|
125
|
-
SegmentSource["Evaluation"] = "evaluation";
|
|
126
|
-
SegmentSource["Experiment"] = "experiment";
|
|
127
|
-
SegmentSource["User"] = "user";
|
|
128
|
-
SegmentSource["SharedPrompt"] = "shared_prompt";
|
|
129
124
|
SegmentSource["AgentAsTool"] = "agent_as_tool";
|
|
125
|
+
SegmentSource["Copilot"] = "copilot";
|
|
130
126
|
SegmentSource["EmailTrigger"] = "email_trigger";
|
|
127
|
+
SegmentSource["Evaluation"] = "evaluation";
|
|
128
|
+
SegmentSource["Experiment"] = "experiment";
|
|
129
|
+
SegmentSource["Playground"] = "playground";
|
|
131
130
|
SegmentSource["ScheduledTrigger"] = "scheduled_trigger";
|
|
131
|
+
SegmentSource["IntegrationTrigger"] = "integration_trigger";
|
|
132
|
+
SegmentSource["SharedPrompt"] = "shared_prompt";
|
|
133
|
+
SegmentSource["User"] = "user";
|
|
132
134
|
})(SegmentSource || (SegmentSource = {}));
|
|
133
135
|
var SegmentType;
|
|
134
136
|
(function (SegmentType) {
|
|
@@ -228,7 +230,7 @@ const SPAN_SPECIFICATIONS = {
|
|
|
228
230
|
name: 'Segment',
|
|
229
231
|
description: 'A (partial) segment of a trace',
|
|
230
232
|
isGenAI: false,
|
|
231
|
-
isHidden:
|
|
233
|
+
isHidden: false,
|
|
232
234
|
},
|
|
233
235
|
[SpanType.Unknown]: {
|
|
234
236
|
name: 'Unknown',
|
|
@@ -411,16 +413,6 @@ z.object({
|
|
|
411
413
|
isError: z.boolean().optional(),
|
|
412
414
|
text: z.string().optional(),
|
|
413
415
|
});
|
|
414
|
-
var FinishReason;
|
|
415
|
-
(function (FinishReason) {
|
|
416
|
-
FinishReason["Stop"] = "stop";
|
|
417
|
-
FinishReason["Length"] = "length";
|
|
418
|
-
FinishReason["ContentFilter"] = "content-filter";
|
|
419
|
-
FinishReason["ToolCalls"] = "tool-calls";
|
|
420
|
-
FinishReason["Error"] = "error";
|
|
421
|
-
FinishReason["Other"] = "other";
|
|
422
|
-
FinishReason["Unknown"] = "unknown";
|
|
423
|
-
})(FinishReason || (FinishReason = {}));
|
|
424
416
|
|
|
425
417
|
var ParameterType;
|
|
426
418
|
(function (ParameterType) {
|
|
@@ -758,17 +750,18 @@ var LegacyChainEventTypes;
|
|
|
758
750
|
|
|
759
751
|
var ChainEventTypes;
|
|
760
752
|
(function (ChainEventTypes) {
|
|
753
|
+
ChainEventTypes["ChainCompleted"] = "chain-completed";
|
|
754
|
+
ChainEventTypes["ChainError"] = "chain-error";
|
|
761
755
|
ChainEventTypes["ChainStarted"] = "chain-started";
|
|
762
|
-
ChainEventTypes["
|
|
763
|
-
ChainEventTypes["ProviderStarted"] = "provider-started";
|
|
756
|
+
ChainEventTypes["IntegrationWakingUp"] = "integration-waking-up";
|
|
764
757
|
ChainEventTypes["ProviderCompleted"] = "provider-completed";
|
|
765
|
-
ChainEventTypes["
|
|
766
|
-
ChainEventTypes["ToolCompleted"] = "tool-completed";
|
|
758
|
+
ChainEventTypes["ProviderStarted"] = "provider-started";
|
|
767
759
|
ChainEventTypes["StepCompleted"] = "step-completed";
|
|
768
|
-
ChainEventTypes["
|
|
769
|
-
ChainEventTypes["
|
|
760
|
+
ChainEventTypes["StepStarted"] = "step-started";
|
|
761
|
+
ChainEventTypes["ToolCompleted"] = "tool-completed";
|
|
770
762
|
ChainEventTypes["ToolsRequested"] = "tools-requested";
|
|
771
|
-
ChainEventTypes["
|
|
763
|
+
ChainEventTypes["ToolResult"] = "tool-result";
|
|
764
|
+
ChainEventTypes["ToolsStarted"] = "tools-started";
|
|
772
765
|
})(ChainEventTypes || (ChainEventTypes = {}));
|
|
773
766
|
|
|
774
767
|
var IntegrationType;
|
|
@@ -881,6 +874,14 @@ var EvaluationResultableType;
|
|
|
881
874
|
EvaluationResultableType["Number"] = "evaluation_resultable_numbers";
|
|
882
875
|
})(EvaluationResultableType || (EvaluationResultableType = {}));
|
|
883
876
|
|
|
877
|
+
var MessageRole;
|
|
878
|
+
(function (MessageRole) {
|
|
879
|
+
MessageRole["system"] = "system";
|
|
880
|
+
MessageRole["user"] = "user";
|
|
881
|
+
MessageRole["assistant"] = "assistant";
|
|
882
|
+
MessageRole["tool"] = "tool";
|
|
883
|
+
})(MessageRole || (MessageRole = {}));
|
|
884
|
+
|
|
884
885
|
var ModifiedDocumentType;
|
|
885
886
|
(function (ModifiedDocumentType) {
|
|
886
887
|
ModifiedDocumentType["Created"] = "created";
|
|
@@ -916,6 +917,7 @@ var DocumentTriggerType;
|
|
|
916
917
|
(function (DocumentTriggerType) {
|
|
917
918
|
DocumentTriggerType["Email"] = "email";
|
|
918
919
|
DocumentTriggerType["Scheduled"] = "scheduled";
|
|
920
|
+
DocumentTriggerType["Integration"] = "integration";
|
|
919
921
|
})(DocumentTriggerType || (DocumentTriggerType = {}));
|
|
920
922
|
var DocumentTriggerParameters;
|
|
921
923
|
(function (DocumentTriggerParameters) {
|
|
@@ -1587,11 +1589,11 @@ class LatitudeInstrumentation {
|
|
|
1587
1589
|
}
|
|
1588
1590
|
async wrapToolHandler(fn, ...args) {
|
|
1589
1591
|
const toolArguments = args[0];
|
|
1590
|
-
const {
|
|
1592
|
+
const { id, name } = args[1];
|
|
1591
1593
|
const $tool = this.telemetry.tool(context.active(), {
|
|
1592
|
-
name
|
|
1594
|
+
name,
|
|
1593
1595
|
call: {
|
|
1594
|
-
id
|
|
1596
|
+
id,
|
|
1595
1597
|
arguments: toolArguments,
|
|
1596
1598
|
},
|
|
1597
1599
|
});
|
|
@@ -1639,25 +1641,6 @@ class LatitudeInstrumentation {
|
|
|
1639
1641
|
$prompt.end();
|
|
1640
1642
|
return result;
|
|
1641
1643
|
}
|
|
1642
|
-
async wrapRenderAgent(fn, ...args) {
|
|
1643
|
-
const { prompt, parameters } = args[0];
|
|
1644
|
-
const $prompt = this.telemetry.prompt(context.active(), {
|
|
1645
|
-
versionUuid: prompt.versionUuid,
|
|
1646
|
-
promptUuid: prompt.uuid,
|
|
1647
|
-
template: prompt.content,
|
|
1648
|
-
parameters: parameters,
|
|
1649
|
-
});
|
|
1650
|
-
let result;
|
|
1651
|
-
try {
|
|
1652
|
-
result = await context.with($prompt.context, async () => await fn(...args));
|
|
1653
|
-
}
|
|
1654
|
-
catch (error) {
|
|
1655
|
-
$prompt.fail(error);
|
|
1656
|
-
throw error;
|
|
1657
|
-
}
|
|
1658
|
-
$prompt.end();
|
|
1659
|
-
return result;
|
|
1660
|
-
}
|
|
1661
1644
|
async wrapRenderStep(fn, ...args) {
|
|
1662
1645
|
const $step = this.telemetry.step(context.active());
|
|
1663
1646
|
let result;
|