@openrouter/sdk 0.1.0 → 0.1.2
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/embeddingsGenerate.d.ts +18 -0
- package/esm/funcs/embeddingsGenerate.js +97 -0
- package/esm/lib/config.d.ts +2 -2
- package/esm/lib/config.js +2 -2
- package/esm/models/chaterror.d.ts +4 -4
- package/esm/models/chaterror.js +4 -4
- package/esm/models/chatgenerationparams.d.ts +4 -2
- package/esm/models/chatgenerationparams.js +4 -2
- package/esm/models/chatmessagecontentitemaudio.d.ts +15 -15
- package/esm/models/chatmessagecontentitemaudio.js +15 -16
- package/esm/models/completioncreateparams.d.ts +4 -2
- package/esm/models/completioncreateparams.js +4 -2
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/openairesponsesinputunion.d.ts +21 -0
- package/esm/models/openairesponsesinputunion.js +31 -0
- package/esm/models/openairesponsesprompt.d.ts +4 -28
- package/esm/models/openairesponsesprompt.js +16 -36
- package/esm/models/openresponseseasyinputmessage.d.ts +13 -0
- package/esm/models/openresponseseasyinputmessage.js +19 -0
- package/esm/models/openresponsesinputmessageitem.d.ts +9 -0
- package/esm/models/openresponsesinputmessageitem.js +13 -0
- package/esm/models/operations/createembeddings.d.ts +582 -0
- package/esm/models/operations/createembeddings.js +608 -0
- package/esm/models/operations/getgeneration.d.ts +5 -0
- package/esm/models/operations/getgeneration.js +4 -0
- package/esm/models/operations/getparameters.d.ts +10 -10
- package/esm/models/operations/getparameters.js +14 -14
- package/esm/models/operations/index.d.ts +1 -0
- package/esm/models/operations/index.js +1 -0
- package/esm/models/responseinputaudio.d.ts +103 -0
- package/esm/models/responseinputaudio.js +114 -0
- package/esm/react-query/embeddingsGenerate.d.ts +23 -0
- package/esm/react-query/embeddingsGenerate.js +42 -0
- package/esm/react-query/index.d.ts +1 -0
- package/esm/react-query/index.js +1 -0
- package/esm/react-query/parametersGetParameters.d.ts +3 -3
- package/esm/sdk/embeddings.d.ts +12 -0
- package/esm/sdk/embeddings.js +18 -0
- package/esm/sdk/sdk.d.ts +3 -0
- package/esm/sdk/sdk.js +4 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
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 operations from "../models/operations/index.js";
|
|
9
|
+
import { APIPromise } from "../types/async.js";
|
|
10
|
+
import { Result } from "../types/fp.js";
|
|
11
|
+
/**
|
|
12
|
+
* Submit an embedding request
|
|
13
|
+
*
|
|
14
|
+
* @remarks
|
|
15
|
+
* Submits an embedding request to the embeddings router
|
|
16
|
+
*/
|
|
17
|
+
export declare function embeddingsGenerate(client: OpenRouterCore, request: operations.CreateEmbeddingsRequest, options?: RequestOptions): APIPromise<Result<operations.CreateEmbeddingsResponse, 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>>;
|
|
18
|
+
//# sourceMappingURL=embeddingsGenerate.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
5
|
+
import * as M from "../lib/matchers.js";
|
|
6
|
+
import { compactMap } from "../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../lib/schemas.js";
|
|
8
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
9
|
+
import { pathToFunc } from "../lib/url.js";
|
|
10
|
+
import * as errors from "../models/errors/index.js";
|
|
11
|
+
import * as operations from "../models/operations/index.js";
|
|
12
|
+
import { APIPromise } from "../types/async.js";
|
|
13
|
+
/**
|
|
14
|
+
* Submit an embedding request
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Submits an embedding request to the embeddings router
|
|
18
|
+
*/
|
|
19
|
+
export function embeddingsGenerate(client, request, options) {
|
|
20
|
+
return new APIPromise($do(client, request, options));
|
|
21
|
+
}
|
|
22
|
+
async function $do(client, request, options) {
|
|
23
|
+
const parsed = safeParse(request, (value) => operations.CreateEmbeddingsRequest$outboundSchema.parse(value), "Input validation failed");
|
|
24
|
+
if (!parsed.ok) {
|
|
25
|
+
return [parsed, { status: "invalid" }];
|
|
26
|
+
}
|
|
27
|
+
const payload = parsed.value;
|
|
28
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
29
|
+
const path = pathToFunc("/embeddings")();
|
|
30
|
+
const headers = new Headers(compactMap({
|
|
31
|
+
"Content-Type": "application/json",
|
|
32
|
+
Accept: "application/json;q=1, text/event-stream;q=0",
|
|
33
|
+
}));
|
|
34
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
35
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
36
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
37
|
+
const context = {
|
|
38
|
+
options: client._options,
|
|
39
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
40
|
+
operationID: "createEmbeddings",
|
|
41
|
+
oAuth2Scopes: null,
|
|
42
|
+
resolvedSecurity: requestSecurity,
|
|
43
|
+
securitySource: client._options.apiKey,
|
|
44
|
+
retryConfig: options?.retries
|
|
45
|
+
|| client._options.retryConfig
|
|
46
|
+
|| { strategy: "none" },
|
|
47
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
48
|
+
};
|
|
49
|
+
const requestRes = client._createRequest(context, {
|
|
50
|
+
security: requestSecurity,
|
|
51
|
+
method: "POST",
|
|
52
|
+
baseURL: options?.serverURL,
|
|
53
|
+
path: path,
|
|
54
|
+
headers: headers,
|
|
55
|
+
body: body,
|
|
56
|
+
userAgent: client._options.userAgent,
|
|
57
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
58
|
+
}, options);
|
|
59
|
+
if (!requestRes.ok) {
|
|
60
|
+
return [requestRes, { status: "invalid" }];
|
|
61
|
+
}
|
|
62
|
+
const req = requestRes.value;
|
|
63
|
+
const doResult = await client._do(req, {
|
|
64
|
+
context,
|
|
65
|
+
errorCodes: [
|
|
66
|
+
"400",
|
|
67
|
+
"401",
|
|
68
|
+
"402",
|
|
69
|
+
"404",
|
|
70
|
+
"429",
|
|
71
|
+
"4XX",
|
|
72
|
+
"500",
|
|
73
|
+
"502",
|
|
74
|
+
"503",
|
|
75
|
+
"524",
|
|
76
|
+
"529",
|
|
77
|
+
"5XX",
|
|
78
|
+
],
|
|
79
|
+
retryConfig: context.retryConfig,
|
|
80
|
+
retryCodes: context.retryCodes,
|
|
81
|
+
});
|
|
82
|
+
if (!doResult.ok) {
|
|
83
|
+
return [doResult, { status: "request-error", request: req }];
|
|
84
|
+
}
|
|
85
|
+
const response = doResult.value;
|
|
86
|
+
const responseFields = {
|
|
87
|
+
HttpMeta: { Response: response, Request: req },
|
|
88
|
+
};
|
|
89
|
+
const [result] = await M.match(M.json(200, operations.CreateEmbeddingsResponse$inboundSchema), M.text(200, operations.CreateEmbeddingsResponse$inboundSchema, {
|
|
90
|
+
ctype: "text/event-stream",
|
|
91
|
+
}), 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 });
|
|
92
|
+
if (!result.ok) {
|
|
93
|
+
return [result, { status: "complete", request: req, response }];
|
|
94
|
+
}
|
|
95
|
+
return [result, { status: "complete", request: req, response }];
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=embeddingsGenerate.js.map
|
package/esm/lib/config.d.ts
CHANGED
|
@@ -37,8 +37,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
|
|
|
37
37
|
export declare const SDK_METADATA: {
|
|
38
38
|
readonly language: "typescript";
|
|
39
39
|
readonly openapiDocVersion: "1.0.0";
|
|
40
|
-
readonly sdkVersion: "0.1.
|
|
40
|
+
readonly sdkVersion: "0.1.2";
|
|
41
41
|
readonly genVersion: "2.739.1";
|
|
42
|
-
readonly userAgent: "speakeasy-sdk/typescript 0.1.
|
|
42
|
+
readonly userAgent: "speakeasy-sdk/typescript 0.1.2 2.739.1 1.0.0 @openrouter/sdk";
|
|
43
43
|
};
|
|
44
44
|
//# sourceMappingURL=config.d.ts.map
|
package/esm/lib/config.js
CHANGED
|
@@ -25,8 +25,8 @@ export function serverURLFromOptions(options) {
|
|
|
25
25
|
export const SDK_METADATA = {
|
|
26
26
|
language: "typescript",
|
|
27
27
|
openapiDocVersion: "1.0.0",
|
|
28
|
-
sdkVersion: "0.1.
|
|
28
|
+
sdkVersion: "0.1.2",
|
|
29
29
|
genVersion: "2.739.1",
|
|
30
|
-
userAgent: "speakeasy-sdk/typescript 0.1.
|
|
30
|
+
userAgent: "speakeasy-sdk/typescript 0.1.2 2.739.1 1.0.0 @openrouter/sdk",
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=config.js.map
|
|
@@ -5,8 +5,8 @@ export type Code = string | number;
|
|
|
5
5
|
export type ChatErrorError = {
|
|
6
6
|
code: string | number | null;
|
|
7
7
|
message: string;
|
|
8
|
-
param
|
|
9
|
-
type
|
|
8
|
+
param?: string | null | undefined;
|
|
9
|
+
type?: string | null | undefined;
|
|
10
10
|
};
|
|
11
11
|
/** @internal */
|
|
12
12
|
export declare const Code$inboundSchema: z.ZodType<Code, unknown>;
|
|
@@ -34,8 +34,8 @@ export declare const ChatErrorError$inboundSchema: z.ZodType<ChatErrorError, unk
|
|
|
34
34
|
export type ChatErrorError$Outbound = {
|
|
35
35
|
code: string | number | null;
|
|
36
36
|
message: string;
|
|
37
|
-
param
|
|
38
|
-
type
|
|
37
|
+
param?: string | null | undefined;
|
|
38
|
+
type?: string | null | undefined;
|
|
39
39
|
};
|
|
40
40
|
/** @internal */
|
|
41
41
|
export declare const ChatErrorError$outboundSchema: z.ZodType<ChatErrorError$Outbound, ChatErrorError>;
|
package/esm/models/chaterror.js
CHANGED
|
@@ -34,15 +34,15 @@ export function codeFromJSON(jsonString) {
|
|
|
34
34
|
export const ChatErrorError$inboundSchema = z.object({
|
|
35
35
|
code: z.nullable(z.union([z.string(), z.number()])),
|
|
36
36
|
message: z.string(),
|
|
37
|
-
param: z.nullable(z.string()),
|
|
38
|
-
type: z.string(),
|
|
37
|
+
param: z.nullable(z.string()).optional(),
|
|
38
|
+
type: z.nullable(z.string()).optional(),
|
|
39
39
|
});
|
|
40
40
|
/** @internal */
|
|
41
41
|
export const ChatErrorError$outboundSchema = z.object({
|
|
42
42
|
code: z.nullable(z.union([z.string(), z.number()])),
|
|
43
43
|
message: z.string(),
|
|
44
|
-
param: z.nullable(z.string()),
|
|
45
|
-
type: z.string(),
|
|
44
|
+
param: z.nullable(z.string()).optional(),
|
|
45
|
+
type: z.nullable(z.string()).optional(),
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* @internal
|
|
@@ -32,7 +32,8 @@ export type ChatGenerationParamsResponseFormatUnion = ResponseFormatJSONSchema |
|
|
|
32
32
|
export type ChatGenerationParamsStop = string | Array<string>;
|
|
33
33
|
export type ChatGenerationParams = {
|
|
34
34
|
messages: Array<Message>;
|
|
35
|
-
model
|
|
35
|
+
model?: string | undefined;
|
|
36
|
+
models?: Array<string> | undefined;
|
|
36
37
|
frequencyPenalty?: number | null | undefined;
|
|
37
38
|
logitBias?: {
|
|
38
39
|
[k: string]: number;
|
|
@@ -205,7 +206,8 @@ export declare const ChatGenerationParams$inboundSchema: z.ZodType<ChatGeneratio
|
|
|
205
206
|
/** @internal */
|
|
206
207
|
export type ChatGenerationParams$Outbound = {
|
|
207
208
|
messages: Array<Message$Outbound>;
|
|
208
|
-
model
|
|
209
|
+
model?: string | undefined;
|
|
210
|
+
models?: Array<string> | undefined;
|
|
209
211
|
frequency_penalty?: number | null | undefined;
|
|
210
212
|
logit_bias?: {
|
|
211
213
|
[k: string]: number;
|
|
@@ -198,7 +198,8 @@ export function chatGenerationParamsStopFromJSON(jsonString) {
|
|
|
198
198
|
/** @internal */
|
|
199
199
|
export const ChatGenerationParams$inboundSchema = z.object({
|
|
200
200
|
messages: z.array(Message$inboundSchema),
|
|
201
|
-
model: z.string(),
|
|
201
|
+
model: z.string().optional(),
|
|
202
|
+
models: z.array(z.string()).optional(),
|
|
202
203
|
frequency_penalty: z.nullable(z.number()).optional(),
|
|
203
204
|
logit_bias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
204
205
|
logprobs: z.nullable(z.boolean()).optional(),
|
|
@@ -241,7 +242,8 @@ export const ChatGenerationParams$inboundSchema = z.object({
|
|
|
241
242
|
/** @internal */
|
|
242
243
|
export const ChatGenerationParams$outboundSchema = z.object({
|
|
243
244
|
messages: z.array(Message$outboundSchema),
|
|
244
|
-
model: z.string(),
|
|
245
|
+
model: z.string().optional(),
|
|
246
|
+
models: z.array(z.string()).optional(),
|
|
245
247
|
frequencyPenalty: z.nullable(z.number()).optional(),
|
|
246
248
|
logitBias: z.nullable(z.record(z.string(), z.number())).optional(),
|
|
247
249
|
logprobs: z.nullable(z.boolean()).optional(),
|
|
@@ -12,13 +12,13 @@ export declare const ChatMessageContentItemAudioFormat: {
|
|
|
12
12
|
readonly Pcm24: "pcm24";
|
|
13
13
|
};
|
|
14
14
|
export type ChatMessageContentItemAudioFormat = OpenEnum<typeof ChatMessageContentItemAudioFormat>;
|
|
15
|
-
export type
|
|
15
|
+
export type ChatMessageContentItemAudioInputAudio = {
|
|
16
16
|
data: string;
|
|
17
17
|
format: ChatMessageContentItemAudioFormat;
|
|
18
18
|
};
|
|
19
19
|
export type ChatMessageContentItemAudio = {
|
|
20
20
|
type: "input_audio";
|
|
21
|
-
inputAudio:
|
|
21
|
+
inputAudio: ChatMessageContentItemAudioInputAudio;
|
|
22
22
|
};
|
|
23
23
|
/** @internal */
|
|
24
24
|
export declare const ChatMessageContentItemAudioFormat$inboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, unknown>;
|
|
@@ -35,34 +35,34 @@ export declare namespace ChatMessageContentItemAudioFormat$ {
|
|
|
35
35
|
const outboundSchema: z.ZodType<ChatMessageContentItemAudioFormat, ChatMessageContentItemAudioFormat, z.core.$ZodTypeInternals<ChatMessageContentItemAudioFormat, ChatMessageContentItemAudioFormat>>;
|
|
36
36
|
}
|
|
37
37
|
/** @internal */
|
|
38
|
-
export declare const
|
|
38
|
+
export declare const ChatMessageContentItemAudioInputAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown>;
|
|
39
39
|
/** @internal */
|
|
40
|
-
export type
|
|
40
|
+
export type ChatMessageContentItemAudioInputAudio$Outbound = {
|
|
41
41
|
data: string;
|
|
42
42
|
format: string;
|
|
43
43
|
};
|
|
44
44
|
/** @internal */
|
|
45
|
-
export declare const
|
|
45
|
+
export declare const ChatMessageContentItemAudioInputAudio$outboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio>;
|
|
46
46
|
/**
|
|
47
47
|
* @internal
|
|
48
48
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
49
49
|
*/
|
|
50
|
-
export declare namespace
|
|
51
|
-
/** @deprecated use `
|
|
52
|
-
const inboundSchema: z.ZodType<
|
|
53
|
-
/** @deprecated use `
|
|
54
|
-
const outboundSchema: z.ZodType<
|
|
55
|
-
/** @deprecated use `
|
|
56
|
-
type Outbound =
|
|
50
|
+
export declare namespace ChatMessageContentItemAudioInputAudio$ {
|
|
51
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$inboundSchema` instead. */
|
|
52
|
+
const inboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio, unknown, z.core.$ZodTypeInternals<ChatMessageContentItemAudioInputAudio, unknown>>;
|
|
53
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$outboundSchema` instead. */
|
|
54
|
+
const outboundSchema: z.ZodType<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio, z.core.$ZodTypeInternals<ChatMessageContentItemAudioInputAudio$Outbound, ChatMessageContentItemAudioInputAudio>>;
|
|
55
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$Outbound` instead. */
|
|
56
|
+
type Outbound = ChatMessageContentItemAudioInputAudio$Outbound;
|
|
57
57
|
}
|
|
58
|
-
export declare function
|
|
59
|
-
export declare function
|
|
58
|
+
export declare function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio: ChatMessageContentItemAudioInputAudio): string;
|
|
59
|
+
export declare function chatMessageContentItemAudioInputAudioFromJSON(jsonString: string): SafeParseResult<ChatMessageContentItemAudioInputAudio, SDKValidationError>;
|
|
60
60
|
/** @internal */
|
|
61
61
|
export declare const ChatMessageContentItemAudio$inboundSchema: z.ZodType<ChatMessageContentItemAudio, unknown>;
|
|
62
62
|
/** @internal */
|
|
63
63
|
export type ChatMessageContentItemAudio$Outbound = {
|
|
64
64
|
type: "input_audio";
|
|
65
|
-
input_audio:
|
|
65
|
+
input_audio: ChatMessageContentItemAudioInputAudio$Outbound;
|
|
66
66
|
};
|
|
67
67
|
/** @internal */
|
|
68
68
|
export declare const ChatMessageContentItemAudio$outboundSchema: z.ZodType<ChatMessageContentItemAudio$Outbound, ChatMessageContentItemAudio>;
|
|
@@ -37,13 +37,12 @@ export var ChatMessageContentItemAudioFormat$;
|
|
|
37
37
|
ChatMessageContentItemAudioFormat$.outboundSchema = ChatMessageContentItemAudioFormat$outboundSchema;
|
|
38
38
|
})(ChatMessageContentItemAudioFormat$ || (ChatMessageContentItemAudioFormat$ = {}));
|
|
39
39
|
/** @internal */
|
|
40
|
-
export const
|
|
41
|
-
.object({
|
|
40
|
+
export const ChatMessageContentItemAudioInputAudio$inboundSchema = z.object({
|
|
42
41
|
data: z.string(),
|
|
43
42
|
format: ChatMessageContentItemAudioFormat$inboundSchema,
|
|
44
43
|
});
|
|
45
44
|
/** @internal */
|
|
46
|
-
export const
|
|
45
|
+
export const ChatMessageContentItemAudioInputAudio$outboundSchema = z.object({
|
|
47
46
|
data: z.string(),
|
|
48
47
|
format: ChatMessageContentItemAudioFormat$outboundSchema,
|
|
49
48
|
});
|
|
@@ -51,23 +50,23 @@ export const InputAudio$outboundSchema = z.object({
|
|
|
51
50
|
* @internal
|
|
52
51
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
53
52
|
*/
|
|
54
|
-
export var
|
|
55
|
-
(function (
|
|
56
|
-
/** @deprecated use `
|
|
57
|
-
|
|
58
|
-
/** @deprecated use `
|
|
59
|
-
|
|
60
|
-
})(
|
|
61
|
-
export function
|
|
62
|
-
return JSON.stringify(
|
|
53
|
+
export var ChatMessageContentItemAudioInputAudio$;
|
|
54
|
+
(function (ChatMessageContentItemAudioInputAudio$) {
|
|
55
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$inboundSchema` instead. */
|
|
56
|
+
ChatMessageContentItemAudioInputAudio$.inboundSchema = ChatMessageContentItemAudioInputAudio$inboundSchema;
|
|
57
|
+
/** @deprecated use `ChatMessageContentItemAudioInputAudio$outboundSchema` instead. */
|
|
58
|
+
ChatMessageContentItemAudioInputAudio$.outboundSchema = ChatMessageContentItemAudioInputAudio$outboundSchema;
|
|
59
|
+
})(ChatMessageContentItemAudioInputAudio$ || (ChatMessageContentItemAudioInputAudio$ = {}));
|
|
60
|
+
export function chatMessageContentItemAudioInputAudioToJSON(chatMessageContentItemAudioInputAudio) {
|
|
61
|
+
return JSON.stringify(ChatMessageContentItemAudioInputAudio$outboundSchema.parse(chatMessageContentItemAudioInputAudio));
|
|
63
62
|
}
|
|
64
|
-
export function
|
|
65
|
-
return safeParse(jsonString, (x) =>
|
|
63
|
+
export function chatMessageContentItemAudioInputAudioFromJSON(jsonString) {
|
|
64
|
+
return safeParse(jsonString, (x) => ChatMessageContentItemAudioInputAudio$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ChatMessageContentItemAudioInputAudio' from JSON`);
|
|
66
65
|
}
|
|
67
66
|
/** @internal */
|
|
68
67
|
export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
69
68
|
type: z.literal("input_audio"),
|
|
70
|
-
input_audio: z.lazy(() =>
|
|
69
|
+
input_audio: z.lazy(() => ChatMessageContentItemAudioInputAudio$inboundSchema),
|
|
71
70
|
}).transform((v) => {
|
|
72
71
|
return remap$(v, {
|
|
73
72
|
"input_audio": "inputAudio",
|
|
@@ -76,7 +75,7 @@ export const ChatMessageContentItemAudio$inboundSchema = z.object({
|
|
|
76
75
|
/** @internal */
|
|
77
76
|
export const ChatMessageContentItemAudio$outboundSchema = z.object({
|
|
78
77
|
type: z.literal("input_audio"),
|
|
79
|
-
inputAudio: z.lazy(() =>
|
|
78
|
+
inputAudio: z.lazy(() => ChatMessageContentItemAudioInputAudio$outboundSchema),
|
|
80
79
|
}).transform((v) => {
|
|
81
80
|
return remap$(v, {
|
|
82
81
|
inputAudio: "input_audio",
|
|
@@ -19,7 +19,8 @@ export type CompletionCreateParamsResponseFormatText = {
|
|
|
19
19
|
};
|
|
20
20
|
export type CompletionCreateParamsResponseFormatUnion = ResponseFormatJSONSchema | ResponseFormatTextGrammar | CompletionCreateParamsResponseFormatText | CompletionCreateParamsResponseFormatJSONObject | CompletionCreateParamsResponseFormatPython;
|
|
21
21
|
export type CompletionCreateParams = {
|
|
22
|
-
model
|
|
22
|
+
model?: string | undefined;
|
|
23
|
+
models?: Array<string> | undefined;
|
|
23
24
|
prompt: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
24
25
|
bestOf?: number | null | undefined;
|
|
25
26
|
echo?: boolean | null | undefined;
|
|
@@ -196,7 +197,8 @@ export declare function completionCreateParamsResponseFormatUnionFromJSON(jsonSt
|
|
|
196
197
|
export declare const CompletionCreateParams$inboundSchema: z.ZodType<CompletionCreateParams, unknown>;
|
|
197
198
|
/** @internal */
|
|
198
199
|
export type CompletionCreateParams$Outbound = {
|
|
199
|
-
model
|
|
200
|
+
model?: string | undefined;
|
|
201
|
+
models?: Array<string> | undefined;
|
|
200
202
|
prompt: string | Array<string> | Array<number> | Array<Array<number>>;
|
|
201
203
|
best_of?: number | null | undefined;
|
|
202
204
|
echo?: boolean | null | undefined;
|
|
@@ -203,7 +203,8 @@ export function completionCreateParamsResponseFormatUnionFromJSON(jsonString) {
|
|
|
203
203
|
}
|
|
204
204
|
/** @internal */
|
|
205
205
|
export const CompletionCreateParams$inboundSchema = z.object({
|
|
206
|
-
model: z.string(),
|
|
206
|
+
model: z.string().optional(),
|
|
207
|
+
models: z.array(z.string()).optional(),
|
|
207
208
|
prompt: z.union([
|
|
208
209
|
z.string(),
|
|
209
210
|
z.array(z.string()),
|
|
@@ -249,7 +250,8 @@ export const CompletionCreateParams$inboundSchema = z.object({
|
|
|
249
250
|
});
|
|
250
251
|
/** @internal */
|
|
251
252
|
export const CompletionCreateParams$outboundSchema = z.object({
|
|
252
|
-
model: z.string(),
|
|
253
|
+
model: z.string().optional(),
|
|
254
|
+
models: z.array(z.string()).optional(),
|
|
253
255
|
prompt: z.union([
|
|
254
256
|
z.string(),
|
|
255
257
|
z.array(z.string()),
|
package/esm/models/index.d.ts
CHANGED
|
@@ -105,6 +105,7 @@ export * from "./requesttimeoutresponseerrordata.js";
|
|
|
105
105
|
export * from "./responseformatjsonschema.js";
|
|
106
106
|
export * from "./responseformattextconfig.js";
|
|
107
107
|
export * from "./responseformattextgrammar.js";
|
|
108
|
+
export * from "./responseinputaudio.js";
|
|
108
109
|
export * from "./responseinputfile.js";
|
|
109
110
|
export * from "./responseinputimage.js";
|
|
110
111
|
export * from "./responseinputtext.js";
|
package/esm/models/index.js
CHANGED
|
@@ -108,6 +108,7 @@ export * from "./requesttimeoutresponseerrordata.js";
|
|
|
108
108
|
export * from "./responseformatjsonschema.js";
|
|
109
109
|
export * from "./responseformattextconfig.js";
|
|
110
110
|
export * from "./responseformattextgrammar.js";
|
|
111
|
+
export * from "./responseinputaudio.js";
|
|
111
112
|
export * from "./responseinputfile.js";
|
|
112
113
|
export * from "./responseinputimage.js";
|
|
113
114
|
export * from "./responseinputtext.js";
|
|
@@ -4,6 +4,7 @@ import { Result as SafeParseResult } from "../types/fp.js";
|
|
|
4
4
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
5
5
|
import { OutputItemImageGenerationCall, OutputItemImageGenerationCall$Outbound } from "./outputitemimagegenerationcall.js";
|
|
6
6
|
import { OutputMessage, OutputMessage$Outbound } from "./outputmessage.js";
|
|
7
|
+
import { ResponseInputAudio, ResponseInputAudio$Outbound } from "./responseinputaudio.js";
|
|
7
8
|
import { ResponseInputFile, ResponseInputFile$Outbound } from "./responseinputfile.js";
|
|
8
9
|
import { ResponseInputImage, ResponseInputImage$Outbound } from "./responseinputimage.js";
|
|
9
10
|
import { ResponseInputText, ResponseInputText$Outbound } from "./responseinputtext.js";
|
|
@@ -52,6 +53,8 @@ export type OpenAIResponsesInputContent3 = (ResponseInputText & {
|
|
|
52
53
|
type: "input_text";
|
|
53
54
|
}) | (ResponseInputImage & {
|
|
54
55
|
type: "input_image";
|
|
56
|
+
}) | (ResponseInputAudio & {
|
|
57
|
+
type: "input_audio";
|
|
55
58
|
}) | (ResponseInputFile & {
|
|
56
59
|
type: "input_file";
|
|
57
60
|
});
|
|
@@ -63,6 +66,8 @@ export type OpenAIResponsesInputMessage2 = {
|
|
|
63
66
|
type: "input_text";
|
|
64
67
|
}) | (ResponseInputImage & {
|
|
65
68
|
type: "input_image";
|
|
69
|
+
}) | (ResponseInputAudio & {
|
|
70
|
+
type: "input_audio";
|
|
66
71
|
}) | (ResponseInputFile & {
|
|
67
72
|
type: "input_file";
|
|
68
73
|
})>;
|
|
@@ -92,6 +97,8 @@ export type OpenAIResponsesInputContent1 = (ResponseInputText & {
|
|
|
92
97
|
type: "input_text";
|
|
93
98
|
}) | (ResponseInputImage & {
|
|
94
99
|
type: "input_image";
|
|
100
|
+
}) | (ResponseInputAudio & {
|
|
101
|
+
type: "input_audio";
|
|
95
102
|
}) | (ResponseInputFile & {
|
|
96
103
|
type: "input_file";
|
|
97
104
|
});
|
|
@@ -99,6 +106,8 @@ export type OpenAIResponsesInputContent2 = Array<(ResponseInputText & {
|
|
|
99
106
|
type: "input_text";
|
|
100
107
|
}) | (ResponseInputImage & {
|
|
101
108
|
type: "input_image";
|
|
109
|
+
}) | (ResponseInputAudio & {
|
|
110
|
+
type: "input_audio";
|
|
102
111
|
}) | (ResponseInputFile & {
|
|
103
112
|
type: "input_file";
|
|
104
113
|
})> | string;
|
|
@@ -109,6 +118,8 @@ export type OpenAIResponsesInputMessage1 = {
|
|
|
109
118
|
type: "input_text";
|
|
110
119
|
}) | (ResponseInputImage & {
|
|
111
120
|
type: "input_image";
|
|
121
|
+
}) | (ResponseInputAudio & {
|
|
122
|
+
type: "input_audio";
|
|
112
123
|
}) | (ResponseInputFile & {
|
|
113
124
|
type: "input_file";
|
|
114
125
|
})> | string;
|
|
@@ -303,6 +314,8 @@ export type OpenAIResponsesInputContent3$Outbound = (ResponseInputText$Outbound
|
|
|
303
314
|
type: "input_text";
|
|
304
315
|
}) | (ResponseInputImage$Outbound & {
|
|
305
316
|
type: "input_image";
|
|
317
|
+
}) | (ResponseInputAudio$Outbound & {
|
|
318
|
+
type: "input_audio";
|
|
306
319
|
}) | (ResponseInputFile$Outbound & {
|
|
307
320
|
type: "input_file";
|
|
308
321
|
});
|
|
@@ -333,6 +346,8 @@ export type OpenAIResponsesInputMessage2$Outbound = {
|
|
|
333
346
|
type: "input_text";
|
|
334
347
|
}) | (ResponseInputImage$Outbound & {
|
|
335
348
|
type: "input_image";
|
|
349
|
+
}) | (ResponseInputAudio$Outbound & {
|
|
350
|
+
type: "input_audio";
|
|
336
351
|
}) | (ResponseInputFile$Outbound & {
|
|
337
352
|
type: "input_file";
|
|
338
353
|
})>;
|
|
@@ -470,6 +485,8 @@ export type OpenAIResponsesInputContent1$Outbound = (ResponseInputText$Outbound
|
|
|
470
485
|
type: "input_text";
|
|
471
486
|
}) | (ResponseInputImage$Outbound & {
|
|
472
487
|
type: "input_image";
|
|
488
|
+
}) | (ResponseInputAudio$Outbound & {
|
|
489
|
+
type: "input_audio";
|
|
473
490
|
}) | (ResponseInputFile$Outbound & {
|
|
474
491
|
type: "input_file";
|
|
475
492
|
});
|
|
@@ -496,6 +513,8 @@ export type OpenAIResponsesInputContent2$Outbound = Array<(ResponseInputText$Out
|
|
|
496
513
|
type: "input_text";
|
|
497
514
|
}) | (ResponseInputImage$Outbound & {
|
|
498
515
|
type: "input_image";
|
|
516
|
+
}) | (ResponseInputAudio$Outbound & {
|
|
517
|
+
type: "input_audio";
|
|
499
518
|
}) | (ResponseInputFile$Outbound & {
|
|
500
519
|
type: "input_file";
|
|
501
520
|
})> | string;
|
|
@@ -525,6 +544,8 @@ export type OpenAIResponsesInputMessage1$Outbound = {
|
|
|
525
544
|
type: "input_text";
|
|
526
545
|
}) | (ResponseInputImage$Outbound & {
|
|
527
546
|
type: "input_image";
|
|
547
|
+
}) | (ResponseInputAudio$Outbound & {
|
|
548
|
+
type: "input_audio";
|
|
528
549
|
}) | (ResponseInputFile$Outbound & {
|
|
529
550
|
type: "input_file";
|
|
530
551
|
})> | string;
|
|
@@ -6,6 +6,7 @@ import { remap as remap$ } from "../lib/primitives.js";
|
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
import { OutputItemImageGenerationCall$inboundSchema, OutputItemImageGenerationCall$outboundSchema, } from "./outputitemimagegenerationcall.js";
|
|
8
8
|
import { OutputMessage$inboundSchema, OutputMessage$outboundSchema, } from "./outputmessage.js";
|
|
9
|
+
import { ResponseInputAudio$inboundSchema, ResponseInputAudio$outboundSchema, } from "./responseinputaudio.js";
|
|
9
10
|
import { ResponseInputFile$inboundSchema, ResponseInputFile$outboundSchema, } from "./responseinputfile.js";
|
|
10
11
|
import { ResponseInputImage$inboundSchema, ResponseInputImage$outboundSchema, } from "./responseinputimage.js";
|
|
11
12
|
import { ResponseInputText$inboundSchema, ResponseInputText$outboundSchema, } from "./responseinputtext.js";
|
|
@@ -254,6 +255,9 @@ export const OpenAIResponsesInputContent3$inboundSchema = z.union([
|
|
|
254
255
|
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
255
256
|
type: v.type,
|
|
256
257
|
}))),
|
|
258
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
259
|
+
type: v.type,
|
|
260
|
+
}))),
|
|
257
261
|
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
258
262
|
type: v.type,
|
|
259
263
|
}))),
|
|
@@ -266,6 +270,9 @@ export const OpenAIResponsesInputContent3$outboundSchema = z.union([
|
|
|
266
270
|
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
267
271
|
type: v.type,
|
|
268
272
|
}))),
|
|
273
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
274
|
+
type: v.type,
|
|
275
|
+
}))),
|
|
269
276
|
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
270
277
|
type: v.type,
|
|
271
278
|
}))),
|
|
@@ -303,6 +310,9 @@ export const OpenAIResponsesInputMessage2$inboundSchema = z.object({
|
|
|
303
310
|
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
304
311
|
type: v.type,
|
|
305
312
|
}))),
|
|
313
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
314
|
+
type: v.type,
|
|
315
|
+
}))),
|
|
306
316
|
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
307
317
|
type: v.type,
|
|
308
318
|
}))),
|
|
@@ -324,6 +334,9 @@ export const OpenAIResponsesInputMessage2$outboundSchema = z.object({
|
|
|
324
334
|
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
325
335
|
type: v.type,
|
|
326
336
|
}))),
|
|
337
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
338
|
+
type: v.type,
|
|
339
|
+
}))),
|
|
327
340
|
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
328
341
|
type: v.type,
|
|
329
342
|
}))),
|
|
@@ -460,6 +473,9 @@ export const OpenAIResponsesInputContent1$inboundSchema = z.union([
|
|
|
460
473
|
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
461
474
|
type: v.type,
|
|
462
475
|
}))),
|
|
476
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
477
|
+
type: v.type,
|
|
478
|
+
}))),
|
|
463
479
|
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
464
480
|
type: v.type,
|
|
465
481
|
}))),
|
|
@@ -472,6 +488,9 @@ export const OpenAIResponsesInputContent1$outboundSchema = z.union([
|
|
|
472
488
|
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
473
489
|
type: v.type,
|
|
474
490
|
}))),
|
|
491
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
492
|
+
type: v.type,
|
|
493
|
+
}))),
|
|
475
494
|
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
476
495
|
type: v.type,
|
|
477
496
|
}))),
|
|
@@ -502,6 +521,9 @@ export const OpenAIResponsesInputContent2$inboundSchema = z.union([
|
|
|
502
521
|
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
503
522
|
type: v.type,
|
|
504
523
|
}))),
|
|
524
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
525
|
+
type: v.type,
|
|
526
|
+
}))),
|
|
505
527
|
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
506
528
|
type: v.type,
|
|
507
529
|
}))),
|
|
@@ -517,6 +539,9 @@ export const OpenAIResponsesInputContent2$outboundSchema = z.union([
|
|
|
517
539
|
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
518
540
|
type: v.type,
|
|
519
541
|
}))),
|
|
542
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
543
|
+
type: v.type,
|
|
544
|
+
}))),
|
|
520
545
|
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
521
546
|
type: v.type,
|
|
522
547
|
}))),
|
|
@@ -557,6 +582,9 @@ export const OpenAIResponsesInputMessage1$inboundSchema = z.object({
|
|
|
557
582
|
ResponseInputImage$inboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
558
583
|
type: v.type,
|
|
559
584
|
}))),
|
|
585
|
+
ResponseInputAudio$inboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
586
|
+
type: v.type,
|
|
587
|
+
}))),
|
|
560
588
|
ResponseInputFile$inboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
561
589
|
type: v.type,
|
|
562
590
|
}))),
|
|
@@ -581,6 +609,9 @@ export const OpenAIResponsesInputMessage1$outboundSchema = z.object({
|
|
|
581
609
|
ResponseInputImage$outboundSchema.and(z.object({ type: z.literal("input_image") }).transform((v) => ({
|
|
582
610
|
type: v.type,
|
|
583
611
|
}))),
|
|
612
|
+
ResponseInputAudio$outboundSchema.and(z.object({ type: z.literal("input_audio") }).transform((v) => ({
|
|
613
|
+
type: v.type,
|
|
614
|
+
}))),
|
|
584
615
|
ResponseInputFile$outboundSchema.and(z.object({ type: z.literal("input_file") }).transform((v) => ({
|
|
585
616
|
type: v.type,
|
|
586
617
|
}))),
|