@openrouter/sdk 0.3.14 → 0.3.15
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/esm/funcs/analyticsGetUserActivity.d.ts +1 -1
- package/esm/funcs/analyticsGetUserActivity.js +1 -1
- package/esm/funcs/apiKeysCreate.d.ts +3 -0
- package/esm/funcs/apiKeysCreate.js +3 -0
- package/esm/funcs/apiKeysDelete.d.ts +3 -0
- package/esm/funcs/apiKeysDelete.js +3 -0
- package/esm/funcs/apiKeysGet.d.ts +3 -0
- package/esm/funcs/apiKeysGet.js +3 -0
- package/esm/funcs/apiKeysList.d.ts +3 -0
- package/esm/funcs/apiKeysList.js +3 -0
- package/esm/funcs/apiKeysUpdate.d.ts +3 -0
- package/esm/funcs/apiKeysUpdate.js +3 -0
- package/esm/funcs/call-model.js +9 -6
- package/esm/funcs/creditsGetCredits.d.ts +1 -1
- package/esm/funcs/creditsGetCredits.js +1 -1
- package/esm/funcs/guardrailsBulkAssignKeys.d.ts +18 -0
- package/esm/funcs/guardrailsBulkAssignKeys.js +89 -0
- package/esm/funcs/guardrailsBulkAssignMembers.d.ts +18 -0
- package/esm/funcs/guardrailsBulkAssignMembers.js +89 -0
- package/esm/funcs/guardrailsBulkUnassignKeys.d.ts +18 -0
- package/esm/funcs/guardrailsBulkUnassignKeys.js +89 -0
- package/esm/funcs/guardrailsBulkUnassignMembers.d.ts +18 -0
- package/esm/funcs/guardrailsBulkUnassignMembers.js +89 -0
- package/esm/funcs/guardrailsCreate.d.ts +18 -0
- package/esm/funcs/guardrailsCreate.js +83 -0
- package/esm/funcs/guardrailsDelete.d.ts +18 -0
- package/esm/funcs/guardrailsDelete.js +88 -0
- package/esm/funcs/{parametersGetParameters.d.ts → guardrailsGet.d.ts} +6 -3
- package/esm/funcs/guardrailsGet.js +88 -0
- package/esm/funcs/guardrailsList.d.ts +18 -0
- package/esm/funcs/guardrailsList.js +87 -0
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListGuardrailKeyAssignments.js +93 -0
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListGuardrailMemberAssignments.js +93 -0
- package/esm/funcs/guardrailsListKeyAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListKeyAssignments.js +87 -0
- package/esm/funcs/guardrailsListMemberAssignments.d.ts +18 -0
- package/esm/funcs/guardrailsListMemberAssignments.js +87 -0
- package/esm/funcs/guardrailsUpdate.d.ts +18 -0
- package/esm/funcs/{parametersGetParameters.js → guardrailsUpdate.js} +24 -32
- package/esm/index.d.ts +4 -3
- package/esm/index.js +3 -1
- package/esm/lib/async-params.d.ts +46 -6
- package/esm/lib/async-params.js +10 -2
- package/esm/lib/config.d.ts +2 -4
- package/esm/lib/config.js +2 -2
- package/esm/lib/conversation-state.d.ts +61 -0
- package/esm/lib/conversation-state.js +207 -0
- package/esm/lib/model-result.d.ts +175 -2
- package/esm/lib/model-result.js +678 -181
- package/esm/lib/tool-types.d.ts +108 -0
- package/esm/lib/tool-types.js +13 -0
- package/esm/lib/tool.d.ts +21 -1
- package/esm/lib/tool.js +7 -0
- package/esm/models/assistantmessage.d.ts +31 -0
- package/esm/models/assistantmessage.js +43 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +8 -8
- package/esm/models/chatmessagecontentitemimage.js +8 -9
- package/esm/models/chatresponsechoice.d.ts +0 -2
- package/esm/models/chatresponsechoice.js +0 -3
- package/esm/models/chatstreamingmessagechunk.d.ts +2 -2
- package/esm/models/chatstreamingmessagechunk.js +2 -2
- package/esm/models/index.d.ts +1 -1
- package/esm/models/index.js +1 -1
- package/esm/models/model.d.ts +4 -0
- package/esm/models/model.js +2 -0
- package/esm/models/operations/bulkassignkeystoguardrail.d.ts +44 -0
- package/esm/models/operations/bulkassignkeystoguardrail.js +42 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.d.ts +44 -0
- package/esm/models/operations/bulkassignmemberstoguardrail.js +42 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.d.ts +44 -0
- package/esm/models/operations/bulkunassignkeysfromguardrail.js +42 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.d.ts +44 -0
- package/esm/models/operations/bulkunassignmembersfromguardrail.js +42 -0
- package/esm/models/operations/createguardrail.d.ts +136 -0
- package/esm/models/operations/createguardrail.js +85 -0
- package/esm/models/operations/deleteguardrail.d.ts +29 -0
- package/esm/models/operations/deleteguardrail.js +21 -0
- package/esm/models/operations/getguardrail.d.ts +92 -0
- package/esm/models/operations/getguardrail.js +60 -0
- package/esm/models/operations/getmodels.d.ts +28 -1
- package/esm/models/operations/getmodels.js +22 -1
- package/esm/models/operations/index.d.ts +13 -1
- package/esm/models/operations/index.js +13 -1
- package/esm/models/operations/listguardrailkeyassignments.d.ts +76 -0
- package/esm/models/operations/listguardrailkeyassignments.js +51 -0
- package/esm/models/operations/listguardrailmemberassignments.d.ts +72 -0
- package/esm/models/operations/listguardrailmemberassignments.js +49 -0
- package/esm/models/operations/listguardrails.d.ts +98 -0
- package/esm/models/operations/listguardrails.js +66 -0
- package/esm/models/operations/listkeyassignments.d.ts +71 -0
- package/esm/models/operations/listkeyassignments.js +50 -0
- package/esm/models/operations/listmemberassignments.d.ts +67 -0
- package/esm/models/operations/listmemberassignments.js +48 -0
- package/esm/models/operations/updateguardrail.d.ts +151 -0
- package/esm/models/operations/updateguardrail.js +97 -0
- package/esm/models/percentilelatencycutoffs.js +1 -1
- package/esm/models/percentilestats.js +1 -1
- package/esm/models/percentilethroughputcutoffs.js +1 -1
- package/esm/models/preferredmaxlatency.js +1 -1
- package/esm/models/preferredminthroughput.js +1 -1
- package/esm/models/responseinputvideo.js +1 -1
- package/esm/models/responsesoutputmodality.js +1 -1
- package/esm/models/schema2.d.ts +92 -0
- package/esm/models/schema2.js +109 -0
- package/esm/sdk/analytics.d.ts +1 -1
- package/esm/sdk/analytics.js +1 -1
- package/esm/sdk/apikeys.d.ts +15 -0
- package/esm/sdk/apikeys.js +15 -0
- package/esm/sdk/credits.d.ts +1 -1
- package/esm/sdk/credits.js +1 -1
- package/esm/sdk/guardrails.d.ts +96 -0
- package/esm/sdk/guardrails.js +139 -0
- package/esm/sdk/sdk.d.ts +3 -3
- package/esm/sdk/sdk.js +4 -4
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +1 -0
- package/esm/types/models.d.ts +25 -0
- package/esm/types/models.js +10 -0
- package/jsr.json +1 -1
- package/package.json +12 -10
- package/scripts/check-types.js +127 -0
- package/esm/models/operations/getparameters.d.ts +0 -87
- package/esm/models/operations/getparameters.js +0 -73
- package/esm/models/schema3.d.ts +0 -51
- package/esm/models/schema3.js +0 -62
- package/esm/sdk/parameters.d.ts +0 -9
- package/esm/sdk/parameters.js +0 -16
package/esm/lib/tool-types.d.ts
CHANGED
|
@@ -50,6 +50,12 @@ export type NextTurnParamsContext = {
|
|
|
50
50
|
export type NextTurnParamsFunctions<TInput> = {
|
|
51
51
|
[K in keyof NextTurnParamsContext]?: (params: TInput, context: NextTurnParamsContext) => NextTurnParamsContext[K] | Promise<NextTurnParamsContext[K]>;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Tool-level approval check function type
|
|
55
|
+
* Receives the tool's input params and turn context
|
|
56
|
+
* Returns true if approval is required, false otherwise
|
|
57
|
+
*/
|
|
58
|
+
export type ToolApprovalCheck<TInput> = (params: TInput, context: TurnContext) => boolean | Promise<boolean>;
|
|
53
59
|
/**
|
|
54
60
|
* Base tool function interface with inputSchema
|
|
55
61
|
*/
|
|
@@ -58,6 +64,11 @@ export interface BaseToolFunction<TInput extends $ZodObject<$ZodShape>> {
|
|
|
58
64
|
description?: string;
|
|
59
65
|
inputSchema: TInput;
|
|
60
66
|
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
67
|
+
/**
|
|
68
|
+
* Whether this tool requires human approval before execution
|
|
69
|
+
* Can be a boolean or an async function that receives the tool's input params and context
|
|
70
|
+
*/
|
|
71
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
61
72
|
}
|
|
62
73
|
/**
|
|
63
74
|
* Regular tool with synchronous or asynchronous execute function and optional outputSchema
|
|
@@ -331,4 +342,101 @@ export type ChatStreamEvent<TEvent = unknown> = {
|
|
|
331
342
|
type: string;
|
|
332
343
|
event: OpenResponsesStreamEvent;
|
|
333
344
|
};
|
|
345
|
+
/**
|
|
346
|
+
* Result of a tool execution that hasn't been sent to the model yet
|
|
347
|
+
* Used for interrupted or awaiting approval states
|
|
348
|
+
* @template TTools - The tools array type for proper type inference
|
|
349
|
+
*/
|
|
350
|
+
export interface UnsentToolResult<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
351
|
+
/** The ID of the tool call this result is for */
|
|
352
|
+
callId: string;
|
|
353
|
+
/** The name of the tool that was executed */
|
|
354
|
+
name: TTools[number]['function']['name'];
|
|
355
|
+
/** The output of the tool execution */
|
|
356
|
+
output: unknown;
|
|
357
|
+
/** Error message if the tool call was rejected or failed */
|
|
358
|
+
error?: string;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* Partial response captured during interruption
|
|
362
|
+
* @template TTools - The tools array type for proper type inference
|
|
363
|
+
*/
|
|
364
|
+
export interface PartialResponse<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
365
|
+
/** Partial text response accumulated before interruption */
|
|
366
|
+
text?: string;
|
|
367
|
+
/** Tool calls that were in progress when interrupted */
|
|
368
|
+
toolCalls?: Array<ParsedToolCall<TTools[number]>>;
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Status of a conversation state
|
|
372
|
+
*/
|
|
373
|
+
export type ConversationStatus = 'complete' | 'interrupted' | 'awaiting_approval' | 'in_progress';
|
|
374
|
+
/**
|
|
375
|
+
* State for multi-turn conversations with persistence and approval gates
|
|
376
|
+
* @template TTools - The tools array type for proper type inference
|
|
377
|
+
*/
|
|
378
|
+
export interface ConversationState<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
379
|
+
/** Unique identifier for this conversation */
|
|
380
|
+
id: string;
|
|
381
|
+
/** Full message history */
|
|
382
|
+
messages: models.OpenResponsesInput;
|
|
383
|
+
/** Previous response ID for chaining (OpenRouter server-side optimization) */
|
|
384
|
+
previousResponseId?: string;
|
|
385
|
+
/** Tool calls awaiting human approval */
|
|
386
|
+
pendingToolCalls?: Array<ParsedToolCall<TTools[number]>>;
|
|
387
|
+
/** Tool results executed but not yet sent to the model */
|
|
388
|
+
unsentToolResults?: Array<UnsentToolResult<TTools>>;
|
|
389
|
+
/** Partial response data captured during interruption */
|
|
390
|
+
partialResponse?: PartialResponse<TTools>;
|
|
391
|
+
/** Signal from a new request to interrupt this conversation */
|
|
392
|
+
interruptedBy?: string;
|
|
393
|
+
/** Current status of the conversation */
|
|
394
|
+
status: ConversationStatus;
|
|
395
|
+
/** Creation timestamp (Unix ms) */
|
|
396
|
+
createdAt: number;
|
|
397
|
+
/** Last update timestamp (Unix ms) */
|
|
398
|
+
updatedAt: number;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* State accessor for loading and saving conversation state
|
|
402
|
+
* Enables any storage backend (memory, Redis, database, etc.)
|
|
403
|
+
* @template TTools - The tools array type for proper type inference
|
|
404
|
+
*/
|
|
405
|
+
export interface StateAccessor<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
406
|
+
/** Load the current conversation state, or null if none exists */
|
|
407
|
+
load: () => Promise<ConversationState<TTools> | null>;
|
|
408
|
+
/** Save the conversation state */
|
|
409
|
+
save: (state: ConversationState<TTools>) => Promise<void>;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Check if a single tool has approval configured (non-false, non-undefined)
|
|
413
|
+
* Returns true if the tool definitely requires approval,
|
|
414
|
+
* false if it definitely doesn't, or boolean if it's uncertain
|
|
415
|
+
*/
|
|
416
|
+
export type ToolHasApproval<T extends Tool> = T extends {
|
|
417
|
+
function: {
|
|
418
|
+
requireApproval: true | ToolApprovalCheck<unknown>;
|
|
419
|
+
};
|
|
420
|
+
} ? true : T extends {
|
|
421
|
+
function: {
|
|
422
|
+
requireApproval: false;
|
|
423
|
+
};
|
|
424
|
+
} ? false : T extends {
|
|
425
|
+
function: {
|
|
426
|
+
requireApproval: undefined;
|
|
427
|
+
};
|
|
428
|
+
} ? false : boolean;
|
|
429
|
+
/**
|
|
430
|
+
* Check if ANY tool in an array has approval configured
|
|
431
|
+
* Returns true if at least one tool might require approval
|
|
432
|
+
*/
|
|
433
|
+
export type HasApprovalTools<TTools extends readonly Tool[]> = TTools extends readonly [infer First extends Tool, ...infer Rest extends Tool[]] ? ToolHasApproval<First> extends true ? true : HasApprovalTools<Rest> : false;
|
|
434
|
+
/**
|
|
435
|
+
* Type guard to check if a tool has approval configured at runtime
|
|
436
|
+
*/
|
|
437
|
+
export declare function toolHasApprovalConfigured(tool: Tool): boolean;
|
|
438
|
+
/**
|
|
439
|
+
* Type guard to check if any tools in array have approval configured at runtime
|
|
440
|
+
*/
|
|
441
|
+
export declare function hasApprovalRequiredTools(tools: readonly Tool[]): boolean;
|
|
334
442
|
//# sourceMappingURL=tool-types.d.ts.map
|
package/esm/lib/tool-types.js
CHANGED
|
@@ -35,4 +35,17 @@ export function isManualTool(tool) {
|
|
|
35
35
|
export function isToolPreliminaryResultEvent(event) {
|
|
36
36
|
return event.type === 'tool.preliminary_result';
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Type guard to check if a tool has approval configured at runtime
|
|
40
|
+
*/
|
|
41
|
+
export function toolHasApprovalConfigured(tool) {
|
|
42
|
+
const requireApproval = tool.function.requireApproval;
|
|
43
|
+
return requireApproval === true || typeof requireApproval === 'function';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Type guard to check if any tools in array have approval configured at runtime
|
|
47
|
+
*/
|
|
48
|
+
export function hasApprovalRequiredTools(tools) {
|
|
49
|
+
return tools.some(toolHasApprovalConfigured);
|
|
50
|
+
}
|
|
38
51
|
//# sourceMappingURL=tool-types.js.map
|
package/esm/lib/tool.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { $ZodObject, $ZodShape, $ZodType, infer as zodInfer } from 'zod/v4/core';
|
|
2
|
-
import { type TurnContext, type ToolWithExecute, type ToolWithGenerator, type ManualTool, type NextTurnParamsFunctions } from "./tool-types.js";
|
|
2
|
+
import { type TurnContext, type ToolWithExecute, type ToolWithGenerator, type ManualTool, type NextTurnParamsFunctions, type ToolApprovalCheck } from "./tool-types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Configuration for a regular tool with outputSchema
|
|
5
5
|
*/
|
|
@@ -10,6 +10,11 @@ type RegularToolConfigWithOutput<TInput extends $ZodObject<$ZodShape>, TOutput e
|
|
|
10
10
|
outputSchema: TOutput;
|
|
11
11
|
eventSchema?: undefined;
|
|
12
12
|
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
13
|
+
/**
|
|
14
|
+
* Whether this tool requires human approval before execution
|
|
15
|
+
* Can be a boolean or an async function that receives the tool's input params and context
|
|
16
|
+
*/
|
|
17
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
13
18
|
execute: (params: zodInfer<TInput>, context?: TurnContext) => Promise<zodInfer<TOutput>> | zodInfer<TOutput>;
|
|
14
19
|
};
|
|
15
20
|
/**
|
|
@@ -22,6 +27,11 @@ type RegularToolConfigWithoutOutput<TInput extends $ZodObject<$ZodShape>, TRetur
|
|
|
22
27
|
outputSchema?: undefined;
|
|
23
28
|
eventSchema?: undefined;
|
|
24
29
|
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
30
|
+
/**
|
|
31
|
+
* Whether this tool requires human approval before execution
|
|
32
|
+
* Can be a boolean or an async function that receives the tool's input params and context
|
|
33
|
+
*/
|
|
34
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
25
35
|
execute: (params: zodInfer<TInput>, context?: TurnContext) => Promise<TReturn> | TReturn;
|
|
26
36
|
};
|
|
27
37
|
/**
|
|
@@ -34,6 +44,11 @@ type GeneratorToolConfig<TInput extends $ZodObject<$ZodShape>, TEvent extends $Z
|
|
|
34
44
|
eventSchema: TEvent;
|
|
35
45
|
outputSchema: TOutput;
|
|
36
46
|
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
47
|
+
/**
|
|
48
|
+
* Whether this tool requires human approval before execution
|
|
49
|
+
* Can be a boolean or an async function that receives the tool's input params and context
|
|
50
|
+
*/
|
|
51
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
37
52
|
execute: (params: zodInfer<TInput>, context?: TurnContext) => AsyncGenerator<zodInfer<TEvent> | zodInfer<TOutput>>;
|
|
38
53
|
};
|
|
39
54
|
/**
|
|
@@ -44,6 +59,11 @@ type ManualToolConfig<TInput extends $ZodObject<$ZodShape>> = {
|
|
|
44
59
|
description?: string;
|
|
45
60
|
inputSchema: TInput;
|
|
46
61
|
nextTurnParams?: NextTurnParamsFunctions<zodInfer<TInput>>;
|
|
62
|
+
/**
|
|
63
|
+
* Whether this tool requires human approval before execution
|
|
64
|
+
* Can be a boolean or an async function that receives the tool's input params and context
|
|
65
|
+
*/
|
|
66
|
+
requireApproval?: boolean | ToolApprovalCheck<zodInfer<TInput>>;
|
|
47
67
|
execute: false;
|
|
48
68
|
};
|
|
49
69
|
/**
|
package/esm/lib/tool.js
CHANGED
|
@@ -25,6 +25,9 @@ export function tool(config) {
|
|
|
25
25
|
if (config.nextTurnParams !== undefined) {
|
|
26
26
|
fn.nextTurnParams = config.nextTurnParams;
|
|
27
27
|
}
|
|
28
|
+
if (config.requireApproval !== undefined) {
|
|
29
|
+
fn.requireApproval = config.requireApproval;
|
|
30
|
+
}
|
|
28
31
|
return {
|
|
29
32
|
type: ToolType.Function,
|
|
30
33
|
function: fn,
|
|
@@ -46,6 +49,9 @@ export function tool(config) {
|
|
|
46
49
|
if (config.nextTurnParams !== undefined) {
|
|
47
50
|
fn.nextTurnParams = config.nextTurnParams;
|
|
48
51
|
}
|
|
52
|
+
if (config.requireApproval !== undefined) {
|
|
53
|
+
fn.requireApproval = config.requireApproval;
|
|
54
|
+
}
|
|
49
55
|
return {
|
|
50
56
|
type: ToolType.Function,
|
|
51
57
|
function: fn,
|
|
@@ -61,6 +67,7 @@ export function tool(config) {
|
|
|
61
67
|
...(config.description !== undefined && { description: config.description }),
|
|
62
68
|
...(config.outputSchema !== undefined && { outputSchema: config.outputSchema }),
|
|
63
69
|
...(config.nextTurnParams !== undefined && { nextTurnParams: config.nextTurnParams }),
|
|
70
|
+
...(config.requireApproval !== undefined && { requireApproval: config.requireApproval }),
|
|
64
71
|
};
|
|
65
72
|
// The function signature guarantees this is type-safe via overloads
|
|
66
73
|
return {
|
|
@@ -3,7 +3,14 @@ import { Result as SafeParseResult } from "../types/fp.js";
|
|
|
3
3
|
import { ChatMessageContentItem, ChatMessageContentItem$Outbound } from "./chatmessagecontentitem.js";
|
|
4
4
|
import { ChatMessageToolCall, ChatMessageToolCall$Outbound } from "./chatmessagetoolcall.js";
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
+
import { Schema2, Schema2$Outbound } from "./schema2.js";
|
|
6
7
|
export type AssistantMessageContent = string | Array<ChatMessageContentItem>;
|
|
8
|
+
export type AssistantMessageImageUrl = {
|
|
9
|
+
url: string;
|
|
10
|
+
};
|
|
11
|
+
export type Image = {
|
|
12
|
+
imageUrl: AssistantMessageImageUrl;
|
|
13
|
+
};
|
|
7
14
|
export type AssistantMessage = {
|
|
8
15
|
role: "assistant";
|
|
9
16
|
content?: string | Array<ChatMessageContentItem> | null | undefined;
|
|
@@ -11,6 +18,8 @@ export type AssistantMessage = {
|
|
|
11
18
|
toolCalls?: Array<ChatMessageToolCall> | undefined;
|
|
12
19
|
refusal?: string | null | undefined;
|
|
13
20
|
reasoning?: string | null | undefined;
|
|
21
|
+
reasoningDetails?: Array<Schema2> | undefined;
|
|
22
|
+
images?: Array<Image> | undefined;
|
|
14
23
|
};
|
|
15
24
|
/** @internal */
|
|
16
25
|
export declare const AssistantMessageContent$inboundSchema: z.ZodType<AssistantMessageContent, unknown>;
|
|
@@ -21,6 +30,26 @@ export declare const AssistantMessageContent$outboundSchema: z.ZodType<Assistant
|
|
|
21
30
|
export declare function assistantMessageContentToJSON(assistantMessageContent: AssistantMessageContent): string;
|
|
22
31
|
export declare function assistantMessageContentFromJSON(jsonString: string): SafeParseResult<AssistantMessageContent, SDKValidationError>;
|
|
23
32
|
/** @internal */
|
|
33
|
+
export declare const AssistantMessageImageUrl$inboundSchema: z.ZodType<AssistantMessageImageUrl, unknown>;
|
|
34
|
+
/** @internal */
|
|
35
|
+
export type AssistantMessageImageUrl$Outbound = {
|
|
36
|
+
url: string;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const AssistantMessageImageUrl$outboundSchema: z.ZodType<AssistantMessageImageUrl$Outbound, AssistantMessageImageUrl>;
|
|
40
|
+
export declare function assistantMessageImageUrlToJSON(assistantMessageImageUrl: AssistantMessageImageUrl): string;
|
|
41
|
+
export declare function assistantMessageImageUrlFromJSON(jsonString: string): SafeParseResult<AssistantMessageImageUrl, SDKValidationError>;
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const Image$inboundSchema: z.ZodType<Image, unknown>;
|
|
44
|
+
/** @internal */
|
|
45
|
+
export type Image$Outbound = {
|
|
46
|
+
image_url: AssistantMessageImageUrl$Outbound;
|
|
47
|
+
};
|
|
48
|
+
/** @internal */
|
|
49
|
+
export declare const Image$outboundSchema: z.ZodType<Image$Outbound, Image>;
|
|
50
|
+
export declare function imageToJSON(image: Image): string;
|
|
51
|
+
export declare function imageFromJSON(jsonString: string): SafeParseResult<Image, SDKValidationError>;
|
|
52
|
+
/** @internal */
|
|
24
53
|
export declare const AssistantMessage$inboundSchema: z.ZodType<AssistantMessage, unknown>;
|
|
25
54
|
/** @internal */
|
|
26
55
|
export type AssistantMessage$Outbound = {
|
|
@@ -30,6 +59,8 @@ export type AssistantMessage$Outbound = {
|
|
|
30
59
|
tool_calls?: Array<ChatMessageToolCall$Outbound> | undefined;
|
|
31
60
|
refusal?: string | null | undefined;
|
|
32
61
|
reasoning?: string | null | undefined;
|
|
62
|
+
reasoning_details?: Array<Schema2$Outbound> | undefined;
|
|
63
|
+
images?: Array<Image$Outbound> | undefined;
|
|
33
64
|
};
|
|
34
65
|
/** @internal */
|
|
35
66
|
export declare const AssistantMessage$outboundSchema: z.ZodType<AssistantMessage$Outbound, AssistantMessage>;
|
|
@@ -7,6 +7,7 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
import { ChatMessageContentItem$inboundSchema, ChatMessageContentItem$outboundSchema, } from "./chatmessagecontentitem.js";
|
|
9
9
|
import { ChatMessageToolCall$inboundSchema, ChatMessageToolCall$outboundSchema, } from "./chatmessagetoolcall.js";
|
|
10
|
+
import { Schema2$inboundSchema, Schema2$outboundSchema, } from "./schema2.js";
|
|
10
11
|
/** @internal */
|
|
11
12
|
export const AssistantMessageContent$inboundSchema = z.union([z.string(), z.array(ChatMessageContentItem$inboundSchema)]);
|
|
12
13
|
/** @internal */
|
|
@@ -18,6 +19,42 @@ export function assistantMessageContentFromJSON(jsonString) {
|
|
|
18
19
|
return safeParse(jsonString, (x) => AssistantMessageContent$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssistantMessageContent' from JSON`);
|
|
19
20
|
}
|
|
20
21
|
/** @internal */
|
|
22
|
+
export const AssistantMessageImageUrl$inboundSchema = z.object({
|
|
23
|
+
url: z.string(),
|
|
24
|
+
});
|
|
25
|
+
/** @internal */
|
|
26
|
+
export const AssistantMessageImageUrl$outboundSchema = z.object({
|
|
27
|
+
url: z.string(),
|
|
28
|
+
});
|
|
29
|
+
export function assistantMessageImageUrlToJSON(assistantMessageImageUrl) {
|
|
30
|
+
return JSON.stringify(AssistantMessageImageUrl$outboundSchema.parse(assistantMessageImageUrl));
|
|
31
|
+
}
|
|
32
|
+
export function assistantMessageImageUrlFromJSON(jsonString) {
|
|
33
|
+
return safeParse(jsonString, (x) => AssistantMessageImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AssistantMessageImageUrl' from JSON`);
|
|
34
|
+
}
|
|
35
|
+
/** @internal */
|
|
36
|
+
export const Image$inboundSchema = z.object({
|
|
37
|
+
image_url: z.lazy(() => AssistantMessageImageUrl$inboundSchema),
|
|
38
|
+
}).transform((v) => {
|
|
39
|
+
return remap$(v, {
|
|
40
|
+
"image_url": "imageUrl",
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
/** @internal */
|
|
44
|
+
export const Image$outboundSchema = z.object({
|
|
45
|
+
imageUrl: z.lazy(() => AssistantMessageImageUrl$outboundSchema),
|
|
46
|
+
}).transform((v) => {
|
|
47
|
+
return remap$(v, {
|
|
48
|
+
imageUrl: "image_url",
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
export function imageToJSON(image) {
|
|
52
|
+
return JSON.stringify(Image$outboundSchema.parse(image));
|
|
53
|
+
}
|
|
54
|
+
export function imageFromJSON(jsonString) {
|
|
55
|
+
return safeParse(jsonString, (x) => Image$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Image' from JSON`);
|
|
56
|
+
}
|
|
57
|
+
/** @internal */
|
|
21
58
|
export const AssistantMessage$inboundSchema = z.object({
|
|
22
59
|
role: z.literal("assistant"),
|
|
23
60
|
content: z.nullable(z.union([z.string(), z.array(ChatMessageContentItem$inboundSchema)])).optional(),
|
|
@@ -25,9 +62,12 @@ export const AssistantMessage$inboundSchema = z.object({
|
|
|
25
62
|
tool_calls: z.array(ChatMessageToolCall$inboundSchema).optional(),
|
|
26
63
|
refusal: z.nullable(z.string()).optional(),
|
|
27
64
|
reasoning: z.nullable(z.string()).optional(),
|
|
65
|
+
reasoning_details: z.array(Schema2$inboundSchema).optional(),
|
|
66
|
+
images: z.array(z.lazy(() => Image$inboundSchema)).optional(),
|
|
28
67
|
}).transform((v) => {
|
|
29
68
|
return remap$(v, {
|
|
30
69
|
"tool_calls": "toolCalls",
|
|
70
|
+
"reasoning_details": "reasoningDetails",
|
|
31
71
|
});
|
|
32
72
|
});
|
|
33
73
|
/** @internal */
|
|
@@ -38,9 +78,12 @@ export const AssistantMessage$outboundSchema = z.object({
|
|
|
38
78
|
toolCalls: z.array(ChatMessageToolCall$outboundSchema).optional(),
|
|
39
79
|
refusal: z.nullable(z.string()).optional(),
|
|
40
80
|
reasoning: z.nullable(z.string()).optional(),
|
|
81
|
+
reasoningDetails: z.array(Schema2$outboundSchema).optional(),
|
|
82
|
+
images: z.array(z.lazy(() => Image$outboundSchema)).optional(),
|
|
41
83
|
}).transform((v) => {
|
|
42
84
|
return remap$(v, {
|
|
43
85
|
toolCalls: "tool_calls",
|
|
86
|
+
reasoningDetails: "reasoning_details",
|
|
44
87
|
});
|
|
45
88
|
});
|
|
46
89
|
export function assistantMessageToJSON(assistantMessage) {
|
|
@@ -8,35 +8,35 @@ export declare const ChatMessageContentItemImageDetail: {
|
|
|
8
8
|
readonly High: "high";
|
|
9
9
|
};
|
|
10
10
|
export type ChatMessageContentItemImageDetail = OpenEnum<typeof ChatMessageContentItemImageDetail>;
|
|
11
|
-
export type
|
|
11
|
+
export type ChatMessageContentItemImageImageUrl = {
|
|
12
12
|
url: string;
|
|
13
13
|
detail?: ChatMessageContentItemImageDetail | undefined;
|
|
14
14
|
};
|
|
15
15
|
export type ChatMessageContentItemImage = {
|
|
16
16
|
type: "image_url";
|
|
17
|
-
imageUrl:
|
|
17
|
+
imageUrl: ChatMessageContentItemImageImageUrl;
|
|
18
18
|
};
|
|
19
19
|
/** @internal */
|
|
20
20
|
export declare const ChatMessageContentItemImageDetail$inboundSchema: z.ZodType<ChatMessageContentItemImageDetail, unknown>;
|
|
21
21
|
/** @internal */
|
|
22
22
|
export declare const ChatMessageContentItemImageDetail$outboundSchema: z.ZodType<string, ChatMessageContentItemImageDetail>;
|
|
23
23
|
/** @internal */
|
|
24
|
-
export declare const
|
|
24
|
+
export declare const ChatMessageContentItemImageImageUrl$inboundSchema: z.ZodType<ChatMessageContentItemImageImageUrl, unknown>;
|
|
25
25
|
/** @internal */
|
|
26
|
-
export type
|
|
26
|
+
export type ChatMessageContentItemImageImageUrl$Outbound = {
|
|
27
27
|
url: string;
|
|
28
28
|
detail?: string | undefined;
|
|
29
29
|
};
|
|
30
30
|
/** @internal */
|
|
31
|
-
export declare const
|
|
32
|
-
export declare function
|
|
33
|
-
export declare function
|
|
31
|
+
export declare const ChatMessageContentItemImageImageUrl$outboundSchema: z.ZodType<ChatMessageContentItemImageImageUrl$Outbound, ChatMessageContentItemImageImageUrl>;
|
|
32
|
+
export declare function chatMessageContentItemImageImageUrlToJSON(chatMessageContentItemImageImageUrl: ChatMessageContentItemImageImageUrl): string;
|
|
33
|
+
export declare function chatMessageContentItemImageImageUrlFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemImageImageUrl, SDKValidationError>;
|
|
34
34
|
/** @internal */
|
|
35
35
|
export declare const ChatMessageContentItemImage$inboundSchema: z.ZodType<ChatMessageContentItemImage, unknown>;
|
|
36
36
|
/** @internal */
|
|
37
37
|
export type ChatMessageContentItemImage$Outbound = {
|
|
38
38
|
type: "image_url";
|
|
39
|
-
image_url:
|
|
39
|
+
image_url: ChatMessageContentItemImageImageUrl$Outbound;
|
|
40
40
|
};
|
|
41
41
|
/** @internal */
|
|
42
42
|
export declare const ChatMessageContentItemImage$outboundSchema: z.ZodType<ChatMessageContentItemImage$Outbound, ChatMessageContentItemImage>;
|
|
@@ -16,26 +16,25 @@ export const ChatMessageContentItemImageDetail$inboundSchema = openEnums.inbound
|
|
|
16
16
|
/** @internal */
|
|
17
17
|
export const ChatMessageContentItemImageDetail$outboundSchema = openEnums.outboundSchema(ChatMessageContentItemImageDetail);
|
|
18
18
|
/** @internal */
|
|
19
|
-
export const
|
|
19
|
+
export const ChatMessageContentItemImageImageUrl$inboundSchema = z.object({
|
|
20
20
|
url: z.string(),
|
|
21
21
|
detail: ChatMessageContentItemImageDetail$inboundSchema.optional(),
|
|
22
22
|
});
|
|
23
23
|
/** @internal */
|
|
24
|
-
export const
|
|
25
|
-
.object({
|
|
24
|
+
export const ChatMessageContentItemImageImageUrl$outboundSchema = z.object({
|
|
26
25
|
url: z.string(),
|
|
27
26
|
detail: ChatMessageContentItemImageDetail$outboundSchema.optional(),
|
|
28
27
|
});
|
|
29
|
-
export function
|
|
30
|
-
return JSON.stringify(
|
|
28
|
+
export function chatMessageContentItemImageImageUrlToJSON(chatMessageContentItemImageImageUrl) {
|
|
29
|
+
return JSON.stringify(ChatMessageContentItemImageImageUrl$outboundSchema.parse(chatMessageContentItemImageImageUrl));
|
|
31
30
|
}
|
|
32
|
-
export function
|
|
33
|
-
return safeParse(jsonString, (x) =>
|
|
31
|
+
export function chatMessageContentItemImageImageUrlFromJSON(jsonString) {
|
|
32
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemImageImageUrl$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemImageImageUrl' from JSON`);
|
|
34
33
|
}
|
|
35
34
|
/** @internal */
|
|
36
35
|
export const ChatMessageContentItemImage$inboundSchema = z.object({
|
|
37
36
|
type: z.literal("image_url"),
|
|
38
|
-
image_url: z.lazy(() =>
|
|
37
|
+
image_url: z.lazy(() => ChatMessageContentItemImageImageUrl$inboundSchema),
|
|
39
38
|
}).transform((v) => {
|
|
40
39
|
return remap$(v, {
|
|
41
40
|
"image_url": "imageUrl",
|
|
@@ -44,7 +43,7 @@ export const ChatMessageContentItemImage$inboundSchema = z.object({
|
|
|
44
43
|
/** @internal */
|
|
45
44
|
export const ChatMessageContentItemImage$outboundSchema = z.object({
|
|
46
45
|
type: z.literal("image_url"),
|
|
47
|
-
imageUrl: z.lazy(() =>
|
|
46
|
+
imageUrl: z.lazy(() => ChatMessageContentItemImageImageUrl$outboundSchema),
|
|
48
47
|
}).transform((v) => {
|
|
49
48
|
return remap$(v, {
|
|
50
49
|
imageUrl: "image_url",
|
|
@@ -4,12 +4,10 @@ import { AssistantMessage } from "./assistantmessage.js";
|
|
|
4
4
|
import { ChatCompletionFinishReason } from "./chatcompletionfinishreason.js";
|
|
5
5
|
import { ChatMessageTokenLogprobs } from "./chatmessagetokenlogprobs.js";
|
|
6
6
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
7
|
-
import { Schema3 } from "./schema3.js";
|
|
8
7
|
export type ChatResponseChoice = {
|
|
9
8
|
finishReason: ChatCompletionFinishReason | null;
|
|
10
9
|
index: number;
|
|
11
10
|
message: AssistantMessage;
|
|
12
|
-
reasoningDetails?: Array<Schema3> | undefined;
|
|
13
11
|
logprobs?: ChatMessageTokenLogprobs | null | undefined;
|
|
14
12
|
};
|
|
15
13
|
/** @internal */
|
|
@@ -8,18 +8,15 @@ import { safeParse } from "../lib/schemas.js";
|
|
|
8
8
|
import { AssistantMessage$inboundSchema, } from "./assistantmessage.js";
|
|
9
9
|
import { ChatCompletionFinishReason$inboundSchema, } from "./chatcompletionfinishreason.js";
|
|
10
10
|
import { ChatMessageTokenLogprobs$inboundSchema, } from "./chatmessagetokenlogprobs.js";
|
|
11
|
-
import { Schema3$inboundSchema } from "./schema3.js";
|
|
12
11
|
/** @internal */
|
|
13
12
|
export const ChatResponseChoice$inboundSchema = z.object({
|
|
14
13
|
finish_reason: z.nullable(ChatCompletionFinishReason$inboundSchema),
|
|
15
14
|
index: z.number(),
|
|
16
15
|
message: AssistantMessage$inboundSchema,
|
|
17
|
-
reasoning_details: z.array(Schema3$inboundSchema).optional(),
|
|
18
16
|
logprobs: z.nullable(ChatMessageTokenLogprobs$inboundSchema).optional(),
|
|
19
17
|
}).transform((v) => {
|
|
20
18
|
return remap$(v, {
|
|
21
19
|
"finish_reason": "finishReason",
|
|
22
|
-
"reasoning_details": "reasoningDetails",
|
|
23
20
|
});
|
|
24
21
|
});
|
|
25
22
|
export function chatResponseChoiceFromJSON(jsonString) {
|
|
@@ -3,7 +3,7 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { ChatStreamingMessageToolCall } from "./chatstreamingmessagetoolcall.js";
|
|
5
5
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Schema2 } from "./schema2.js";
|
|
7
7
|
export declare const ChatStreamingMessageChunkRole: {
|
|
8
8
|
readonly Assistant: "assistant";
|
|
9
9
|
};
|
|
@@ -14,7 +14,7 @@ export type ChatStreamingMessageChunk = {
|
|
|
14
14
|
reasoning?: string | null | undefined;
|
|
15
15
|
refusal?: string | null | undefined;
|
|
16
16
|
toolCalls?: Array<ChatStreamingMessageToolCall> | undefined;
|
|
17
|
-
reasoningDetails?: Array<
|
|
17
|
+
reasoningDetails?: Array<Schema2> | undefined;
|
|
18
18
|
};
|
|
19
19
|
/** @internal */
|
|
20
20
|
export declare const ChatStreamingMessageChunkRole$inboundSchema: z.ZodEnum<typeof ChatStreamingMessageChunkRole>;
|
|
@@ -6,7 +6,7 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import { safeParse } from "../lib/schemas.js";
|
|
8
8
|
import { ChatStreamingMessageToolCall$inboundSchema, } from "./chatstreamingmessagetoolcall.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Schema2$inboundSchema } from "./schema2.js";
|
|
10
10
|
export const ChatStreamingMessageChunkRole = {
|
|
11
11
|
Assistant: "assistant",
|
|
12
12
|
};
|
|
@@ -19,7 +19,7 @@ export const ChatStreamingMessageChunk$inboundSchema = z.object({
|
|
|
19
19
|
reasoning: z.nullable(z.string()).optional(),
|
|
20
20
|
refusal: z.nullable(z.string()).optional(),
|
|
21
21
|
tool_calls: z.array(ChatStreamingMessageToolCall$inboundSchema).optional(),
|
|
22
|
-
reasoning_details: z.array(
|
|
22
|
+
reasoning_details: z.array(Schema2$inboundSchema).optional(),
|
|
23
23
|
}).transform((v) => {
|
|
24
24
|
return remap$(v, {
|
|
25
25
|
"tool_calls": "toolCalls",
|
package/esm/models/index.d.ts
CHANGED
|
@@ -141,7 +141,7 @@ export * from "./responseswebsearchcalloutput.js";
|
|
|
141
141
|
export * from "./responseswebsearchuserlocation.js";
|
|
142
142
|
export * from "./responsetextconfig.js";
|
|
143
143
|
export * from "./schema0.js";
|
|
144
|
-
export * from "./
|
|
144
|
+
export * from "./schema2.js";
|
|
145
145
|
export * from "./security.js";
|
|
146
146
|
export * from "./serviceunavailableresponseerrordata.js";
|
|
147
147
|
export * from "./systemmessage.js";
|
package/esm/models/index.js
CHANGED
|
@@ -145,7 +145,7 @@ export * from "./responseswebsearchcalloutput.js";
|
|
|
145
145
|
export * from "./responseswebsearchuserlocation.js";
|
|
146
146
|
export * from "./responsetextconfig.js";
|
|
147
147
|
export * from "./schema0.js";
|
|
148
|
-
export * from "./
|
|
148
|
+
export * from "./schema2.js";
|
|
149
149
|
export * from "./security.js";
|
|
150
150
|
export * from "./serviceunavailableresponseerrordata.js";
|
|
151
151
|
export * from "./systemmessage.js";
|
package/esm/models/model.d.ts
CHANGED
|
@@ -63,6 +63,10 @@ export type Model = {
|
|
|
63
63
|
* Default parameters for this model
|
|
64
64
|
*/
|
|
65
65
|
defaultParameters: DefaultParameters | null;
|
|
66
|
+
/**
|
|
67
|
+
* The date after which the model may be removed. ISO 8601 date string (YYYY-MM-DD) or null if no expiration.
|
|
68
|
+
*/
|
|
69
|
+
expirationDate?: string | null | undefined;
|
|
66
70
|
};
|
|
67
71
|
/** @internal */
|
|
68
72
|
export declare const Model$inboundSchema: z.ZodType<Model, unknown>;
|
package/esm/models/model.js
CHANGED
|
@@ -26,6 +26,7 @@ export const Model$inboundSchema = z.object({
|
|
|
26
26
|
per_request_limits: z.nullable(PerRequestLimits$inboundSchema),
|
|
27
27
|
supported_parameters: z.array(Parameter$inboundSchema),
|
|
28
28
|
default_parameters: z.nullable(DefaultParameters$inboundSchema),
|
|
29
|
+
expiration_date: z.nullable(z.string()).optional(),
|
|
29
30
|
}).transform((v) => {
|
|
30
31
|
return remap$(v, {
|
|
31
32
|
"canonical_slug": "canonicalSlug",
|
|
@@ -35,6 +36,7 @@ export const Model$inboundSchema = z.object({
|
|
|
35
36
|
"per_request_limits": "perRequestLimits",
|
|
36
37
|
"supported_parameters": "supportedParameters",
|
|
37
38
|
"default_parameters": "defaultParameters",
|
|
39
|
+
"expiration_date": "expirationDate",
|
|
38
40
|
});
|
|
39
41
|
});
|
|
40
42
|
export function modelFromJSON(jsonString) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
3
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
4
|
+
export type BulkAssignKeysToGuardrailRequestBody = {
|
|
5
|
+
/**
|
|
6
|
+
* Array of API key hashes to assign to the guardrail
|
|
7
|
+
*/
|
|
8
|
+
keyHashes: Array<string>;
|
|
9
|
+
};
|
|
10
|
+
export type BulkAssignKeysToGuardrailRequest = {
|
|
11
|
+
/**
|
|
12
|
+
* The unique identifier of the guardrail
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
requestBody: BulkAssignKeysToGuardrailRequestBody;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Assignment result
|
|
19
|
+
*/
|
|
20
|
+
export type BulkAssignKeysToGuardrailResponse = {
|
|
21
|
+
/**
|
|
22
|
+
* Number of keys successfully assigned
|
|
23
|
+
*/
|
|
24
|
+
assignedCount: number;
|
|
25
|
+
};
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type BulkAssignKeysToGuardrailRequestBody$Outbound = {
|
|
28
|
+
key_hashes: Array<string>;
|
|
29
|
+
};
|
|
30
|
+
/** @internal */
|
|
31
|
+
export declare const BulkAssignKeysToGuardrailRequestBody$outboundSchema: z.ZodType<BulkAssignKeysToGuardrailRequestBody$Outbound, BulkAssignKeysToGuardrailRequestBody>;
|
|
32
|
+
export declare function bulkAssignKeysToGuardrailRequestBodyToJSON(bulkAssignKeysToGuardrailRequestBody: BulkAssignKeysToGuardrailRequestBody): string;
|
|
33
|
+
/** @internal */
|
|
34
|
+
export type BulkAssignKeysToGuardrailRequest$Outbound = {
|
|
35
|
+
id: string;
|
|
36
|
+
RequestBody: BulkAssignKeysToGuardrailRequestBody$Outbound;
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export declare const BulkAssignKeysToGuardrailRequest$outboundSchema: z.ZodType<BulkAssignKeysToGuardrailRequest$Outbound, BulkAssignKeysToGuardrailRequest>;
|
|
40
|
+
export declare function bulkAssignKeysToGuardrailRequestToJSON(bulkAssignKeysToGuardrailRequest: BulkAssignKeysToGuardrailRequest): string;
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const BulkAssignKeysToGuardrailResponse$inboundSchema: z.ZodType<BulkAssignKeysToGuardrailResponse, unknown>;
|
|
43
|
+
export declare function bulkAssignKeysToGuardrailResponseFromJSON(jsonString: string): SafeParseResult<BulkAssignKeysToGuardrailResponse, SDKValidationError>;
|
|
44
|
+
//# sourceMappingURL=bulkassignkeystoguardrail.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 4f855e3ea589
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const BulkAssignKeysToGuardrailRequestBody$outboundSchema = z.object({
|
|
10
|
+
keyHashes: z.array(z.string()),
|
|
11
|
+
}).transform((v) => {
|
|
12
|
+
return remap$(v, {
|
|
13
|
+
keyHashes: "key_hashes",
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
export function bulkAssignKeysToGuardrailRequestBodyToJSON(bulkAssignKeysToGuardrailRequestBody) {
|
|
17
|
+
return JSON.stringify(BulkAssignKeysToGuardrailRequestBody$outboundSchema.parse(bulkAssignKeysToGuardrailRequestBody));
|
|
18
|
+
}
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const BulkAssignKeysToGuardrailRequest$outboundSchema = z.object({
|
|
21
|
+
id: z.string(),
|
|
22
|
+
requestBody: z.lazy(() => BulkAssignKeysToGuardrailRequestBody$outboundSchema),
|
|
23
|
+
}).transform((v) => {
|
|
24
|
+
return remap$(v, {
|
|
25
|
+
requestBody: "RequestBody",
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
export function bulkAssignKeysToGuardrailRequestToJSON(bulkAssignKeysToGuardrailRequest) {
|
|
29
|
+
return JSON.stringify(BulkAssignKeysToGuardrailRequest$outboundSchema.parse(bulkAssignKeysToGuardrailRequest));
|
|
30
|
+
}
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const BulkAssignKeysToGuardrailResponse$inboundSchema = z.object({
|
|
33
|
+
assigned_count: z.number(),
|
|
34
|
+
}).transform((v) => {
|
|
35
|
+
return remap$(v, {
|
|
36
|
+
"assigned_count": "assignedCount",
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
export function bulkAssignKeysToGuardrailResponseFromJSON(jsonString) {
|
|
40
|
+
return safeParse(jsonString, (x) => BulkAssignKeysToGuardrailResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BulkAssignKeysToGuardrailResponse' from JSON`);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=bulkassignkeystoguardrail.js.map
|