@openrouter/sdk 0.3.12 → 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/anthropic-compat.test.js +3 -0
- package/esm/lib/async-params.d.ts +46 -6
- package/esm/lib/async-params.js +10 -2
- package/esm/lib/chat-compat.test.js +3 -0
- 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 +109 -1
- 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/chatgenerationparams.d.ts +93 -12
- package/esm/models/chatgenerationparams.js +75 -6
- package/esm/models/chatgenerationtokenusage.d.ts +1 -0
- package/esm/models/chatgenerationtokenusage.js +2 -0
- package/esm/models/chatmessagecontentitemimage.d.ts +8 -8
- package/esm/models/chatmessagecontentitemimage.js +8 -9
- package/esm/models/chatmessagetokenlogprob.d.ts +4 -4
- package/esm/models/chatmessagetokenlogprob.js +4 -5
- 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 +8 -1
- package/esm/models/index.js +8 -1
- package/esm/models/model.d.ts +4 -0
- package/esm/models/model.js +2 -0
- package/esm/models/openairesponsesinputunion.d.ts +15 -5
- package/esm/models/openairesponsesinputunion.js +5 -5
- package/esm/models/openresponseseasyinputmessage.d.ts +41 -16
- package/esm/models/openresponseseasyinputmessage.js +38 -13
- package/esm/models/openresponsesinputmessageitem.d.ts +37 -12
- package/esm/models/openresponsesinputmessageitem.js +33 -9
- package/esm/models/openresponsesnonstreamingresponse.d.ts +5 -2
- package/esm/models/openresponsesnonstreamingresponse.js +8 -2
- package/esm/models/openresponsesreasoning.d.ts +1 -0
- package/esm/models/openresponsesreasoning.js +1 -0
- package/esm/models/openresponsesrequest.d.ts +61 -24
- package/esm/models/openresponsesrequest.js +39 -6
- 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/getgeneration.d.ts +4 -0
- package/esm/models/operations/getgeneration.js +1 -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.d.ts +33 -0
- package/esm/models/percentilelatencycutoffs.js +16 -0
- package/esm/models/percentilestats.d.ts +28 -0
- package/esm/models/percentilestats.js +17 -0
- package/esm/models/percentilethroughputcutoffs.d.ts +33 -0
- package/esm/models/percentilethroughputcutoffs.js +16 -0
- package/esm/models/preferredmaxlatency.d.ts +12 -0
- package/esm/models/preferredmaxlatency.js +12 -0
- package/esm/models/preferredminthroughput.d.ts +12 -0
- package/esm/models/preferredminthroughput.js +12 -0
- package/esm/models/providername.d.ts +3 -2
- package/esm/models/providername.js +3 -2
- package/esm/models/providerpreferences.d.ts +8 -20
- package/esm/models/providerpreferences.js +6 -6
- package/esm/models/publicendpoint.d.ts +6 -0
- package/esm/models/publicendpoint.js +5 -0
- package/esm/models/responseinputimage.d.ts +11 -3
- package/esm/models/responseinputimage.js +9 -2
- package/esm/models/responseinputvideo.d.ts +20 -0
- package/esm/models/responseinputvideo.js +19 -0
- package/esm/models/responseoutputtext.d.ts +38 -0
- package/esm/models/responseoutputtext.js +50 -0
- package/esm/models/responsesoutputitemreasoning.d.ts +30 -1
- package/esm/models/responsesoutputitemreasoning.js +22 -0
- package/esm/models/responsesoutputmodality.d.ts +10 -0
- package/esm/models/responsesoutputmodality.js +12 -0
- package/esm/models/schema0.d.ts +3 -2
- package/esm/models/schema0.js +3 -2
- 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 -50
- package/esm/models/schema3.js +0 -61
- 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
|
|
@@ -237,7 +248,7 @@ export interface StepResult<TTools extends readonly Tool[] = readonly Tool[]> {
|
|
|
237
248
|
readonly toolCalls: TypedToolCallUnion<TTools>[];
|
|
238
249
|
readonly toolResults: ToolExecutionResultUnion<TTools>[];
|
|
239
250
|
readonly response: models.OpenResponsesNonStreamingResponse;
|
|
240
|
-
readonly usage?: models.OpenResponsesUsage | undefined;
|
|
251
|
+
readonly usage?: models.OpenResponsesUsage | null | undefined;
|
|
241
252
|
readonly finishReason?: string | undefined;
|
|
242
253
|
readonly warnings?: Warning[] | undefined;
|
|
243
254
|
readonly experimental_providerMetadata?: Record<string, unknown> | undefined;
|
|
@@ -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) {
|
|
@@ -35,6 +35,20 @@ export type ChatGenerationParamsMaxPrice = {
|
|
|
35
35
|
audio?: any | undefined;
|
|
36
36
|
request?: any | undefined;
|
|
37
37
|
};
|
|
38
|
+
export type ChatGenerationParamsPreferredMinThroughput = {
|
|
39
|
+
p50?: number | null | undefined;
|
|
40
|
+
p75?: number | null | undefined;
|
|
41
|
+
p90?: number | null | undefined;
|
|
42
|
+
p99?: number | null | undefined;
|
|
43
|
+
};
|
|
44
|
+
export type ChatGenerationParamsPreferredMinThroughputUnion = number | ChatGenerationParamsPreferredMinThroughput;
|
|
45
|
+
export type ChatGenerationParamsPreferredMaxLatency = {
|
|
46
|
+
p50?: number | null | undefined;
|
|
47
|
+
p75?: number | null | undefined;
|
|
48
|
+
p90?: number | null | undefined;
|
|
49
|
+
p99?: number | null | undefined;
|
|
50
|
+
};
|
|
51
|
+
export type ChatGenerationParamsPreferredMaxLatencyUnion = number | ChatGenerationParamsPreferredMaxLatency;
|
|
38
52
|
export type ChatGenerationParamsProvider = {
|
|
39
53
|
/**
|
|
40
54
|
* Whether to allow backup providers to serve requests
|
|
@@ -83,10 +97,14 @@ export type ChatGenerationParamsProvider = {
|
|
|
83
97
|
* The object specifying the maximum price you want to pay for this request. USD price per million tokens, for prompt and completion.
|
|
84
98
|
*/
|
|
85
99
|
maxPrice?: ChatGenerationParamsMaxPrice | undefined;
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Preferred minimum throughput (in tokens per second). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints below the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
|
|
102
|
+
*/
|
|
103
|
+
preferredMinThroughput?: number | ChatGenerationParamsPreferredMinThroughput | null | undefined;
|
|
104
|
+
/**
|
|
105
|
+
* Preferred maximum latency (in seconds). Can be a number (applies to p50) or an object with percentile-specific cutoffs. Endpoints above the threshold(s) may still be used, but are deprioritized in routing. When using fallback models, this may cause a fallback model to be used instead of the primary model if it meets the threshold.
|
|
106
|
+
*/
|
|
107
|
+
preferredMaxLatency?: number | ChatGenerationParamsPreferredMaxLatency | null | undefined;
|
|
90
108
|
};
|
|
91
109
|
export type ChatGenerationParamsPluginResponseHealing = {
|
|
92
110
|
id: "response-healing";
|
|
@@ -121,7 +139,12 @@ export type ChatGenerationParamsPluginWeb = {
|
|
|
121
139
|
export type ChatGenerationParamsPluginModeration = {
|
|
122
140
|
id: "moderation";
|
|
123
141
|
};
|
|
124
|
-
export type
|
|
142
|
+
export type ChatGenerationParamsPluginAutoRouter = {
|
|
143
|
+
id: "auto-router";
|
|
144
|
+
enabled?: boolean | undefined;
|
|
145
|
+
allowedModels?: Array<string> | undefined;
|
|
146
|
+
};
|
|
147
|
+
export type ChatGenerationParamsPluginUnion = ChatGenerationParamsPluginAutoRouter | ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing;
|
|
125
148
|
export declare const Route: {
|
|
126
149
|
readonly Fallback: "fallback";
|
|
127
150
|
readonly Sort: "sort";
|
|
@@ -154,6 +177,12 @@ export type ChatGenerationParamsStop = string | Array<string>;
|
|
|
154
177
|
export type Debug = {
|
|
155
178
|
echoUpstreamBody?: boolean | undefined;
|
|
156
179
|
};
|
|
180
|
+
export type ChatGenerationParamsImageConfig = string | number;
|
|
181
|
+
export declare const Modality: {
|
|
182
|
+
readonly Text: "text";
|
|
183
|
+
readonly Image: "image";
|
|
184
|
+
};
|
|
185
|
+
export type Modality = OpenEnum<typeof Modality>;
|
|
157
186
|
export type ChatGenerationParams = {
|
|
158
187
|
/**
|
|
159
188
|
* When multiple model providers are available, optionally indicate your routing preference.
|
|
@@ -162,7 +191,7 @@ export type ChatGenerationParams = {
|
|
|
162
191
|
/**
|
|
163
192
|
* Plugins you want to enable for this request, including their settings.
|
|
164
193
|
*/
|
|
165
|
-
plugins?: Array<ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing> | undefined;
|
|
194
|
+
plugins?: Array<ChatGenerationParamsPluginAutoRouter | ChatGenerationParamsPluginModeration | ChatGenerationParamsPluginWeb | ChatGenerationParamsPluginFileParser | ChatGenerationParamsPluginResponseHealing> | undefined;
|
|
166
195
|
route?: Route | null | undefined;
|
|
167
196
|
user?: string | undefined;
|
|
168
197
|
/**
|
|
@@ -195,6 +224,10 @@ export type ChatGenerationParams = {
|
|
|
195
224
|
tools?: Array<ToolDefinitionJson> | undefined;
|
|
196
225
|
topP?: number | null | undefined;
|
|
197
226
|
debug?: Debug | undefined;
|
|
227
|
+
imageConfig?: {
|
|
228
|
+
[k: string]: string | number;
|
|
229
|
+
} | undefined;
|
|
230
|
+
modalities?: Array<Modality> | undefined;
|
|
198
231
|
};
|
|
199
232
|
/** @internal */
|
|
200
233
|
export declare const ChatGenerationParamsDataCollection$outboundSchema: z.ZodType<string, ChatGenerationParamsDataCollection>;
|
|
@@ -212,6 +245,36 @@ export type ChatGenerationParamsMaxPrice$Outbound = {
|
|
|
212
245
|
export declare const ChatGenerationParamsMaxPrice$outboundSchema: z.ZodType<ChatGenerationParamsMaxPrice$Outbound, ChatGenerationParamsMaxPrice>;
|
|
213
246
|
export declare function chatGenerationParamsMaxPriceToJSON(chatGenerationParamsMaxPrice: ChatGenerationParamsMaxPrice): string;
|
|
214
247
|
/** @internal */
|
|
248
|
+
export type ChatGenerationParamsPreferredMinThroughput$Outbound = {
|
|
249
|
+
p50?: number | null | undefined;
|
|
250
|
+
p75?: number | null | undefined;
|
|
251
|
+
p90?: number | null | undefined;
|
|
252
|
+
p99?: number | null | undefined;
|
|
253
|
+
};
|
|
254
|
+
/** @internal */
|
|
255
|
+
export declare const ChatGenerationParamsPreferredMinThroughput$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMinThroughput$Outbound, ChatGenerationParamsPreferredMinThroughput>;
|
|
256
|
+
export declare function chatGenerationParamsPreferredMinThroughputToJSON(chatGenerationParamsPreferredMinThroughput: ChatGenerationParamsPreferredMinThroughput): string;
|
|
257
|
+
/** @internal */
|
|
258
|
+
export type ChatGenerationParamsPreferredMinThroughputUnion$Outbound = number | ChatGenerationParamsPreferredMinThroughput$Outbound;
|
|
259
|
+
/** @internal */
|
|
260
|
+
export declare const ChatGenerationParamsPreferredMinThroughputUnion$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMinThroughputUnion$Outbound, ChatGenerationParamsPreferredMinThroughputUnion>;
|
|
261
|
+
export declare function chatGenerationParamsPreferredMinThroughputUnionToJSON(chatGenerationParamsPreferredMinThroughputUnion: ChatGenerationParamsPreferredMinThroughputUnion): string;
|
|
262
|
+
/** @internal */
|
|
263
|
+
export type ChatGenerationParamsPreferredMaxLatency$Outbound = {
|
|
264
|
+
p50?: number | null | undefined;
|
|
265
|
+
p75?: number | null | undefined;
|
|
266
|
+
p90?: number | null | undefined;
|
|
267
|
+
p99?: number | null | undefined;
|
|
268
|
+
};
|
|
269
|
+
/** @internal */
|
|
270
|
+
export declare const ChatGenerationParamsPreferredMaxLatency$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMaxLatency$Outbound, ChatGenerationParamsPreferredMaxLatency>;
|
|
271
|
+
export declare function chatGenerationParamsPreferredMaxLatencyToJSON(chatGenerationParamsPreferredMaxLatency: ChatGenerationParamsPreferredMaxLatency): string;
|
|
272
|
+
/** @internal */
|
|
273
|
+
export type ChatGenerationParamsPreferredMaxLatencyUnion$Outbound = number | ChatGenerationParamsPreferredMaxLatency$Outbound;
|
|
274
|
+
/** @internal */
|
|
275
|
+
export declare const ChatGenerationParamsPreferredMaxLatencyUnion$outboundSchema: z.ZodType<ChatGenerationParamsPreferredMaxLatencyUnion$Outbound, ChatGenerationParamsPreferredMaxLatencyUnion>;
|
|
276
|
+
export declare function chatGenerationParamsPreferredMaxLatencyUnionToJSON(chatGenerationParamsPreferredMaxLatencyUnion: ChatGenerationParamsPreferredMaxLatencyUnion): string;
|
|
277
|
+
/** @internal */
|
|
215
278
|
export type ChatGenerationParamsProvider$Outbound = {
|
|
216
279
|
allow_fallbacks?: boolean | null | undefined;
|
|
217
280
|
require_parameters?: boolean | null | undefined;
|
|
@@ -224,10 +287,8 @@ export type ChatGenerationParamsProvider$Outbound = {
|
|
|
224
287
|
quantizations?: Array<string> | null | undefined;
|
|
225
288
|
sort?: ProviderSortUnion$Outbound | null | undefined;
|
|
226
289
|
max_price?: ChatGenerationParamsMaxPrice$Outbound | undefined;
|
|
227
|
-
preferred_min_throughput?: number | null | undefined;
|
|
228
|
-
preferred_max_latency?: number | null | undefined;
|
|
229
|
-
min_throughput?: number | null | undefined;
|
|
230
|
-
max_latency?: number | null | undefined;
|
|
290
|
+
preferred_min_throughput?: number | ChatGenerationParamsPreferredMinThroughput$Outbound | null | undefined;
|
|
291
|
+
preferred_max_latency?: number | ChatGenerationParamsPreferredMaxLatency$Outbound | null | undefined;
|
|
231
292
|
};
|
|
232
293
|
/** @internal */
|
|
233
294
|
export declare const ChatGenerationParamsProvider$outboundSchema: z.ZodType<ChatGenerationParamsProvider$Outbound, ChatGenerationParamsProvider>;
|
|
@@ -279,7 +340,16 @@ export type ChatGenerationParamsPluginModeration$Outbound = {
|
|
|
279
340
|
export declare const ChatGenerationParamsPluginModeration$outboundSchema: z.ZodType<ChatGenerationParamsPluginModeration$Outbound, ChatGenerationParamsPluginModeration>;
|
|
280
341
|
export declare function chatGenerationParamsPluginModerationToJSON(chatGenerationParamsPluginModeration: ChatGenerationParamsPluginModeration): string;
|
|
281
342
|
/** @internal */
|
|
282
|
-
export type
|
|
343
|
+
export type ChatGenerationParamsPluginAutoRouter$Outbound = {
|
|
344
|
+
id: "auto-router";
|
|
345
|
+
enabled?: boolean | undefined;
|
|
346
|
+
allowed_models?: Array<string> | undefined;
|
|
347
|
+
};
|
|
348
|
+
/** @internal */
|
|
349
|
+
export declare const ChatGenerationParamsPluginAutoRouter$outboundSchema: z.ZodType<ChatGenerationParamsPluginAutoRouter$Outbound, ChatGenerationParamsPluginAutoRouter>;
|
|
350
|
+
export declare function chatGenerationParamsPluginAutoRouterToJSON(chatGenerationParamsPluginAutoRouter: ChatGenerationParamsPluginAutoRouter): string;
|
|
351
|
+
/** @internal */
|
|
352
|
+
export type ChatGenerationParamsPluginUnion$Outbound = ChatGenerationParamsPluginAutoRouter$Outbound | ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound;
|
|
283
353
|
/** @internal */
|
|
284
354
|
export declare const ChatGenerationParamsPluginUnion$outboundSchema: z.ZodType<ChatGenerationParamsPluginUnion$Outbound, ChatGenerationParamsPluginUnion>;
|
|
285
355
|
export declare function chatGenerationParamsPluginUnionToJSON(chatGenerationParamsPluginUnion: ChatGenerationParamsPluginUnion): string;
|
|
@@ -334,9 +404,16 @@ export type Debug$Outbound = {
|
|
|
334
404
|
export declare const Debug$outboundSchema: z.ZodType<Debug$Outbound, Debug>;
|
|
335
405
|
export declare function debugToJSON(debug: Debug): string;
|
|
336
406
|
/** @internal */
|
|
407
|
+
export type ChatGenerationParamsImageConfig$Outbound = string | number;
|
|
408
|
+
/** @internal */
|
|
409
|
+
export declare const ChatGenerationParamsImageConfig$outboundSchema: z.ZodType<ChatGenerationParamsImageConfig$Outbound, ChatGenerationParamsImageConfig>;
|
|
410
|
+
export declare function chatGenerationParamsImageConfigToJSON(chatGenerationParamsImageConfig: ChatGenerationParamsImageConfig): string;
|
|
411
|
+
/** @internal */
|
|
412
|
+
export declare const Modality$outboundSchema: z.ZodType<string, Modality>;
|
|
413
|
+
/** @internal */
|
|
337
414
|
export type ChatGenerationParams$Outbound = {
|
|
338
415
|
provider?: ChatGenerationParamsProvider$Outbound | null | undefined;
|
|
339
|
-
plugins?: Array<ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound> | undefined;
|
|
416
|
+
plugins?: Array<ChatGenerationParamsPluginAutoRouter$Outbound | ChatGenerationParamsPluginModeration$Outbound | ChatGenerationParamsPluginWeb$Outbound | ChatGenerationParamsPluginFileParser$Outbound | ChatGenerationParamsPluginResponseHealing$Outbound> | undefined;
|
|
340
417
|
route?: string | null | undefined;
|
|
341
418
|
user?: string | undefined;
|
|
342
419
|
session_id?: string | undefined;
|
|
@@ -366,6 +443,10 @@ export type ChatGenerationParams$Outbound = {
|
|
|
366
443
|
tools?: Array<ToolDefinitionJson$Outbound> | undefined;
|
|
367
444
|
top_p?: number | null | undefined;
|
|
368
445
|
debug?: Debug$Outbound | undefined;
|
|
446
|
+
image_config?: {
|
|
447
|
+
[k: string]: string | number;
|
|
448
|
+
} | undefined;
|
|
449
|
+
modalities?: Array<string> | undefined;
|
|
369
450
|
};
|
|
370
451
|
/** @internal */
|
|
371
452
|
export declare const ChatGenerationParams$outboundSchema: z.ZodType<ChatGenerationParams$Outbound, ChatGenerationParams>;
|