@sentrial/sdk 0.4.2 → 0.4.4
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 +391 -291
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +391 -291
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1120,7 +1120,13 @@ type GenerateTextParams = {
|
|
|
1120
1120
|
temperature?: number;
|
|
1121
1121
|
[key: string]: unknown;
|
|
1122
1122
|
};
|
|
1123
|
+
/**
|
|
1124
|
+
* Usage info — supports both AI SDK v3/v4 (promptTokens/completionTokens)
|
|
1125
|
+
* and v5/v6 (inputTokens/outputTokens) field names.
|
|
1126
|
+
*/
|
|
1123
1127
|
type UsageInfo = {
|
|
1128
|
+
inputTokens?: number;
|
|
1129
|
+
outputTokens?: number;
|
|
1124
1130
|
promptTokens?: number;
|
|
1125
1131
|
completionTokens?: number;
|
|
1126
1132
|
totalTokens?: number;
|
|
@@ -1181,11 +1187,13 @@ type StreamTextResult = {
|
|
|
1181
1187
|
}>;
|
|
1182
1188
|
[key: string]: unknown;
|
|
1183
1189
|
};
|
|
1190
|
+
/** String or function that returns a string (for dynamic per-request values) */
|
|
1191
|
+
type StringOrFn = string | (() => string | undefined);
|
|
1184
1192
|
/** Per-instance config passed through closures (not global) */
|
|
1185
1193
|
type WrapperConfig = {
|
|
1186
1194
|
defaultAgent?: string;
|
|
1187
|
-
userId?:
|
|
1188
|
-
convoId?:
|
|
1195
|
+
userId?: StringOrFn;
|
|
1196
|
+
convoId?: StringOrFn;
|
|
1189
1197
|
};
|
|
1190
1198
|
/**
|
|
1191
1199
|
* Configure the Sentrial SDK for Vercel AI SDK integration.
|
|
@@ -1205,8 +1213,8 @@ declare function configureVercel(config: {
|
|
|
1205
1213
|
apiKey?: string;
|
|
1206
1214
|
apiUrl?: string;
|
|
1207
1215
|
defaultAgent?: string;
|
|
1208
|
-
userId?:
|
|
1209
|
-
convoId?:
|
|
1216
|
+
userId?: StringOrFn;
|
|
1217
|
+
convoId?: StringOrFn;
|
|
1210
1218
|
failSilently?: boolean;
|
|
1211
1219
|
}): void;
|
|
1212
1220
|
declare function wrapGenerateText(originalFn: Function, client: SentrialClient, config: WrapperConfig): (params: GenerateTextParams) => Promise<GenerateTextResult>;
|
|
@@ -1240,8 +1248,8 @@ declare function wrapStreamObject(originalFn: Function, client: SentrialClient,
|
|
|
1240
1248
|
declare function wrapAISDK(ai: AIModule, options?: {
|
|
1241
1249
|
client?: SentrialClient;
|
|
1242
1250
|
defaultAgent?: string;
|
|
1243
|
-
userId?:
|
|
1244
|
-
convoId?:
|
|
1251
|
+
userId?: StringOrFn;
|
|
1252
|
+
convoId?: StringOrFn;
|
|
1245
1253
|
}): {
|
|
1246
1254
|
generateText: ReturnType<typeof wrapGenerateText>;
|
|
1247
1255
|
streamText: ReturnType<typeof wrapStreamText>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1120,7 +1120,13 @@ type GenerateTextParams = {
|
|
|
1120
1120
|
temperature?: number;
|
|
1121
1121
|
[key: string]: unknown;
|
|
1122
1122
|
};
|
|
1123
|
+
/**
|
|
1124
|
+
* Usage info — supports both AI SDK v3/v4 (promptTokens/completionTokens)
|
|
1125
|
+
* and v5/v6 (inputTokens/outputTokens) field names.
|
|
1126
|
+
*/
|
|
1123
1127
|
type UsageInfo = {
|
|
1128
|
+
inputTokens?: number;
|
|
1129
|
+
outputTokens?: number;
|
|
1124
1130
|
promptTokens?: number;
|
|
1125
1131
|
completionTokens?: number;
|
|
1126
1132
|
totalTokens?: number;
|
|
@@ -1181,11 +1187,13 @@ type StreamTextResult = {
|
|
|
1181
1187
|
}>;
|
|
1182
1188
|
[key: string]: unknown;
|
|
1183
1189
|
};
|
|
1190
|
+
/** String or function that returns a string (for dynamic per-request values) */
|
|
1191
|
+
type StringOrFn = string | (() => string | undefined);
|
|
1184
1192
|
/** Per-instance config passed through closures (not global) */
|
|
1185
1193
|
type WrapperConfig = {
|
|
1186
1194
|
defaultAgent?: string;
|
|
1187
|
-
userId?:
|
|
1188
|
-
convoId?:
|
|
1195
|
+
userId?: StringOrFn;
|
|
1196
|
+
convoId?: StringOrFn;
|
|
1189
1197
|
};
|
|
1190
1198
|
/**
|
|
1191
1199
|
* Configure the Sentrial SDK for Vercel AI SDK integration.
|
|
@@ -1205,8 +1213,8 @@ declare function configureVercel(config: {
|
|
|
1205
1213
|
apiKey?: string;
|
|
1206
1214
|
apiUrl?: string;
|
|
1207
1215
|
defaultAgent?: string;
|
|
1208
|
-
userId?:
|
|
1209
|
-
convoId?:
|
|
1216
|
+
userId?: StringOrFn;
|
|
1217
|
+
convoId?: StringOrFn;
|
|
1210
1218
|
failSilently?: boolean;
|
|
1211
1219
|
}): void;
|
|
1212
1220
|
declare function wrapGenerateText(originalFn: Function, client: SentrialClient, config: WrapperConfig): (params: GenerateTextParams) => Promise<GenerateTextResult>;
|
|
@@ -1240,8 +1248,8 @@ declare function wrapStreamObject(originalFn: Function, client: SentrialClient,
|
|
|
1240
1248
|
declare function wrapAISDK(ai: AIModule, options?: {
|
|
1241
1249
|
client?: SentrialClient;
|
|
1242
1250
|
defaultAgent?: string;
|
|
1243
|
-
userId?:
|
|
1244
|
-
convoId?:
|
|
1251
|
+
userId?: StringOrFn;
|
|
1252
|
+
convoId?: StringOrFn;
|
|
1245
1253
|
}): {
|
|
1246
1254
|
generateText: ReturnType<typeof wrapGenerateText>;
|
|
1247
1255
|
streamText: ReturnType<typeof wrapStreamText>;
|