@alpic80/rivet-ai-sdk-provider 2.0.4 → 2.0.6
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 +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +37 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +16 -5
package/dist/index.d.mts
CHANGED
|
@@ -3,6 +3,9 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
type RivetChatModelId = string;
|
|
6
|
+
type JSONValue = null | string | number | boolean | {
|
|
7
|
+
[key: string]: JSONValue;
|
|
8
|
+
} | JSONValue[];
|
|
6
9
|
declare const rivetLanguageModelOptions: z.ZodObject<{
|
|
7
10
|
runParams: z.ZodObject<{
|
|
8
11
|
openaiApiKey: z.ZodOptional<z.ZodString>;
|
|
@@ -53,6 +56,10 @@ declare const rivetLanguageModelOptions: z.ZodObject<{
|
|
|
53
56
|
pcm16: "pcm16";
|
|
54
57
|
}>>;
|
|
55
58
|
}, z.core.$strip>;
|
|
59
|
+
rivetInputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
60
|
+
type: z.ZodString;
|
|
61
|
+
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
62
|
+
}, z.core.$strip>>>;
|
|
56
63
|
}, z.core.$strip>;
|
|
57
64
|
type RivetLanguageModelOptions = z.infer<typeof rivetLanguageModelOptions>;
|
|
58
65
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
|
|
5
5
|
type RivetChatModelId = string;
|
|
6
|
+
type JSONValue = null | string | number | boolean | {
|
|
7
|
+
[key: string]: JSONValue;
|
|
8
|
+
} | JSONValue[];
|
|
6
9
|
declare const rivetLanguageModelOptions: z.ZodObject<{
|
|
7
10
|
runParams: z.ZodObject<{
|
|
8
11
|
openaiApiKey: z.ZodOptional<z.ZodString>;
|
|
@@ -53,6 +56,10 @@ declare const rivetLanguageModelOptions: z.ZodObject<{
|
|
|
53
56
|
pcm16: "pcm16";
|
|
54
57
|
}>>;
|
|
55
58
|
}, z.core.$strip>;
|
|
59
|
+
rivetInputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
60
|
+
type: z.ZodString;
|
|
61
|
+
value: z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>;
|
|
62
|
+
}, z.core.$strip>>>;
|
|
56
63
|
}, z.core.$strip>;
|
|
57
64
|
type RivetLanguageModelOptions = z.infer<typeof rivetLanguageModelOptions>;
|
|
58
65
|
|
package/dist/index.js
CHANGED
|
@@ -931,6 +931,16 @@ function mapRivetFinishReason(finishReason) {
|
|
|
931
931
|
|
|
932
932
|
// src/rivet-chat-options.ts
|
|
933
933
|
var import_v4 = require("zod/v4");
|
|
934
|
+
var jsonValue = import_v4.z.lazy(
|
|
935
|
+
() => import_v4.z.union([
|
|
936
|
+
import_v4.z.string(),
|
|
937
|
+
import_v4.z.number(),
|
|
938
|
+
import_v4.z.boolean(),
|
|
939
|
+
import_v4.z.null(),
|
|
940
|
+
import_v4.z.array(jsonValue),
|
|
941
|
+
import_v4.z.record(import_v4.z.string(), jsonValue)
|
|
942
|
+
])
|
|
943
|
+
);
|
|
934
944
|
var rivetRunParamsSchema = import_v4.z.object({
|
|
935
945
|
openaiApiKey: import_v4.z.string().optional(),
|
|
936
946
|
openaiEndpoint: import_v4.z.string().optional(),
|
|
@@ -942,6 +952,14 @@ var rivetRunParamsSchema = import_v4.z.object({
|
|
|
942
952
|
streamNode: import_v4.z.string().optional(),
|
|
943
953
|
events: import_v4.z.string().optional()
|
|
944
954
|
});
|
|
955
|
+
var graphInputSchema = import_v4.z.record(
|
|
956
|
+
import_v4.z.string(),
|
|
957
|
+
// key type
|
|
958
|
+
import_v4.z.object({
|
|
959
|
+
type: import_v4.z.string(),
|
|
960
|
+
value: jsonValue
|
|
961
|
+
})
|
|
962
|
+
).optional();
|
|
945
963
|
var standardChatConfigSchema = import_v4.z.object({
|
|
946
964
|
temperature: import_v4.z.number().optional(),
|
|
947
965
|
top_p: import_v4.z.number().optional(),
|
|
@@ -989,7 +1007,8 @@ var rivetCustomChatConfigSchema = import_v4.z.object({
|
|
|
989
1007
|
});
|
|
990
1008
|
var rivetLanguageModelOptions = import_v4.z.object({
|
|
991
1009
|
runParams: rivetRunParamsSchema,
|
|
992
|
-
chatConfig: rivetCustomChatConfigSchema
|
|
1010
|
+
chatConfig: rivetCustomChatConfigSchema,
|
|
1011
|
+
rivetInputs: graphInputSchema
|
|
993
1012
|
});
|
|
994
1013
|
var rivetChatConfigSchema = standardChatConfigSchema.merge(rivetCustomChatConfigSchema);
|
|
995
1014
|
var rivetToolOptions = import_v4.z.record(
|
|
@@ -1115,7 +1134,7 @@ prepare tools input:${printObject(tools)}`);
|
|
|
1115
1134
|
}
|
|
1116
1135
|
|
|
1117
1136
|
// src/version.ts
|
|
1118
|
-
var VERSION = true ? "2.0.
|
|
1137
|
+
var VERSION = true ? "2.0.6" : "0.0.0-test";
|
|
1119
1138
|
|
|
1120
1139
|
// src/post-to-api.ts
|
|
1121
1140
|
var getOriginalFetch = () => globalThis.fetch;
|
|
@@ -1323,11 +1342,12 @@ var RivetChatLanguageModel = class {
|
|
|
1323
1342
|
toolChoice
|
|
1324
1343
|
//in Rivet tool section
|
|
1325
1344
|
}) {
|
|
1326
|
-
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1345
|
+
var _a15, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1327
1346
|
const warnings = [];
|
|
1328
1347
|
const emptyOptions = {
|
|
1329
1348
|
runParams: {},
|
|
1330
|
-
chatConfig: {}
|
|
1349
|
+
chatConfig: {},
|
|
1350
|
+
rivetInputs: {}
|
|
1331
1351
|
};
|
|
1332
1352
|
debugLog(`providerOptions:${printObject(providerOptions)}`);
|
|
1333
1353
|
const options = (_a15 = await parseProviderOptions({
|
|
@@ -1344,15 +1364,16 @@ var RivetChatLanguageModel = class {
|
|
|
1344
1364
|
} = await prepareTools({ tools, toolChoice });
|
|
1345
1365
|
options.runParams = (_b = options.runParams) != null ? _b : {};
|
|
1346
1366
|
options.chatConfig = (_c = options.chatConfig) != null ? _c : {};
|
|
1367
|
+
options.rivetInputs = (_d = options.rivetInputs) != null ? _d : {};
|
|
1347
1368
|
const chatConfig = __spreadValues({}, options.chatConfig);
|
|
1348
|
-
chatConfig.maxTokens = (
|
|
1349
|
-
chatConfig.temperature = (
|
|
1350
|
-
chatConfig.top_p = (
|
|
1351
|
-
chatConfig.top_k = (
|
|
1352
|
-
chatConfig.stop_sequences = (
|
|
1353
|
-
chatConfig.frequencyPenalty = (
|
|
1354
|
-
chatConfig.presencePenalty = (
|
|
1355
|
-
chatConfig.seed = (
|
|
1369
|
+
chatConfig.maxTokens = (_e = chatConfig.maxTokens) != null ? _e : maxOutputTokens;
|
|
1370
|
+
chatConfig.temperature = (_f = chatConfig.temperature) != null ? _f : temperature;
|
|
1371
|
+
chatConfig.top_p = (_g = chatConfig.top_p) != null ? _g : topP;
|
|
1372
|
+
chatConfig.top_k = (_h = chatConfig.top_k) != null ? _h : topK;
|
|
1373
|
+
chatConfig.stop_sequences = (_i = chatConfig.stop_sequences) != null ? _i : stopSequences;
|
|
1374
|
+
chatConfig.frequencyPenalty = (_j = chatConfig.frequencyPenalty) != null ? _j : frequencyPenalty;
|
|
1375
|
+
chatConfig.presencePenalty = (_k = chatConfig.presencePenalty) != null ? _k : presencePenalty;
|
|
1376
|
+
chatConfig.seed = (_l = chatConfig.seed) != null ? _l : seed;
|
|
1356
1377
|
if (responseFormat) {
|
|
1357
1378
|
const isJson = (responseFormat == null ? void 0 : responseFormat.type) === "json";
|
|
1358
1379
|
const hasSchema = isJson && !!(responseFormat == null ? void 0 : responseFormat.schema);
|
|
@@ -1365,7 +1386,7 @@ var RivetChatLanguageModel = class {
|
|
|
1365
1386
|
}
|
|
1366
1387
|
const messages = convertToRivetChatMessages(prompt);
|
|
1367
1388
|
return {
|
|
1368
|
-
args: {
|
|
1389
|
+
args: __spreadValues({
|
|
1369
1390
|
chatConfig: {
|
|
1370
1391
|
type: "object",
|
|
1371
1392
|
value: chatConfig
|
|
@@ -1384,7 +1405,7 @@ var RivetChatLanguageModel = class {
|
|
|
1384
1405
|
value: rivetSchemas
|
|
1385
1406
|
},
|
|
1386
1407
|
runParams: __spreadValues({}, options.runParams)
|
|
1387
|
-
},
|
|
1408
|
+
}, (_m = options.rivetInputs) != null ? _m : {}),
|
|
1388
1409
|
warnings: [...warnings, ...toolWarnings]
|
|
1389
1410
|
};
|
|
1390
1411
|
}
|
|
@@ -1704,8 +1725,8 @@ var rivetChatResponseSchema = import_v43.z.object({
|
|
|
1704
1725
|
usage: rivetUsageSchema
|
|
1705
1726
|
});
|
|
1706
1727
|
var rivetChatResponseHandler = (id, model) => async ({
|
|
1707
|
-
url,
|
|
1708
|
-
requestBodyValues,
|
|
1728
|
+
url: _url,
|
|
1729
|
+
requestBodyValues: _requestBodyValues,
|
|
1709
1730
|
response
|
|
1710
1731
|
}) => {
|
|
1711
1732
|
const raw = await response.json();
|