objectiveai 1.2.4 → 1.2.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.cjs +174 -130
- package/dist/index.d.ts +26180 -7085
- package/dist/index.js +173 -129
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Auth = exports.
|
|
6
|
+
exports.Auth = exports.InlineFunctionSchema = exports.InlineVectorFunctionSchema = exports.InlineScalarFunctionSchema = exports.RemoteFunctionSchema = exports.RemoteVectorFunctionSchema = exports.RemoteScalarFunctionSchema = exports.Function = exports.Vector = exports.Chat = exports.Ensemble = exports.EnsembleSchema = exports.EnsembleBaseSchema = exports.EnsembleLlmWithFallbacksAndCountSchema = exports.EnsembleLlmSchema = exports.EnsembleLlmBaseWithFallbacksAndCountSchema = exports.EnsembleLlmBaseSchema = exports.EnsembleLlm = exports.VectorResponsesExpressionSchema = exports.VectorResponsesSchema = exports.VectorResponseExpressionSchema = exports.VectorResponseSchema = exports.ToolsExpressionSchema = exports.ToolsSchema = exports.ToolExpressionSchema = exports.ToolSchema = exports.Tool = exports.MessagesExpressionSchema = exports.MessagesSchema = exports.MessageExpressionSchema = exports.MessageSchema = exports.Message = exports.ObjectiveAIErrorSchema = exports.JsonValueExpressionSchema = exports.JsonValueSchema = exports.ExpressionSchema = void 0;
|
|
7
7
|
const zod_1 = __importDefault(require("zod"));
|
|
8
8
|
// Expressions
|
|
9
9
|
exports.ExpressionSchema = zod_1.default
|
|
@@ -2107,60 +2107,56 @@ var Vector;
|
|
|
2107
2107
|
// Function
|
|
2108
2108
|
var Function;
|
|
2109
2109
|
(function (Function_1) {
|
|
2110
|
-
Function_1.
|
|
2110
|
+
Function_1.VectorCompletionTaskProfileSchema = zod_1.default
|
|
2111
2111
|
.object({
|
|
2112
2112
|
ensemble: Vector.Completions.Request.EnsembleSchema,
|
|
2113
2113
|
profile: Vector.Completions.Request.ProfileSchema,
|
|
2114
2114
|
})
|
|
2115
|
-
.describe("A vector completion profile containing an Ensemble and array of weights.");
|
|
2116
|
-
Function_1.
|
|
2117
|
-
.
|
|
2118
|
-
zod_1.default
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
.describe("
|
|
2135
|
-
Function_1.
|
|
2115
|
+
.describe("A vector completion profile for a vector completion task containing an Ensemble and array of weights.");
|
|
2116
|
+
Function_1.RemoteFunctionTaskProfileSchema = zod_1.default
|
|
2117
|
+
.object({
|
|
2118
|
+
owner: zod_1.default
|
|
2119
|
+
.string()
|
|
2120
|
+
.describe("The owner of the GitHub repository containing the profile."),
|
|
2121
|
+
repository: zod_1.default
|
|
2122
|
+
.string()
|
|
2123
|
+
.describe("The name of the GitHub repository containing the profile."),
|
|
2124
|
+
commit: zod_1.default
|
|
2125
|
+
.string()
|
|
2126
|
+
.describe("The commit SHA of the GitHub repository containing the profile."),
|
|
2127
|
+
})
|
|
2128
|
+
.describe("The identifiers for a function profile hosted in a GitHub repository.");
|
|
2129
|
+
Function_1.InlineFunctionTaskProfileSchema = zod_1.default
|
|
2130
|
+
.lazy(() => zod_1.default.array(Function_1.TaskProfileSchema).meta({
|
|
2131
|
+
title: "TaskProfileArray",
|
|
2132
|
+
recursive: true,
|
|
2133
|
+
}))
|
|
2134
|
+
.describe("An function profile for a function task defined inline.");
|
|
2135
|
+
Function_1.TaskProfileSchema = zod_1.default
|
|
2136
2136
|
.union([
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
.describe("The owner of the GitHub repository containing the profile."),
|
|
2141
|
-
repository: zod_1.default
|
|
2142
|
-
.string()
|
|
2143
|
-
.describe("The name of the GitHub repository containing the profile."),
|
|
2144
|
-
commit: zod_1.default
|
|
2145
|
-
.string()
|
|
2146
|
-
.describe("The commit SHA of the GitHub repository containing the profile.")
|
|
2147
|
-
.nullable()
|
|
2148
|
-
.optional(),
|
|
2149
|
-
}),
|
|
2150
|
-
zod_1.default
|
|
2151
|
-
.lazy(() => zod_1.default.array(Function_1.ProfileCommitOptionalSchema))
|
|
2152
|
-
.meta({
|
|
2153
|
-
title: "ProfileCommitOptionalArray",
|
|
2154
|
-
recursive: true,
|
|
2155
|
-
}),
|
|
2137
|
+
Function_1.VectorCompletionTaskProfileSchema,
|
|
2138
|
+
Function_1.RemoteFunctionTaskProfileSchema,
|
|
2139
|
+
Function_1.InlineFunctionTaskProfileSchema,
|
|
2156
2140
|
])
|
|
2157
|
-
.describe("A
|
|
2158
|
-
Function_1.
|
|
2159
|
-
.
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2141
|
+
.describe("A profile for a function task.");
|
|
2142
|
+
Function_1.InlineProfileSchema = zod_1.default
|
|
2143
|
+
.object({
|
|
2144
|
+
tasks: zod_1.default
|
|
2145
|
+
.array(Function_1.TaskProfileSchema)
|
|
2146
|
+
.describe("The list of task profiles defined inline."),
|
|
2147
|
+
})
|
|
2148
|
+
.describe("A function profile defined inline.");
|
|
2149
|
+
Function_1.RemoteProfileSchema = zod_1.default
|
|
2150
|
+
.object({
|
|
2151
|
+
description: zod_1.default.string().describe("The description of the profile."),
|
|
2152
|
+
changelog: zod_1.default
|
|
2153
|
+
.string()
|
|
2154
|
+
.optional()
|
|
2155
|
+
.nullable()
|
|
2156
|
+
.describe("When present, describes changes from the previous version or versions."),
|
|
2157
|
+
tasks: zod_1.default.array(Function_1.TaskProfileSchema).describe("The list of task profiles."),
|
|
2158
|
+
})
|
|
2159
|
+
.describe("A function profile fetched from GitHub.");
|
|
2164
2160
|
Function_1.InputSchemaSchema = zod_1.default.lazy(() => zod_1.default
|
|
2165
2161
|
.union([
|
|
2166
2162
|
InputSchema.ObjectSchema,
|
|
@@ -2432,48 +2428,6 @@ var Function;
|
|
|
2432
2428
|
Function_1.TaskExpressionsSchema = zod_1.default
|
|
2433
2429
|
.array(Function_1.TaskExpressionSchema)
|
|
2434
2430
|
.describe("The list of tasks to be executed as part of the function.");
|
|
2435
|
-
Function_1.ScalarSchema = zod_1.default
|
|
2436
|
-
.object({
|
|
2437
|
-
type: zod_1.default.literal("scalar.function"),
|
|
2438
|
-
description: zod_1.default
|
|
2439
|
-
.string()
|
|
2440
|
-
.describe("The description of the scalar function."),
|
|
2441
|
-
changelog: zod_1.default
|
|
2442
|
-
.string()
|
|
2443
|
-
.optional()
|
|
2444
|
-
.nullable()
|
|
2445
|
-
.describe("When present, describes changes from the previous version or versions."),
|
|
2446
|
-
input_schema: Function_1.InputSchemaSchema,
|
|
2447
|
-
input_maps: Function_1.InputMapsExpressionSchema.optional().nullable(),
|
|
2448
|
-
tasks: Function_1.TaskExpressionsSchema,
|
|
2449
|
-
output: exports.ExpressionSchema.describe("An expression which evaluates to a single number. This is the output of the scalar function. Will be provided with the outputs of all tasks."),
|
|
2450
|
-
})
|
|
2451
|
-
.describe("A scalar function.")
|
|
2452
|
-
.meta({ title: "ScalarFunction" });
|
|
2453
|
-
Function_1.VectorSchema = zod_1.default
|
|
2454
|
-
.object({
|
|
2455
|
-
type: zod_1.default.literal("vector.function"),
|
|
2456
|
-
description: zod_1.default
|
|
2457
|
-
.string()
|
|
2458
|
-
.describe("The description of the vector function."),
|
|
2459
|
-
changelog: zod_1.default
|
|
2460
|
-
.string()
|
|
2461
|
-
.optional()
|
|
2462
|
-
.nullable()
|
|
2463
|
-
.describe("When present, describes changes from the previous version or versions."),
|
|
2464
|
-
input_schema: Function_1.InputSchemaSchema,
|
|
2465
|
-
input_maps: Function_1.InputMapsExpressionSchema.optional().nullable(),
|
|
2466
|
-
tasks: Function_1.TaskExpressionsSchema,
|
|
2467
|
-
output: exports.ExpressionSchema.describe("An expressions which evaluates to an array of numbers. This is the output of the vector function. Will be provided with the outputs of all tasks."),
|
|
2468
|
-
output_length: zod_1.default
|
|
2469
|
-
.union([
|
|
2470
|
-
zod_1.default.uint32().describe("The fixed length of the output vector."),
|
|
2471
|
-
exports.ExpressionSchema.describe("An expression which evaluates to the length of the output vector. Will only be provided with the function input. The output length must be determinable from the input alone."),
|
|
2472
|
-
])
|
|
2473
|
-
.describe("The length of the output vector."),
|
|
2474
|
-
})
|
|
2475
|
-
.describe("A vector function.")
|
|
2476
|
-
.meta({ title: "VectorFunction" });
|
|
2477
2431
|
let Executions;
|
|
2478
2432
|
(function (Executions) {
|
|
2479
2433
|
let Request;
|
|
@@ -2529,7 +2483,7 @@ var Function;
|
|
|
2529
2483
|
.meta({ title: "FunctionExecutionParamsRemoteFunctionRemoteProfile" });
|
|
2530
2484
|
// Remote Function Inline Profile
|
|
2531
2485
|
Request.FunctionExecutionParamsRemoteFunctionInlineProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
|
|
2532
|
-
profile: Function_1.
|
|
2486
|
+
profile: Function_1.InlineProfileSchema,
|
|
2533
2487
|
}).describe("Base parameters for executing a remote function with an inline profile.");
|
|
2534
2488
|
Request.FunctionExecutionParamsRemoteFunctionInlineProfileStreamingSchema = Request.FunctionExecutionParamsRemoteFunctionInlineProfileBaseSchema.extend({
|
|
2535
2489
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
@@ -2554,7 +2508,7 @@ var Function;
|
|
|
2554
2508
|
.meta({ title: "FunctionExecutionParamsRemoteFunctionInlineProfile" });
|
|
2555
2509
|
// Inline Function Remote Profile
|
|
2556
2510
|
Request.FunctionExecutionParamsInlineFunctionRemoteProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
|
|
2557
|
-
function: zod_1.default.lazy(() => exports.
|
|
2511
|
+
function: zod_1.default.lazy(() => exports.InlineFunctionSchema),
|
|
2558
2512
|
}).describe("Base parameters for executing an inline function with a remote profile.");
|
|
2559
2513
|
Request.FunctionExecutionParamsInlineFunctionRemoteProfileStreamingSchema = Request.FunctionExecutionParamsInlineFunctionRemoteProfileBaseSchema.extend({
|
|
2560
2514
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
@@ -2579,8 +2533,8 @@ var Function;
|
|
|
2579
2533
|
.meta({ title: "FunctionExecutionParamsInlineFunctionRemoteProfile" });
|
|
2580
2534
|
// Inline Function Inline Profile
|
|
2581
2535
|
Request.FunctionExecutionParamsInlineFunctionInlineProfileBaseSchema = Request.FunctionExecutionParamsRemoteFunctionRemoteProfileBaseSchema.extend({
|
|
2582
|
-
function: zod_1.default.lazy(() => exports.
|
|
2583
|
-
profile: Function_1.
|
|
2536
|
+
function: zod_1.default.lazy(() => exports.InlineFunctionSchema),
|
|
2537
|
+
profile: Function_1.InlineProfileSchema,
|
|
2584
2538
|
}).describe("Base parameters for executing an inline function with an inline profile.");
|
|
2585
2539
|
Request.FunctionExecutionParamsInlineFunctionInlineProfileStreamingSchema = Request.FunctionExecutionParamsInlineFunctionInlineProfileBaseSchema.extend({
|
|
2586
2540
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
@@ -2749,7 +2703,7 @@ var Function;
|
|
|
2749
2703
|
const id = a.id;
|
|
2750
2704
|
const [tasks, tasksChanged] = TaskChunk.mergedList(a.tasks, b.tasks);
|
|
2751
2705
|
const [tasks_errors, tasks_errorsChanged] = merge(a.tasks_errors, b.tasks_errors);
|
|
2752
|
-
const [reasoning, reasoningChanged] = merge(a.reasoning, b.reasoning);
|
|
2706
|
+
const [reasoning, reasoningChanged] = merge(a.reasoning, b.reasoning, ReasoningSummaryChunk.merged);
|
|
2753
2707
|
const [output, outputChanged] = merge(a.output, b.output);
|
|
2754
2708
|
const [error, errorChanged] = merge(a.error, b.error);
|
|
2755
2709
|
const [retry_token, retry_tokenChanged] = merge(a.retry_token, b.retry_token);
|
|
@@ -2949,7 +2903,8 @@ var Function;
|
|
|
2949
2903
|
target: DatasetItem.TargetSchema,
|
|
2950
2904
|
})
|
|
2951
2905
|
.describe("A Function input and its corresponding target output.");
|
|
2952
|
-
|
|
2906
|
+
// Remote Function
|
|
2907
|
+
Request.FunctionComputeProfileParamsRemoteFunctionBaseSchema = zod_1.default
|
|
2953
2908
|
.object({
|
|
2954
2909
|
retry_token: zod_1.default
|
|
2955
2910
|
.string()
|
|
@@ -2974,24 +2929,49 @@ var Function;
|
|
|
2974
2929
|
first_chunk_timeout: Chat.Completions.Request.FirstChunkTimeoutSchema.optional().nullable(),
|
|
2975
2930
|
other_chunk_timeout: Chat.Completions.Request.OtherChunkTimeoutSchema.optional().nullable(),
|
|
2976
2931
|
})
|
|
2977
|
-
.describe("Base parameters for computing a function profile.");
|
|
2978
|
-
Request.
|
|
2932
|
+
.describe("Base parameters for computing a function profile for a remote function.");
|
|
2933
|
+
Request.FunctionComputeProfileParamsRemoteFunctionStreamingSchema = Request.FunctionComputeProfileParamsRemoteFunctionBaseSchema.extend({
|
|
2979
2934
|
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2980
2935
|
})
|
|
2981
|
-
.describe("Parameters for computing a function profile and streaming the response.")
|
|
2936
|
+
.describe("Parameters for computing a function profile for a remote function and streaming the response.")
|
|
2982
2937
|
.meta({ title: "FunctionComputeProfileParamsStreaming" });
|
|
2983
|
-
Request.
|
|
2938
|
+
Request.FunctionComputeProfileParamsRemoteFunctionNonStreamingSchema = Request.FunctionComputeProfileParamsRemoteFunctionBaseSchema.extend({
|
|
2984
2939
|
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2985
2940
|
})
|
|
2986
|
-
.describe("Parameters for computing a function profile with a unary response.")
|
|
2941
|
+
.describe("Parameters for computing a function profile for a remote function with a unary response.")
|
|
2987
2942
|
.meta({ title: "FunctionComputeProfileParamsNonStreaming" });
|
|
2988
|
-
Request.
|
|
2943
|
+
Request.FunctionComputeProfileParamsRemoteFunctionSchema = zod_1.default
|
|
2989
2944
|
.union([
|
|
2990
|
-
Request.
|
|
2991
|
-
Request.
|
|
2945
|
+
Request.FunctionComputeProfileParamsRemoteFunctionStreamingSchema,
|
|
2946
|
+
Request.FunctionComputeProfileParamsRemoteFunctionNonStreamingSchema,
|
|
2992
2947
|
])
|
|
2993
|
-
.describe("Parameters for computing a function profile.")
|
|
2948
|
+
.describe("Parameters for computing a function profile for a remote function.")
|
|
2994
2949
|
.meta({ title: "FunctionComputeProfileParams" });
|
|
2950
|
+
// Inline Function
|
|
2951
|
+
Request.FunctionComputeProfileParamsInlineFunctionBaseSchema = Request.FunctionComputeProfileParamsRemoteFunctionBaseSchema.extend({
|
|
2952
|
+
function: zod_1.default.lazy(() => exports.InlineFunctionSchema),
|
|
2953
|
+
}).describe("Base parameters for computing a function profile for an inline function.");
|
|
2954
|
+
Request.FunctionComputeProfileParamsInlineFunctionStreamingSchema = Request.FunctionComputeProfileParamsInlineFunctionBaseSchema.extend({
|
|
2955
|
+
stream: Chat.Completions.Request.StreamTrueSchema,
|
|
2956
|
+
})
|
|
2957
|
+
.describe("Parameters for computing a function profile for an inline function and streaming the response.")
|
|
2958
|
+
.meta({
|
|
2959
|
+
title: "FunctionComputeProfileParamsInlineFunctionStreaming",
|
|
2960
|
+
});
|
|
2961
|
+
Request.FunctionComputeProfileParamsInlineFunctionNonStreamingSchema = Request.FunctionComputeProfileParamsInlineFunctionBaseSchema.extend({
|
|
2962
|
+
stream: Chat.Completions.Request.StreamFalseSchema.optional().nullable(),
|
|
2963
|
+
})
|
|
2964
|
+
.describe("Parameters for computing a function profile for an inline function with a unary response.")
|
|
2965
|
+
.meta({
|
|
2966
|
+
title: "FunctionComputeProfileParamsInlineFunctionNonStreaming",
|
|
2967
|
+
});
|
|
2968
|
+
Request.FunctionComputeProfileParamsInlineFunctionSchema = zod_1.default
|
|
2969
|
+
.union([
|
|
2970
|
+
Request.FunctionComputeProfileParamsInlineFunctionStreamingSchema,
|
|
2971
|
+
Request.FunctionComputeProfileParamsInlineFunctionNonStreamingSchema,
|
|
2972
|
+
])
|
|
2973
|
+
.describe("Parameters for computing a function profile for an inline function.")
|
|
2974
|
+
.meta({ title: "FunctionComputeProfileParamsInlineFunction" });
|
|
2995
2975
|
})(Request = ComputeProfile.Request || (ComputeProfile.Request = {}));
|
|
2996
2976
|
let Response;
|
|
2997
2977
|
(function (Response) {
|
|
@@ -3121,10 +3101,7 @@ var Function;
|
|
|
3121
3101
|
.boolean()
|
|
3122
3102
|
.optional()
|
|
3123
3103
|
.describe("When true, indicates that one or more function executions encountered errors during profile computation."),
|
|
3124
|
-
profile:
|
|
3125
|
-
.array(Function_1.ProfileCommitRequiredSchema)
|
|
3126
|
-
.optional()
|
|
3127
|
-
.describe("The computed function profile."),
|
|
3104
|
+
profile: Function_1.InlineProfileSchema.optional(),
|
|
3128
3105
|
fitting_stats: Response.FittingStatsSchema.optional(),
|
|
3129
3106
|
created: zod_1.default
|
|
3130
3107
|
.uint32()
|
|
@@ -3164,9 +3141,7 @@ var Function;
|
|
|
3164
3141
|
executions_errors: zod_1.default
|
|
3165
3142
|
.boolean()
|
|
3166
3143
|
.describe("When true, indicates that one or more function executions encountered errors during profile computation."),
|
|
3167
|
-
profile:
|
|
3168
|
-
.array(Function_1.ProfileCommitRequiredSchema)
|
|
3169
|
-
.describe("The computed function profile."),
|
|
3144
|
+
profile: Function_1.InlineProfileSchema,
|
|
3170
3145
|
fitting_stats: Response.FittingStatsSchema,
|
|
3171
3146
|
created: zod_1.default
|
|
3172
3147
|
.uint32()
|
|
@@ -3285,13 +3260,30 @@ var Function;
|
|
|
3285
3260
|
}
|
|
3286
3261
|
}
|
|
3287
3262
|
Function_1.execute = execute;
|
|
3288
|
-
async function
|
|
3263
|
+
async function computeProfileInlineFunction(openai, body, options) {
|
|
3264
|
+
var _a;
|
|
3265
|
+
const response = await openai.post("/functions/profiles/compute", Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
|
|
3266
|
+
return response;
|
|
3267
|
+
}
|
|
3268
|
+
Function_1.computeProfileInlineFunction = computeProfileInlineFunction;
|
|
3269
|
+
async function computeProfileRemoteFunction(openai, fowner, frepository, fcommit, body, options) {
|
|
3289
3270
|
var _a;
|
|
3290
3271
|
const response = await openai.post(fcommit !== null && fcommit !== undefined
|
|
3291
3272
|
? `/functions/${fowner}/${frepository}/${fcommit}/profiles/compute`
|
|
3292
3273
|
: `/functions/${fowner}/${frepository}/profiles/compute`, Object.assign({ body, stream: (_a = body.stream) !== null && _a !== void 0 ? _a : false }, options));
|
|
3293
3274
|
return response;
|
|
3294
3275
|
}
|
|
3276
|
+
Function_1.computeProfileRemoteFunction = computeProfileRemoteFunction;
|
|
3277
|
+
async function computeProfile(openai, function_, body, options) {
|
|
3278
|
+
if ("owner" in function_ && "repository" in function_) {
|
|
3279
|
+
const requestBody = body;
|
|
3280
|
+
return computeProfileRemoteFunction(openai, function_.owner, function_.repository, function_.commit, requestBody, options);
|
|
3281
|
+
}
|
|
3282
|
+
else {
|
|
3283
|
+
const requestBody = Object.assign(Object.assign({}, body), { function: function_ });
|
|
3284
|
+
return computeProfileInlineFunction(openai, requestBody, options);
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3295
3287
|
Function_1.computeProfile = computeProfile;
|
|
3296
3288
|
Function_1.ListItemSchema = zod_1.default.object({
|
|
3297
3289
|
owner: zod_1.default
|
|
@@ -3331,9 +3323,74 @@ var Function;
|
|
|
3331
3323
|
}
|
|
3332
3324
|
Function_1.retrieveUsage = retrieveUsage;
|
|
3333
3325
|
})(Function || (exports.Function = Function = {}));
|
|
3334
|
-
exports.
|
|
3335
|
-
.
|
|
3336
|
-
.
|
|
3326
|
+
exports.RemoteScalarFunctionSchema = zod_1.default
|
|
3327
|
+
.object({
|
|
3328
|
+
type: zod_1.default.literal("scalar.function"),
|
|
3329
|
+
description: zod_1.default.string().describe("The description of the scalar function."),
|
|
3330
|
+
changelog: zod_1.default
|
|
3331
|
+
.string()
|
|
3332
|
+
.optional()
|
|
3333
|
+
.nullable()
|
|
3334
|
+
.describe("When present, describes changes from the previous version or versions."),
|
|
3335
|
+
input_schema: Function.InputSchemaSchema,
|
|
3336
|
+
input_maps: Function.InputMapsExpressionSchema.optional().nullable(),
|
|
3337
|
+
tasks: Function.TaskExpressionsSchema,
|
|
3338
|
+
output: exports.ExpressionSchema.describe("An expression which evaluates to a single number. This is the output of the scalar function. Will be provided with the outputs of all tasks."),
|
|
3339
|
+
})
|
|
3340
|
+
.describe("A scalar function fetched from GitHub.")
|
|
3341
|
+
.meta({ title: "RemoteScalarFunction" });
|
|
3342
|
+
exports.RemoteVectorFunctionSchema = zod_1.default
|
|
3343
|
+
.object({
|
|
3344
|
+
type: zod_1.default.literal("vector.function"),
|
|
3345
|
+
description: zod_1.default.string().describe("The description of the vector function."),
|
|
3346
|
+
changelog: zod_1.default
|
|
3347
|
+
.string()
|
|
3348
|
+
.optional()
|
|
3349
|
+
.nullable()
|
|
3350
|
+
.describe("When present, describes changes from the previous version or versions."),
|
|
3351
|
+
input_schema: Function.InputSchemaSchema,
|
|
3352
|
+
input_maps: Function.InputMapsExpressionSchema.optional().nullable(),
|
|
3353
|
+
tasks: Function.TaskExpressionsSchema,
|
|
3354
|
+
output: exports.ExpressionSchema.describe("An expression which evaluates to an array of numbers. This is the output of the vector function. Will be provided with the outputs of all tasks."),
|
|
3355
|
+
output_length: zod_1.default
|
|
3356
|
+
.union([
|
|
3357
|
+
zod_1.default.uint32().describe("The fixed length of the output vector."),
|
|
3358
|
+
exports.ExpressionSchema.describe("An expression which evaluates to the length of the output vector. Will only be provided with the function input. The output length must be determinable from the input alone."),
|
|
3359
|
+
])
|
|
3360
|
+
.describe("The length of the output vector."),
|
|
3361
|
+
})
|
|
3362
|
+
.describe("A vector function fetched from GitHub.")
|
|
3363
|
+
.meta({ title: "RemoteVectorFunction" });
|
|
3364
|
+
exports.RemoteFunctionSchema = zod_1.default
|
|
3365
|
+
.discriminatedUnion("type", [
|
|
3366
|
+
exports.RemoteScalarFunctionSchema,
|
|
3367
|
+
exports.RemoteVectorFunctionSchema,
|
|
3368
|
+
])
|
|
3369
|
+
.describe("A remote function fetched from GitHub.");
|
|
3370
|
+
exports.InlineScalarFunctionSchema = zod_1.default
|
|
3371
|
+
.object({
|
|
3372
|
+
type: zod_1.default.literal("scalar.function"),
|
|
3373
|
+
input_maps: Function.InputMapsExpressionSchema.optional().nullable(),
|
|
3374
|
+
tasks: Function.TaskExpressionsSchema,
|
|
3375
|
+
output: exports.ExpressionSchema.describe("An expression which evaluates to a single number. This is the output of the scalar function. Will be provided with the outputs of all tasks."),
|
|
3376
|
+
})
|
|
3377
|
+
.describe("A scalar function defined inline.")
|
|
3378
|
+
.meta({ title: "InlineScalarFunction" });
|
|
3379
|
+
exports.InlineVectorFunctionSchema = zod_1.default
|
|
3380
|
+
.object({
|
|
3381
|
+
type: zod_1.default.literal("vector.function"),
|
|
3382
|
+
input_maps: Function.InputMapsExpressionSchema.optional().nullable(),
|
|
3383
|
+
tasks: Function.TaskExpressionsSchema,
|
|
3384
|
+
output: exports.ExpressionSchema.describe("An expression which evaluates to an array of numbers. This is the output of the vector function. Will be provided with the outputs of all tasks."),
|
|
3385
|
+
})
|
|
3386
|
+
.describe("A vector function defined inline.")
|
|
3387
|
+
.meta({ title: "InlineVectorFunction" });
|
|
3388
|
+
exports.InlineFunctionSchema = zod_1.default
|
|
3389
|
+
.discriminatedUnion("type", [
|
|
3390
|
+
exports.InlineScalarFunctionSchema,
|
|
3391
|
+
exports.InlineVectorFunctionSchema,
|
|
3392
|
+
])
|
|
3393
|
+
.describe("A function defined inline.");
|
|
3337
3394
|
var Auth;
|
|
3338
3395
|
(function (Auth) {
|
|
3339
3396
|
Auth.ApiKeySchema = zod_1.default.object({
|
|
@@ -3424,19 +3481,6 @@ var Auth;
|
|
|
3424
3481
|
}
|
|
3425
3482
|
Credits.retrieve = retrieve;
|
|
3426
3483
|
})(Credits = Auth.Credits || (Auth.Credits = {}));
|
|
3427
|
-
let Username;
|
|
3428
|
-
(function (Username) {
|
|
3429
|
-
async function retrieve(openai, options) {
|
|
3430
|
-
const response = await openai.get("/auth/username", options);
|
|
3431
|
-
return response;
|
|
3432
|
-
}
|
|
3433
|
-
Username.retrieve = retrieve;
|
|
3434
|
-
async function set(openai, username, options) {
|
|
3435
|
-
const response = await openai.post("/auth/username", Object.assign({ body: { username } }, options));
|
|
3436
|
-
return response;
|
|
3437
|
-
}
|
|
3438
|
-
Username.set = set;
|
|
3439
|
-
})(Username = Auth.Username || (Auth.Username = {}));
|
|
3440
3484
|
})(Auth || (exports.Auth = Auth = {}));
|
|
3441
3485
|
function merge(a, b, combine) {
|
|
3442
3486
|
if (a !== null && a !== undefined && b !== null && b !== undefined) {
|