raindrop-ai 0.0.71 → 0.0.72-otelv2

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.js CHANGED
@@ -128,7 +128,7 @@ var CategorizationRequestSchema = import_zod.z.object({
128
128
  // package.json
129
129
  var package_default = {
130
130
  name: "raindrop-ai",
131
- version: "0.0.71",
131
+ version: "0.0.72",
132
132
  main: "dist/index.js",
133
133
  module: "dist/index.mjs",
134
134
  types: "dist/index.d.ts",
package/dist/index.mjs CHANGED
@@ -104,7 +104,7 @@ var CategorizationRequestSchema = z.object({
104
104
  // package.json
105
105
  var package_default = {
106
106
  name: "raindrop-ai",
107
- version: "0.0.71",
107
+ version: "0.0.72",
108
108
  main: "dist/index.js",
109
109
  module: "dist/index.mjs",
110
110
  types: "dist/index.d.ts",
@@ -1,7 +1,33 @@
1
- declare function metadata({ userId, convoId, eventName, }: {
1
+ /**
2
+ * Creates metadata for use with the Vercel AI SDK's experimental_telemetry option.
3
+ * This metadata is propagated to all spans within the AI SDK call.
4
+ *
5
+ * @param userId - Required user identifier for the event
6
+ * @param convoId - Optional conversation identifier to group related events
7
+ * @param eventName - Optional custom event name (defaults to "ai_generation" on the backend)
8
+ * @param eventId - Optional event identifier. If not provided, a unique ID is generated.
9
+ * Call metadata() for each AI SDK call to get unique event IDs.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { generateText } from "ai";
14
+ * import { metadata } from "raindrop-ai/otel";
15
+ *
16
+ * const result = await generateText({
17
+ * model: openai("gpt-4"),
18
+ * prompt: "Hello!",
19
+ * experimental_telemetry: {
20
+ * isEnabled: true,
21
+ * metadata: metadata({ userId: "user-123", convoId: "convo-456" }),
22
+ * },
23
+ * });
24
+ * ```
25
+ */
26
+ declare function metadata({ userId, convoId, eventName, eventId, }: {
2
27
  userId: string;
3
28
  convoId?: string;
4
29
  eventName?: string;
30
+ eventId?: string;
5
31
  }): Record<string, string>;
6
32
  declare const _default: {
7
33
  metadata: typeof metadata;
@@ -1,7 +1,33 @@
1
- declare function metadata({ userId, convoId, eventName, }: {
1
+ /**
2
+ * Creates metadata for use with the Vercel AI SDK's experimental_telemetry option.
3
+ * This metadata is propagated to all spans within the AI SDK call.
4
+ *
5
+ * @param userId - Required user identifier for the event
6
+ * @param convoId - Optional conversation identifier to group related events
7
+ * @param eventName - Optional custom event name (defaults to "ai_generation" on the backend)
8
+ * @param eventId - Optional event identifier. If not provided, a unique ID is generated.
9
+ * Call metadata() for each AI SDK call to get unique event IDs.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { generateText } from "ai";
14
+ * import { metadata } from "raindrop-ai/otel";
15
+ *
16
+ * const result = await generateText({
17
+ * model: openai("gpt-4"),
18
+ * prompt: "Hello!",
19
+ * experimental_telemetry: {
20
+ * isEnabled: true,
21
+ * metadata: metadata({ userId: "user-123", convoId: "convo-456" }),
22
+ * },
23
+ * });
24
+ * ```
25
+ */
26
+ declare function metadata({ userId, convoId, eventName, eventId, }: {
2
27
  userId: string;
3
28
  convoId?: string;
4
29
  eventName?: string;
30
+ eventId?: string;
5
31
  }): Record<string, string>;
6
32
  declare const _default: {
7
33
  metadata: typeof metadata;
@@ -27,10 +27,12 @@ module.exports = __toCommonJS(otel_exports);
27
27
  function metadata({
28
28
  userId,
29
29
  convoId,
30
- eventName
30
+ eventName,
31
+ eventId
31
32
  }) {
32
33
  const result = {
33
- "raindrop.userId": userId
34
+ "raindrop.userId": userId,
35
+ "raindrop.eventId": eventId != null ? eventId : crypto.randomUUID()
34
36
  };
35
37
  if (convoId) result["raindrop.convoId"] = convoId;
36
38
  if (eventName) result["raindrop.eventName"] = eventName;
@@ -2,10 +2,12 @@
2
2
  function metadata({
3
3
  userId,
4
4
  convoId,
5
- eventName
5
+ eventName,
6
+ eventId
6
7
  }) {
7
8
  const result = {
8
- "raindrop.userId": userId
9
+ "raindrop.userId": userId,
10
+ "raindrop.eventId": eventId != null ? eventId : crypto.randomUUID()
9
11
  };
10
12
  if (convoId) result["raindrop.convoId"] = convoId;
11
13
  if (eventName) result["raindrop.eventName"] = eventName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "raindrop-ai",
3
- "version": "0.0.71",
3
+ "version": "0.0.72-otelv2",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  "zod": "^3.23.8"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@traceloop/node-server-sdk": "0.19.0-otel-v1"
53
+ "@traceloop/node-server-sdk": "0.22.2"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public",