@openrouter/sdk 0.12.23 → 0.12.25
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/sttCreateTranscription.d.ts +19 -0
- package/esm/funcs/sttCreateTranscription.js +110 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/index.d.ts +5 -0
- package/esm/models/index.js +5 -0
- package/esm/models/operations/createaudiotranscriptions.d.ts +56 -0
- package/esm/models/operations/createaudiotranscriptions.js +23 -0
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/outputwebsearchcallitem.d.ts +10 -10
- package/esm/models/outputwebsearchcallitem.js +10 -11
- package/esm/models/outputwebsearchservertoolitem.d.ts +61 -5
- package/esm/models/outputwebsearchservertoolitem.js +59 -5
- package/esm/models/provideroptions.d.ts +667 -0
- package/esm/models/provideroptions.js +146 -0
- package/esm/models/speechrequest.d.ts +3 -667
- package/esm/models/speechrequest.js +2 -140
- package/esm/models/sttinputaudio.d.ts +23 -0
- package/esm/models/sttinputaudio.js +14 -0
- package/esm/models/sttrequest.d.ts +56 -0
- package/esm/models/sttrequest.js +31 -0
- package/esm/models/sttresponse.d.ts +21 -0
- package/esm/models/sttresponse.js +17 -0
- package/esm/models/sttusage.d.ts +32 -0
- package/esm/models/sttusage.js +25 -0
- package/esm/models/videogenerationrequest.d.ts +6 -9
- package/esm/models/videogenerationrequest.js +5 -5
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/esm/sdk/stt.d.ts +13 -0
- package/esm/sdk/stt.js +19 -0
- package/jsr.json +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OpenRouterCore } from "../core.js";
|
|
2
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
3
|
+
import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
|
|
4
|
+
import * as errors from "../models/errors/index.js";
|
|
5
|
+
import { OpenRouterError } from "../models/errors/openroutererror.js";
|
|
6
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
7
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
8
|
+
import * as models from "../models/index.js";
|
|
9
|
+
import * as operations from "../models/operations/index.js";
|
|
10
|
+
import { APIPromise } from "../types/async.js";
|
|
11
|
+
import { Result } from "../types/fp.js";
|
|
12
|
+
/**
|
|
13
|
+
* Create transcription
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Transcribes audio into text
|
|
17
|
+
*/
|
|
18
|
+
export declare function sttCreateTranscription(client: OpenRouterCore, request: operations.CreateAudioTranscriptionsRequest, options?: RequestOptions): APIPromise<Result<models.STTResponse, errors.BadRequestResponseError | errors.UnauthorizedResponseError | errors.PaymentRequiredResponseError | errors.NotFoundResponseError | errors.TooManyRequestsResponseError | errors.InternalServerResponseError | errors.BadGatewayResponseError | errors.ServiceUnavailableResponseError | errors.EdgeNetworkTimeoutResponseError | errors.ProviderOverloadedResponseError | OpenRouterError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError>>;
|
|
19
|
+
//# sourceMappingURL=sttCreateTranscription.d.ts.map
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 90b735003ac7
|
|
4
|
+
*/
|
|
5
|
+
import { encodeJSON, encodeSimple } from "../lib/encodings.js";
|
|
6
|
+
import * as M from "../lib/matchers.js";
|
|
7
|
+
import { compactMap } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
10
|
+
import { pathToFunc } from "../lib/url.js";
|
|
11
|
+
import * as errors from "../models/errors/index.js";
|
|
12
|
+
import * as models from "../models/index.js";
|
|
13
|
+
import * as operations from "../models/operations/index.js";
|
|
14
|
+
import { APIPromise } from "../types/async.js";
|
|
15
|
+
/**
|
|
16
|
+
* Create transcription
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Transcribes audio into text
|
|
20
|
+
*/
|
|
21
|
+
export function sttCreateTranscription(client, request, options) {
|
|
22
|
+
return new APIPromise($do(client, request, options));
|
|
23
|
+
}
|
|
24
|
+
async function $do(client, request, options) {
|
|
25
|
+
const parsed = safeParse(request, (value) => operations.CreateAudioTranscriptionsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
26
|
+
if (!parsed.ok) {
|
|
27
|
+
return [parsed, { status: "invalid" }];
|
|
28
|
+
}
|
|
29
|
+
const payload = parsed.value;
|
|
30
|
+
const body = encodeJSON("body", payload.STTRequest, { explode: true });
|
|
31
|
+
const path = pathToFunc("/audio/transcriptions")();
|
|
32
|
+
const headers = new Headers(compactMap({
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Accept: "application/json",
|
|
35
|
+
"HTTP-Referer": encodeSimple("HTTP-Referer", payload["HTTP-Referer"] ?? client._options.httpReferer, { explode: false, charEncoding: "none" }),
|
|
36
|
+
"X-OpenRouter-Categories": encodeSimple("X-OpenRouter-Categories", payload.appCategories ?? client._options.appCategories, { explode: false, charEncoding: "none" }),
|
|
37
|
+
"X-OpenRouter-Title": encodeSimple("X-OpenRouter-Title", payload.appTitle ?? client._options.appTitle, { explode: false, charEncoding: "none" }),
|
|
38
|
+
}));
|
|
39
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
40
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
41
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
42
|
+
const context = {
|
|
43
|
+
options: client._options,
|
|
44
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
45
|
+
operationID: "createAudioTranscriptions",
|
|
46
|
+
oAuth2Scopes: null,
|
|
47
|
+
resolvedSecurity: requestSecurity,
|
|
48
|
+
securitySource: client._options.apiKey,
|
|
49
|
+
retryConfig: options?.retries
|
|
50
|
+
|| client._options.retryConfig
|
|
51
|
+
|| {
|
|
52
|
+
strategy: "backoff",
|
|
53
|
+
backoff: {
|
|
54
|
+
initialInterval: 500,
|
|
55
|
+
maxInterval: 60000,
|
|
56
|
+
exponent: 1.5,
|
|
57
|
+
maxElapsedTime: 3600000,
|
|
58
|
+
},
|
|
59
|
+
retryConnectionErrors: true,
|
|
60
|
+
}
|
|
61
|
+
|| { strategy: "none" },
|
|
62
|
+
retryCodes: options?.retryCodes || ["5XX"],
|
|
63
|
+
};
|
|
64
|
+
const requestRes = client._createRequest(context, {
|
|
65
|
+
security: requestSecurity,
|
|
66
|
+
method: "POST",
|
|
67
|
+
baseURL: options?.serverURL,
|
|
68
|
+
path: path,
|
|
69
|
+
headers: headers,
|
|
70
|
+
body: body,
|
|
71
|
+
userAgent: client._options.userAgent,
|
|
72
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
73
|
+
}, options);
|
|
74
|
+
if (!requestRes.ok) {
|
|
75
|
+
return [requestRes, { status: "invalid" }];
|
|
76
|
+
}
|
|
77
|
+
const req = requestRes.value;
|
|
78
|
+
const doResult = await client._do(req, {
|
|
79
|
+
context,
|
|
80
|
+
errorCodes: [
|
|
81
|
+
"400",
|
|
82
|
+
"401",
|
|
83
|
+
"402",
|
|
84
|
+
"404",
|
|
85
|
+
"429",
|
|
86
|
+
"4XX",
|
|
87
|
+
"500",
|
|
88
|
+
"502",
|
|
89
|
+
"503",
|
|
90
|
+
"524",
|
|
91
|
+
"529",
|
|
92
|
+
"5XX",
|
|
93
|
+
],
|
|
94
|
+
retryConfig: context.retryConfig,
|
|
95
|
+
retryCodes: context.retryCodes,
|
|
96
|
+
});
|
|
97
|
+
if (!doResult.ok) {
|
|
98
|
+
return [doResult, { status: "request-error", request: req }];
|
|
99
|
+
}
|
|
100
|
+
const response = doResult.value;
|
|
101
|
+
const responseFields = {
|
|
102
|
+
HttpMeta: { Response: response, Request: req },
|
|
103
|
+
};
|
|
104
|
+
const [result] = await M.match(M.json(200, models.STTResponse$inboundSchema), M.jsonErr(400, errors.BadRequestResponseError$inboundSchema), M.jsonErr(401, errors.UnauthorizedResponseError$inboundSchema), M.jsonErr(402, errors.PaymentRequiredResponseError$inboundSchema), M.jsonErr(404, errors.NotFoundResponseError$inboundSchema), M.jsonErr(429, errors.TooManyRequestsResponseError$inboundSchema), M.jsonErr(500, errors.InternalServerResponseError$inboundSchema), M.jsonErr(502, errors.BadGatewayResponseError$inboundSchema), M.jsonErr(503, errors.ServiceUnavailableResponseError$inboundSchema), M.jsonErr(524, errors.EdgeNetworkTimeoutResponseError$inboundSchema), M.jsonErr(529, errors.ProviderOverloadedResponseError$inboundSchema), M.fail("4XX"), M.fail("5XX"))(response, req, { extraFields: responseFields });
|
|
105
|
+
if (!result.ok) {
|
|
106
|
+
return [result, { status: "complete", request: req, response }];
|
|
107
|
+
}
|
|
108
|
+
return [result, { status: "complete", request: req, response }];
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=sttCreateTranscription.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -49,8 +49,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
49
49
|
export declare const SDK_METADATA: {
|
|
50
50
|
readonly language: "typescript";
|
|
51
51
|
readonly openapiDocVersion: "1.0.0";
|
|
52
|
-
readonly sdkVersion: "0.12.
|
|
52
|
+
readonly sdkVersion: "0.12.25";
|
|
53
53
|
readonly genVersion: "2.879.1";
|
|
54
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.12.
|
|
54
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.12.25 2.879.1 1.0.0 @openrouter/sdk";
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -26,8 +26,8 @@ export function serverURLFromOptions(options) {
|
|
|
26
26
|
export const SDK_METADATA = {
|
|
27
27
|
language: "typescript",
|
|
28
28
|
openapiDocVersion: "1.0.0",
|
|
29
|
-
sdkVersion: "0.12.
|
|
29
|
+
sdkVersion: "0.12.25",
|
|
30
30
|
genVersion: "2.879.1",
|
|
31
|
-
userAgent: "speakeasy-sdk/typescript 0.12.
|
|
31
|
+
userAgent: "speakeasy-sdk/typescript 0.12.25 2.879.1 1.0.0 @openrouter/sdk",
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=config.js.map
|
package/esm/models/index.d.ts
CHANGED
|
@@ -202,6 +202,7 @@ export * from "./preview20250311websearchservertool.js";
|
|
|
202
202
|
export * from "./previewwebsearchservertool.js";
|
|
203
203
|
export * from "./previewwebsearchuserlocation.js";
|
|
204
204
|
export * from "./providername.js";
|
|
205
|
+
export * from "./provideroptions.js";
|
|
205
206
|
export * from "./provideroverloadedresponseerrordata.js";
|
|
206
207
|
export * from "./providerpreferences.js";
|
|
207
208
|
export * from "./providerresponse.js";
|
|
@@ -251,6 +252,10 @@ export * from "./streameventsresponseoutputitemadded.js";
|
|
|
251
252
|
export * from "./streameventsresponseoutputitemdone.js";
|
|
252
253
|
export * from "./streamlogprob.js";
|
|
253
254
|
export * from "./streamlogprobtoplogprob.js";
|
|
255
|
+
export * from "./sttinputaudio.js";
|
|
256
|
+
export * from "./sttrequest.js";
|
|
257
|
+
export * from "./sttresponse.js";
|
|
258
|
+
export * from "./sttusage.js";
|
|
254
259
|
export * from "./textdeltaevent.js";
|
|
255
260
|
export * from "./textdoneevent.js";
|
|
256
261
|
export * from "./textextendedconfig.js";
|
package/esm/models/index.js
CHANGED
|
@@ -206,6 +206,7 @@ export * from "./preview20250311websearchservertool.js";
|
|
|
206
206
|
export * from "./previewwebsearchservertool.js";
|
|
207
207
|
export * from "./previewwebsearchuserlocation.js";
|
|
208
208
|
export * from "./providername.js";
|
|
209
|
+
export * from "./provideroptions.js";
|
|
209
210
|
export * from "./provideroverloadedresponseerrordata.js";
|
|
210
211
|
export * from "./providerpreferences.js";
|
|
211
212
|
export * from "./providerresponse.js";
|
|
@@ -255,6 +256,10 @@ export * from "./streameventsresponseoutputitemadded.js";
|
|
|
255
256
|
export * from "./streameventsresponseoutputitemdone.js";
|
|
256
257
|
export * from "./streamlogprob.js";
|
|
257
258
|
export * from "./streamlogprobtoplogprob.js";
|
|
259
|
+
export * from "./sttinputaudio.js";
|
|
260
|
+
export * from "./sttrequest.js";
|
|
261
|
+
export * from "./sttresponse.js";
|
|
262
|
+
export * from "./sttusage.js";
|
|
258
263
|
export * from "./textdeltaevent.js";
|
|
259
264
|
export * from "./textdoneevent.js";
|
|
260
265
|
export * from "./textextendedconfig.js";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import * as models from "../index.js";
|
|
3
|
+
export type CreateAudioTranscriptionsGlobals = {
|
|
4
|
+
/**
|
|
5
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
6
|
+
*
|
|
7
|
+
* @remarks
|
|
8
|
+
* This is used to track API usage per application.
|
|
9
|
+
*/
|
|
10
|
+
httpReferer?: string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
*/
|
|
16
|
+
appTitle?: string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
*/
|
|
22
|
+
appCategories?: string | undefined;
|
|
23
|
+
};
|
|
24
|
+
export type CreateAudioTranscriptionsRequest = {
|
|
25
|
+
/**
|
|
26
|
+
* The app identifier should be your app's URL and is used as the primary identifier for rankings.
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* This is used to track API usage per application.
|
|
30
|
+
*/
|
|
31
|
+
httpReferer?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* The app display name allows you to customize how your app appears in OpenRouter's dashboard.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
*/
|
|
37
|
+
appTitle?: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Comma-separated list of app categories (e.g. "cli-agent,cloud-agent"). Used for marketplace rankings.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
*/
|
|
43
|
+
appCategories?: string | undefined;
|
|
44
|
+
sttRequest: models.STTRequest;
|
|
45
|
+
};
|
|
46
|
+
/** @internal */
|
|
47
|
+
export type CreateAudioTranscriptionsRequest$Outbound = {
|
|
48
|
+
"HTTP-Referer"?: string | undefined;
|
|
49
|
+
appTitle?: string | undefined;
|
|
50
|
+
appCategories?: string | undefined;
|
|
51
|
+
STTRequest: models.STTRequest$Outbound;
|
|
52
|
+
};
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const CreateAudioTranscriptionsRequest$outboundSchema: z.ZodType<CreateAudioTranscriptionsRequest$Outbound, CreateAudioTranscriptionsRequest>;
|
|
55
|
+
export declare function createAudioTranscriptionsRequestToJSON(createAudioTranscriptionsRequest: CreateAudioTranscriptionsRequest): string;
|
|
56
|
+
//# sourceMappingURL=createaudiotranscriptions.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: cfb0e2ed254b
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import * as models from "../index.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const CreateAudioTranscriptionsRequest$outboundSchema = z.object({
|
|
10
|
+
httpReferer: z.string().optional(),
|
|
11
|
+
appTitle: z.string().optional(),
|
|
12
|
+
appCategories: z.string().optional(),
|
|
13
|
+
sttRequest: models.STTRequest$outboundSchema,
|
|
14
|
+
}).transform((v) => {
|
|
15
|
+
return remap$(v, {
|
|
16
|
+
httpReferer: "HTTP-Referer",
|
|
17
|
+
sttRequest: "STTRequest",
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
export function createAudioTranscriptionsRequestToJSON(createAudioTranscriptionsRequest) {
|
|
21
|
+
return JSON.stringify(CreateAudioTranscriptionsRequest$outboundSchema.parse(createAudioTranscriptionsRequest));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=createaudiotranscriptions.js.map
|
|
@@ -5,6 +5,7 @@ export * from "./bulkremoveworkspacemembers.js";
|
|
|
5
5
|
export * from "./bulkunassignkeysfromguardrail.js";
|
|
6
6
|
export * from "./bulkunassignmembersfromguardrail.js";
|
|
7
7
|
export * from "./createaudiospeech.js";
|
|
8
|
+
export * from "./createaudiotranscriptions.js";
|
|
8
9
|
export * from "./createauthkeyscode.js";
|
|
9
10
|
export * from "./createembeddings.js";
|
|
10
11
|
export * from "./createguardrail.js";
|
|
@@ -9,6 +9,7 @@ export * from "./bulkremoveworkspacemembers.js";
|
|
|
9
9
|
export * from "./bulkunassignkeysfromguardrail.js";
|
|
10
10
|
export * from "./bulkunassignmembersfromguardrail.js";
|
|
11
11
|
export * from "./createaudiospeech.js";
|
|
12
|
+
export * from "./createaudiotranscriptions.js";
|
|
12
13
|
export * from "./createauthkeyscode.js";
|
|
13
14
|
export * from "./createembeddings.js";
|
|
14
15
|
export * from "./createguardrail.js";
|
|
@@ -14,19 +14,19 @@ export type ActionOpenPage = {
|
|
|
14
14
|
type: "open_page";
|
|
15
15
|
url?: string | null | undefined;
|
|
16
16
|
};
|
|
17
|
-
export type
|
|
17
|
+
export type OutputWebSearchCallItemActionSearch = {
|
|
18
18
|
queries?: Array<string> | undefined;
|
|
19
19
|
query: string;
|
|
20
20
|
sources?: Array<WebSearchSource> | undefined;
|
|
21
21
|
type: "search";
|
|
22
22
|
};
|
|
23
|
-
export type Action =
|
|
23
|
+
export type Action = OutputWebSearchCallItemActionSearch | ActionOpenPage | ActionFindInPage | discriminatedUnionTypes.Unknown<"type">;
|
|
24
24
|
export declare const TypeWebSearchCall: {
|
|
25
25
|
readonly WebSearchCall: "web_search_call";
|
|
26
26
|
};
|
|
27
27
|
export type TypeWebSearchCall = ClosedEnum<typeof TypeWebSearchCall>;
|
|
28
28
|
export type OutputWebSearchCallItem = {
|
|
29
|
-
action:
|
|
29
|
+
action: OutputWebSearchCallItemActionSearch | ActionOpenPage | ActionFindInPage | discriminatedUnionTypes.Unknown<"type">;
|
|
30
30
|
id: string;
|
|
31
31
|
status: WebSearchStatus;
|
|
32
32
|
type: TypeWebSearchCall;
|
|
@@ -55,22 +55,22 @@ export declare const ActionOpenPage$outboundSchema: z.ZodType<ActionOpenPage$Out
|
|
|
55
55
|
export declare function actionOpenPageToJSON(actionOpenPage: ActionOpenPage): string;
|
|
56
56
|
export declare function actionOpenPageFromJSON(jsonString: string): SafeParseResult<ActionOpenPage, SDKValidationError>;
|
|
57
57
|
/** @internal */
|
|
58
|
-
export declare const
|
|
58
|
+
export declare const OutputWebSearchCallItemActionSearch$inboundSchema: z.ZodType<OutputWebSearchCallItemActionSearch, unknown>;
|
|
59
59
|
/** @internal */
|
|
60
|
-
export type
|
|
60
|
+
export type OutputWebSearchCallItemActionSearch$Outbound = {
|
|
61
61
|
queries?: Array<string> | undefined;
|
|
62
62
|
query: string;
|
|
63
63
|
sources?: Array<WebSearchSource$Outbound> | undefined;
|
|
64
64
|
type: "search";
|
|
65
65
|
};
|
|
66
66
|
/** @internal */
|
|
67
|
-
export declare const
|
|
68
|
-
export declare function
|
|
69
|
-
export declare function
|
|
67
|
+
export declare const OutputWebSearchCallItemActionSearch$outboundSchema: z.ZodType<OutputWebSearchCallItemActionSearch$Outbound, OutputWebSearchCallItemActionSearch>;
|
|
68
|
+
export declare function outputWebSearchCallItemActionSearchToJSON(outputWebSearchCallItemActionSearch: OutputWebSearchCallItemActionSearch): string;
|
|
69
|
+
export declare function outputWebSearchCallItemActionSearchFromJSON(jsonString: string): SafeParseResult<OutputWebSearchCallItemActionSearch, SDKValidationError>;
|
|
70
70
|
/** @internal */
|
|
71
71
|
export declare const Action$inboundSchema: z.ZodType<Action, unknown>;
|
|
72
72
|
/** @internal */
|
|
73
|
-
export type Action$Outbound =
|
|
73
|
+
export type Action$Outbound = OutputWebSearchCallItemActionSearch$Outbound | ActionOpenPage$Outbound | ActionFindInPage$Outbound;
|
|
74
74
|
/** @internal */
|
|
75
75
|
export declare const Action$outboundSchema: z.ZodType<Action$Outbound, Action>;
|
|
76
76
|
export declare function actionToJSON(action: Action): string;
|
|
@@ -83,7 +83,7 @@ export declare const TypeWebSearchCall$outboundSchema: z.ZodEnum<typeof TypeWebS
|
|
|
83
83
|
export declare const OutputWebSearchCallItem$inboundSchema: z.ZodType<OutputWebSearchCallItem, unknown>;
|
|
84
84
|
/** @internal */
|
|
85
85
|
export type OutputWebSearchCallItem$Outbound = {
|
|
86
|
-
action:
|
|
86
|
+
action: OutputWebSearchCallItemActionSearch$Outbound | ActionOpenPage$Outbound | ActionFindInPage$Outbound;
|
|
87
87
|
id: string;
|
|
88
88
|
status: string;
|
|
89
89
|
type: string;
|
|
@@ -45,36 +45,35 @@ export function actionOpenPageFromJSON(jsonString) {
|
|
|
45
45
|
return safeParse(jsonString, (x) => ActionOpenPage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ActionOpenPage' from JSON`);
|
|
46
46
|
}
|
|
47
47
|
/** @internal */
|
|
48
|
-
export const
|
|
49
|
-
.object({
|
|
48
|
+
export const OutputWebSearchCallItemActionSearch$inboundSchema = z.object({
|
|
50
49
|
queries: z.array(z.string()).optional(),
|
|
51
50
|
query: z.string(),
|
|
52
51
|
sources: z.array(WebSearchSource$inboundSchema).optional(),
|
|
53
52
|
type: z.literal("search"),
|
|
54
53
|
});
|
|
55
54
|
/** @internal */
|
|
56
|
-
export const
|
|
55
|
+
export const OutputWebSearchCallItemActionSearch$outboundSchema = z.object({
|
|
57
56
|
queries: z.array(z.string()).optional(),
|
|
58
57
|
query: z.string(),
|
|
59
58
|
sources: z.array(WebSearchSource$outboundSchema).optional(),
|
|
60
59
|
type: z.literal("search"),
|
|
61
60
|
});
|
|
62
|
-
export function
|
|
63
|
-
return JSON.stringify(
|
|
61
|
+
export function outputWebSearchCallItemActionSearchToJSON(outputWebSearchCallItemActionSearch) {
|
|
62
|
+
return JSON.stringify(OutputWebSearchCallItemActionSearch$outboundSchema.parse(outputWebSearchCallItemActionSearch));
|
|
64
63
|
}
|
|
65
|
-
export function
|
|
66
|
-
return safeParse(jsonString, (x) =>
|
|
64
|
+
export function outputWebSearchCallItemActionSearchFromJSON(jsonString) {
|
|
65
|
+
return safeParse(jsonString, (x) => OutputWebSearchCallItemActionSearch$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputWebSearchCallItemActionSearch' from JSON`);
|
|
67
66
|
}
|
|
68
67
|
/** @internal */
|
|
69
68
|
export const Action$inboundSchema = discriminatedUnion("type", {
|
|
70
|
-
search: z.lazy(() =>
|
|
69
|
+
search: z.lazy(() => OutputWebSearchCallItemActionSearch$inboundSchema),
|
|
71
70
|
open_page: z.lazy(() => ActionOpenPage$inboundSchema),
|
|
72
71
|
find_in_page: z.lazy(() => ActionFindInPage$inboundSchema),
|
|
73
72
|
});
|
|
74
73
|
/** @internal */
|
|
75
74
|
export const Action$outboundSchema = z
|
|
76
75
|
.union([
|
|
77
|
-
z.lazy(() =>
|
|
76
|
+
z.lazy(() => OutputWebSearchCallItemActionSearch$outboundSchema),
|
|
78
77
|
z.lazy(() => ActionOpenPage$outboundSchema),
|
|
79
78
|
z.lazy(() => ActionFindInPage$outboundSchema),
|
|
80
79
|
]);
|
|
@@ -91,7 +90,7 @@ export const TypeWebSearchCall$outboundSchema = TypeWebSearchCall$inboundSchema;
|
|
|
91
90
|
/** @internal */
|
|
92
91
|
export const OutputWebSearchCallItem$inboundSchema = z.object({
|
|
93
92
|
action: discriminatedUnion("type", {
|
|
94
|
-
search: z.lazy(() =>
|
|
93
|
+
search: z.lazy(() => OutputWebSearchCallItemActionSearch$inboundSchema),
|
|
95
94
|
open_page: z.lazy(() => ActionOpenPage$inboundSchema),
|
|
96
95
|
find_in_page: z.lazy(() => ActionFindInPage$inboundSchema),
|
|
97
96
|
}),
|
|
@@ -102,7 +101,7 @@ export const OutputWebSearchCallItem$inboundSchema = z.object({
|
|
|
102
101
|
/** @internal */
|
|
103
102
|
export const OutputWebSearchCallItem$outboundSchema = z.object({
|
|
104
103
|
action: z.union([
|
|
105
|
-
z.lazy(() =>
|
|
104
|
+
z.lazy(() => OutputWebSearchCallItemActionSearch$outboundSchema),
|
|
106
105
|
z.lazy(() => ActionOpenPage$outboundSchema),
|
|
107
106
|
z.lazy(() => ActionFindInPage$outboundSchema),
|
|
108
107
|
]),
|
|
@@ -3,26 +3,82 @@ import { ClosedEnum } from "../types/enums.js";
|
|
|
3
3
|
import { Result as SafeParseResult } from "../types/fp.js";
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
5
|
import { ToolCallStatus } from "./toolcallstatus.js";
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const OutputWebSearchServerToolItemTypeURL: {
|
|
7
|
+
readonly Url: "url";
|
|
8
|
+
};
|
|
9
|
+
export type OutputWebSearchServerToolItemTypeURL = ClosedEnum<typeof OutputWebSearchServerToolItemTypeURL>;
|
|
10
|
+
export type Source = {
|
|
11
|
+
type: OutputWebSearchServerToolItemTypeURL;
|
|
12
|
+
url: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const OutputWebSearchServerToolItemTypeSearch: {
|
|
15
|
+
readonly Search: "search";
|
|
16
|
+
};
|
|
17
|
+
export type OutputWebSearchServerToolItemTypeSearch = ClosedEnum<typeof OutputWebSearchServerToolItemTypeSearch>;
|
|
18
|
+
/**
|
|
19
|
+
* The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider.
|
|
20
|
+
*/
|
|
21
|
+
export type OutputWebSearchServerToolItemAction = {
|
|
22
|
+
query: string;
|
|
23
|
+
sources?: Array<Source> | undefined;
|
|
24
|
+
type: OutputWebSearchServerToolItemTypeSearch;
|
|
25
|
+
};
|
|
26
|
+
export declare const OutputWebSearchServerToolItemTypeOpenrouterWebSearch: {
|
|
7
27
|
readonly OpenrouterWebSearch: "openrouter:web_search";
|
|
8
28
|
};
|
|
9
|
-
export type
|
|
29
|
+
export type OutputWebSearchServerToolItemTypeOpenrouterWebSearch = ClosedEnum<typeof OutputWebSearchServerToolItemTypeOpenrouterWebSearch>;
|
|
10
30
|
/**
|
|
11
31
|
* An openrouter:web_search server tool output item
|
|
12
32
|
*/
|
|
13
33
|
export type OutputWebSearchServerToolItem = {
|
|
34
|
+
/**
|
|
35
|
+
* The search action performed, matching OpenAI web_search_call.action shape. Includes the query the model issued and optional source URLs returned by the search provider.
|
|
36
|
+
*/
|
|
37
|
+
action?: OutputWebSearchServerToolItemAction | undefined;
|
|
14
38
|
id?: string | undefined;
|
|
15
39
|
status: ToolCallStatus;
|
|
16
|
-
type:
|
|
40
|
+
type: OutputWebSearchServerToolItemTypeOpenrouterWebSearch;
|
|
41
|
+
};
|
|
42
|
+
/** @internal */
|
|
43
|
+
export declare const OutputWebSearchServerToolItemTypeURL$inboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeURL>;
|
|
44
|
+
/** @internal */
|
|
45
|
+
export declare const OutputWebSearchServerToolItemTypeURL$outboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeURL>;
|
|
46
|
+
/** @internal */
|
|
47
|
+
export declare const Source$inboundSchema: z.ZodType<Source, unknown>;
|
|
48
|
+
/** @internal */
|
|
49
|
+
export type Source$Outbound = {
|
|
50
|
+
type: string;
|
|
51
|
+
url: string;
|
|
52
|
+
};
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const Source$outboundSchema: z.ZodType<Source$Outbound, Source>;
|
|
55
|
+
export declare function sourceToJSON(source: Source): string;
|
|
56
|
+
export declare function sourceFromJSON(jsonString: string): SafeParseResult<Source, SDKValidationError>;
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare const OutputWebSearchServerToolItemTypeSearch$inboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeSearch>;
|
|
59
|
+
/** @internal */
|
|
60
|
+
export declare const OutputWebSearchServerToolItemTypeSearch$outboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeSearch>;
|
|
61
|
+
/** @internal */
|
|
62
|
+
export declare const OutputWebSearchServerToolItemAction$inboundSchema: z.ZodType<OutputWebSearchServerToolItemAction, unknown>;
|
|
63
|
+
/** @internal */
|
|
64
|
+
export type OutputWebSearchServerToolItemAction$Outbound = {
|
|
65
|
+
query: string;
|
|
66
|
+
sources?: Array<Source$Outbound> | undefined;
|
|
67
|
+
type: string;
|
|
17
68
|
};
|
|
18
69
|
/** @internal */
|
|
19
|
-
export declare const
|
|
70
|
+
export declare const OutputWebSearchServerToolItemAction$outboundSchema: z.ZodType<OutputWebSearchServerToolItemAction$Outbound, OutputWebSearchServerToolItemAction>;
|
|
71
|
+
export declare function outputWebSearchServerToolItemActionToJSON(outputWebSearchServerToolItemAction: OutputWebSearchServerToolItemAction): string;
|
|
72
|
+
export declare function outputWebSearchServerToolItemActionFromJSON(jsonString: string): SafeParseResult<OutputWebSearchServerToolItemAction, SDKValidationError>;
|
|
73
|
+
/** @internal */
|
|
74
|
+
export declare const OutputWebSearchServerToolItemTypeOpenrouterWebSearch$inboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeOpenrouterWebSearch>;
|
|
20
75
|
/** @internal */
|
|
21
|
-
export declare const
|
|
76
|
+
export declare const OutputWebSearchServerToolItemTypeOpenrouterWebSearch$outboundSchema: z.ZodEnum<typeof OutputWebSearchServerToolItemTypeOpenrouterWebSearch>;
|
|
22
77
|
/** @internal */
|
|
23
78
|
export declare const OutputWebSearchServerToolItem$inboundSchema: z.ZodType<OutputWebSearchServerToolItem, unknown>;
|
|
24
79
|
/** @internal */
|
|
25
80
|
export type OutputWebSearchServerToolItem$Outbound = {
|
|
81
|
+
action?: OutputWebSearchServerToolItemAction$Outbound | undefined;
|
|
26
82
|
id?: string | undefined;
|
|
27
83
|
status: string;
|
|
28
84
|
type: string;
|
|
@@ -5,24 +5,78 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import { ToolCallStatus$inboundSchema, ToolCallStatus$outboundSchema, } from "./toolcallstatus.js";
|
|
8
|
-
export const
|
|
8
|
+
export const OutputWebSearchServerToolItemTypeURL = {
|
|
9
|
+
Url: "url",
|
|
10
|
+
};
|
|
11
|
+
export const OutputWebSearchServerToolItemTypeSearch = {
|
|
12
|
+
Search: "search",
|
|
13
|
+
};
|
|
14
|
+
export const OutputWebSearchServerToolItemTypeOpenrouterWebSearch = {
|
|
9
15
|
OpenrouterWebSearch: "openrouter:web_search",
|
|
10
16
|
};
|
|
11
17
|
/** @internal */
|
|
12
|
-
export const
|
|
18
|
+
export const OutputWebSearchServerToolItemTypeURL$inboundSchema = z.enum(OutputWebSearchServerToolItemTypeURL);
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const OutputWebSearchServerToolItemTypeURL$outboundSchema = OutputWebSearchServerToolItemTypeURL$inboundSchema;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export const Source$inboundSchema = z.object({
|
|
23
|
+
type: OutputWebSearchServerToolItemTypeURL$inboundSchema,
|
|
24
|
+
url: z.string(),
|
|
25
|
+
});
|
|
26
|
+
/** @internal */
|
|
27
|
+
export const Source$outboundSchema = z
|
|
28
|
+
.object({
|
|
29
|
+
type: OutputWebSearchServerToolItemTypeURL$outboundSchema,
|
|
30
|
+
url: z.string(),
|
|
31
|
+
});
|
|
32
|
+
export function sourceToJSON(source) {
|
|
33
|
+
return JSON.stringify(Source$outboundSchema.parse(source));
|
|
34
|
+
}
|
|
35
|
+
export function sourceFromJSON(jsonString) {
|
|
36
|
+
return safeParse(jsonString, (x) => Source$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Source' from JSON`);
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const OutputWebSearchServerToolItemTypeSearch$inboundSchema = z.enum(OutputWebSearchServerToolItemTypeSearch);
|
|
40
|
+
/** @internal */
|
|
41
|
+
export const OutputWebSearchServerToolItemTypeSearch$outboundSchema = OutputWebSearchServerToolItemTypeSearch$inboundSchema;
|
|
42
|
+
/** @internal */
|
|
43
|
+
export const OutputWebSearchServerToolItemAction$inboundSchema = z.object({
|
|
44
|
+
query: z.string(),
|
|
45
|
+
sources: z.array(z.lazy(() => Source$inboundSchema)).optional(),
|
|
46
|
+
type: OutputWebSearchServerToolItemTypeSearch$inboundSchema,
|
|
47
|
+
});
|
|
48
|
+
/** @internal */
|
|
49
|
+
export const OutputWebSearchServerToolItemAction$outboundSchema = z.object({
|
|
50
|
+
query: z.string(),
|
|
51
|
+
sources: z.array(z.lazy(() => Source$outboundSchema)).optional(),
|
|
52
|
+
type: OutputWebSearchServerToolItemTypeSearch$outboundSchema,
|
|
53
|
+
});
|
|
54
|
+
export function outputWebSearchServerToolItemActionToJSON(outputWebSearchServerToolItemAction) {
|
|
55
|
+
return JSON.stringify(OutputWebSearchServerToolItemAction$outboundSchema.parse(outputWebSearchServerToolItemAction));
|
|
56
|
+
}
|
|
57
|
+
export function outputWebSearchServerToolItemActionFromJSON(jsonString) {
|
|
58
|
+
return safeParse(jsonString, (x) => OutputWebSearchServerToolItemAction$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OutputWebSearchServerToolItemAction' from JSON`);
|
|
59
|
+
}
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const OutputWebSearchServerToolItemTypeOpenrouterWebSearch$inboundSchema = z
|
|
62
|
+
.enum(OutputWebSearchServerToolItemTypeOpenrouterWebSearch);
|
|
13
63
|
/** @internal */
|
|
14
|
-
export const
|
|
64
|
+
export const OutputWebSearchServerToolItemTypeOpenrouterWebSearch$outboundSchema = OutputWebSearchServerToolItemTypeOpenrouterWebSearch$inboundSchema;
|
|
15
65
|
/** @internal */
|
|
16
66
|
export const OutputWebSearchServerToolItem$inboundSchema = z.object({
|
|
67
|
+
action: z.lazy(() => OutputWebSearchServerToolItemAction$inboundSchema)
|
|
68
|
+
.optional(),
|
|
17
69
|
id: z.string().optional(),
|
|
18
70
|
status: ToolCallStatus$inboundSchema,
|
|
19
|
-
type:
|
|
71
|
+
type: OutputWebSearchServerToolItemTypeOpenrouterWebSearch$inboundSchema,
|
|
20
72
|
});
|
|
21
73
|
/** @internal */
|
|
22
74
|
export const OutputWebSearchServerToolItem$outboundSchema = z.object({
|
|
75
|
+
action: z.lazy(() => OutputWebSearchServerToolItemAction$outboundSchema)
|
|
76
|
+
.optional(),
|
|
23
77
|
id: z.string().optional(),
|
|
24
78
|
status: ToolCallStatus$outboundSchema,
|
|
25
|
-
type:
|
|
79
|
+
type: OutputWebSearchServerToolItemTypeOpenrouterWebSearch$outboundSchema,
|
|
26
80
|
});
|
|
27
81
|
export function outputWebSearchServerToolItemToJSON(outputWebSearchServerToolItem) {
|
|
28
82
|
return JSON.stringify(OutputWebSearchServerToolItem$outboundSchema.parse(outputWebSearchServerToolItem));
|