@orq-ai/node 3.11.7 → 3.11.9
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/bin/mcp-server.js +104 -104
- package/bin/mcp-server.js.map +26 -26
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/lib/config.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/operations/createcontact.js +2 -2
- package/models/operations/createdataset.js +2 -2
- package/models/operations/createdatasetitem.js +2 -2
- package/models/operations/createdatasource.js +2 -2
- package/models/operations/createeval.js +16 -16
- package/models/operations/fileget.js +2 -2
- package/models/operations/filelist.js +2 -2
- package/models/operations/fileupload.js +2 -2
- package/models/operations/getevals.js +28 -28
- package/models/operations/listcontacts.js +2 -2
- package/models/operations/listdatasetdatapoints.js +2 -2
- package/models/operations/listdatasets.js +2 -2
- package/models/operations/listdatasources.js +2 -2
- package/models/operations/retrievecontact.js +2 -2
- package/models/operations/retrievedatapoint.js +2 -2
- package/models/operations/retrievedataset.js +2 -2
- package/models/operations/retrievedatasource.js +2 -2
- package/models/operations/updatecontact.js +2 -2
- package/models/operations/updatedatapoint.js +2 -2
- package/models/operations/updatedataset.js +2 -2
- package/models/operations/updatedatasource.js +2 -2
- package/models/operations/updateeval.js +16 -16
- package/package.json +1 -1
- package/packages/orq-rc/README.md +128 -87
- package/packages/orq-rc/docs/sdks/batches/README.md +307 -0
- package/packages/orq-rc/docs/sdks/knowledge/README.md +1 -1
- package/packages/orq-rc/docs/sdks/proxy/README.md +1284 -0
- package/packages/orq-rc/examples/package-lock.json +1 -1
- package/packages/orq-rc/jsr.json +1 -1
- package/packages/orq-rc/package-lock.json +2 -2
- package/packages/orq-rc/package.json +1 -1
- package/packages/orq-rc/src/funcs/batchesCancel.ts +166 -0
- package/packages/orq-rc/src/funcs/batchesCreate.ts +160 -0
- package/packages/orq-rc/src/funcs/batchesList.ts +165 -0
- package/packages/orq-rc/src/funcs/batchesRetrieve.ts +166 -0
- package/packages/orq-rc/src/funcs/knowledgeSearch.ts +1 -1
- package/packages/orq-rc/src/funcs/proxyAudioSpeech.ts +159 -0
- package/packages/orq-rc/src/funcs/proxyAudioTranscriptions.ts +233 -0
- package/packages/orq-rc/src/funcs/proxyAudioTranslations.ts +223 -0
- package/packages/orq-rc/src/funcs/proxyChatCompletions.ts +172 -0
- package/packages/orq-rc/src/funcs/proxyCompletions.ts +168 -0
- package/packages/orq-rc/src/funcs/proxyEmbeddings.ts +161 -0
- package/packages/orq-rc/src/funcs/proxyImagesEdit.ts +173 -0
- package/packages/orq-rc/src/funcs/proxyImagesGenerate.ts +163 -0
- package/packages/orq-rc/src/funcs/proxyImagesVariation.ts +179 -0
- package/packages/orq-rc/src/funcs/proxyModerations.ts +164 -0
- package/packages/orq-rc/src/funcs/proxyRerank.ts +158 -0
- package/packages/orq-rc/src/funcs/proxyResponsesCreate.ts +171 -0
- package/packages/orq-rc/src/lib/config.ts +3 -3
- package/packages/orq-rc/src/mcp-server/mcp-server.ts +1 -1
- package/packages/orq-rc/src/mcp-server/server.ts +33 -1
- package/packages/orq-rc/src/mcp-server/tools/batchesCancel.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/batchesCreate.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/batchesList.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/batchesRetrieve.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/knowledgeSearch.ts +1 -1
- package/packages/orq-rc/src/mcp-server/tools/proxyAudioSpeech.ts +33 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyAudioTranscriptions.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyAudioTranslations.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyChatCompletions.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyCompletions.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyEmbeddings.ts +37 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyImagesEdit.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyImagesGenerate.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyImagesVariation.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyModerations.ts +35 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyRerank.ts +36 -0
- package/packages/orq-rc/src/mcp-server/tools/proxyResponsesCreate.ts +37 -0
- package/packages/orq-rc/src/models/components/deployments.ts +861 -0
- package/packages/orq-rc/src/models/components/index.ts +1 -0
- package/packages/orq-rc/src/models/components/publiccontact.ts +114 -0
- package/packages/orq-rc/src/models/errors/index.ts +3 -0
- package/packages/orq-rc/src/models/errors/postv2proxyaudiotranscriptions.ts +163 -0
- package/packages/orq-rc/src/models/errors/postv2proxyaudiotranslations.ts +162 -0
- package/packages/orq-rc/src/models/errors/postv2proxymoderations.ts +151 -0
- package/packages/orq-rc/src/models/operations/cancelbatch.ts +474 -0
- package/packages/orq-rc/src/models/operations/createbatch.ts +531 -0
- package/packages/orq-rc/src/models/operations/createbudget.ts +2 -2
- package/packages/orq-rc/src/models/operations/createchatcompletion.ts +11697 -0
- package/packages/orq-rc/src/models/operations/createcontact.ts +2 -2
- package/packages/orq-rc/src/models/operations/createdataset.ts +2 -2
- package/packages/orq-rc/src/models/operations/createdatasetitem.ts +2205 -1224
- package/packages/orq-rc/src/models/operations/createdatasource.ts +2 -2
- package/packages/orq-rc/src/models/operations/createeval.ts +16 -16
- package/packages/orq-rc/src/models/operations/createresponse.ts +6908 -0
- package/packages/orq-rc/src/models/operations/deploymentcreatemetric.ts +2282 -1214
- package/packages/orq-rc/src/models/operations/deploymentgetconfig.ts +938 -51
- package/packages/orq-rc/src/models/operations/deploymentstream.ts +1471 -305
- package/packages/orq-rc/src/models/operations/fileget.ts +2 -2
- package/packages/orq-rc/src/models/operations/filelist.ts +2 -2
- package/packages/orq-rc/src/models/operations/fileupload.ts +2 -2
- package/packages/orq-rc/src/models/operations/getbudget.ts +2 -2
- package/packages/orq-rc/src/models/operations/getevals.ts +107 -92
- package/packages/orq-rc/src/models/operations/index.ts +16 -0
- package/packages/orq-rc/src/models/operations/listbatches.ts +570 -0
- package/packages/orq-rc/src/models/operations/listbudgets.ts +2 -2
- package/packages/orq-rc/src/models/operations/listcontacts.ts +2 -2
- package/packages/orq-rc/src/models/operations/listdatasetdatapoints.ts +498 -2
- package/packages/orq-rc/src/models/operations/listdatasets.ts +2 -2
- package/packages/orq-rc/src/models/operations/listdatasources.ts +2 -2
- package/packages/orq-rc/src/models/operations/postv2proxyaudiospeech.ts +393 -0
- package/packages/orq-rc/src/models/operations/postv2proxyaudiotranscriptions.ts +731 -0
- package/packages/orq-rc/src/models/operations/postv2proxyaudiotranslations.ts +741 -0
- package/packages/orq-rc/src/models/operations/postv2proxycompletions.ts +5831 -0
- package/packages/orq-rc/src/models/operations/postv2proxyembeddings.ts +878 -0
- package/packages/orq-rc/src/models/operations/postv2proxyimagesedits.ts +596 -0
- package/packages/orq-rc/src/models/operations/postv2proxyimagesgenerations.ts +1107 -0
- package/packages/orq-rc/src/models/operations/postv2proxyimagesvariations.ts +592 -0
- package/packages/orq-rc/src/models/operations/postv2proxymoderations.ts +802 -0
- package/packages/orq-rc/src/models/operations/postv2proxyrerank.ts +526 -0
- package/packages/orq-rc/src/models/operations/retrievebatch.ts +474 -0
- package/packages/orq-rc/src/models/operations/retrievecontact.ts +2 -2
- package/packages/orq-rc/src/models/operations/retrievedatapoint.ts +478 -2
- package/packages/orq-rc/src/models/operations/retrievedataset.ts +2 -2
- package/packages/orq-rc/src/models/operations/retrievedatasource.ts +2 -2
- package/packages/orq-rc/src/models/operations/updatebudget.ts +2 -2
- package/packages/orq-rc/src/models/operations/updatecontact.ts +2 -2
- package/packages/orq-rc/src/models/operations/updatedatapoint.ts +974 -2
- package/packages/orq-rc/src/models/operations/updatedataset.ts +2 -2
- package/packages/orq-rc/src/models/operations/updatedatasource.ts +2 -2
- package/packages/orq-rc/src/models/operations/updateeval.ts +16 -16
- package/packages/orq-rc/src/sdk/batches.ts +81 -0
- package/packages/orq-rc/src/sdk/knowledge.ts +1 -1
- package/packages/orq-rc/src/sdk/proxy.ts +211 -0
- package/packages/orq-rc/src/sdk/sdk.ts +12 -0
- package/packages/orq-rc/temp/example.ts +5 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/operations/createcontact.ts +2 -2
- package/src/models/operations/createdataset.ts +2 -2
- package/src/models/operations/createdatasetitem.ts +2 -2
- package/src/models/operations/createdatasource.ts +2 -2
- package/src/models/operations/createeval.ts +16 -16
- package/src/models/operations/fileget.ts +2 -2
- package/src/models/operations/filelist.ts +2 -2
- package/src/models/operations/fileupload.ts +2 -2
- package/src/models/operations/getevals.ts +28 -28
- package/src/models/operations/listcontacts.ts +2 -2
- package/src/models/operations/listdatasetdatapoints.ts +2 -2
- package/src/models/operations/listdatasets.ts +2 -2
- package/src/models/operations/listdatasources.ts +2 -2
- package/src/models/operations/retrievecontact.ts +2 -2
- package/src/models/operations/retrievedatapoint.ts +2 -2
- package/src/models/operations/retrievedataset.ts +2 -2
- package/src/models/operations/retrievedatasource.ts +2 -2
- package/src/models/operations/updatecontact.ts +2 -2
- package/src/models/operations/updatedatapoint.ts +2 -2
- package/src/models/operations/updatedataset.ts +2 -2
- package/src/models/operations/updatedatasource.ts +2 -2
- package/src/models/operations/updateeval.ts +16 -16
|
@@ -28,7 +28,7 @@ import { Result } from "../types/fp.js";
|
|
|
28
28
|
* Search knowledge base
|
|
29
29
|
*
|
|
30
30
|
* @remarks
|
|
31
|
-
* Search a Knowledge Base and return the most similar chunks, along with their search and rerank scores.
|
|
31
|
+
* Search a Knowledge Base and return the most similar chunks, along with their search and rerank scores. Note that all configuration changes made in the API will override the settings in the UI.
|
|
32
32
|
*/
|
|
33
33
|
export function knowledgeSearch(
|
|
34
34
|
client: OrqCore,
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { OrqCore } from "../core.js";
|
|
7
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../models/errors/httpclienterrors.js";
|
|
21
|
+
import { OrqError } from "../models/errors/orqerror.js";
|
|
22
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Generates audio from the input text.
|
|
30
|
+
*/
|
|
31
|
+
export function proxyAudioSpeech(
|
|
32
|
+
client: OrqCore,
|
|
33
|
+
request: operations.PostV2ProxyAudioSpeechRequestBody,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): APIPromise<
|
|
36
|
+
Result<
|
|
37
|
+
void,
|
|
38
|
+
| OrqError
|
|
39
|
+
| ResponseValidationError
|
|
40
|
+
| ConnectionError
|
|
41
|
+
| RequestAbortedError
|
|
42
|
+
| RequestTimeoutError
|
|
43
|
+
| InvalidRequestError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| SDKValidationError
|
|
46
|
+
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
request,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function $do(
|
|
56
|
+
client: OrqCore,
|
|
57
|
+
request: operations.PostV2ProxyAudioSpeechRequestBody,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
void,
|
|
63
|
+
| OrqError
|
|
64
|
+
| ResponseValidationError
|
|
65
|
+
| ConnectionError
|
|
66
|
+
| RequestAbortedError
|
|
67
|
+
| RequestTimeoutError
|
|
68
|
+
| InvalidRequestError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| SDKValidationError
|
|
71
|
+
>,
|
|
72
|
+
APICall,
|
|
73
|
+
]
|
|
74
|
+
> {
|
|
75
|
+
const parsed = safeParse(
|
|
76
|
+
request,
|
|
77
|
+
(value) =>
|
|
78
|
+
operations.PostV2ProxyAudioSpeechRequestBody$outboundSchema.parse(value),
|
|
79
|
+
"Input validation failed",
|
|
80
|
+
);
|
|
81
|
+
if (!parsed.ok) {
|
|
82
|
+
return [parsed, { status: "invalid" }];
|
|
83
|
+
}
|
|
84
|
+
const payload = parsed.value;
|
|
85
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
86
|
+
|
|
87
|
+
const path = pathToFunc("/v2/proxy/audio/speech")();
|
|
88
|
+
|
|
89
|
+
const headers = new Headers(compactMap({
|
|
90
|
+
"Content-Type": "application/json",
|
|
91
|
+
Accept: "*/*",
|
|
92
|
+
}));
|
|
93
|
+
|
|
94
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
95
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
96
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
97
|
+
|
|
98
|
+
const context = {
|
|
99
|
+
options: client._options,
|
|
100
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
101
|
+
operationID: "post_/v2/proxy/audio/speech",
|
|
102
|
+
oAuth2Scopes: [],
|
|
103
|
+
|
|
104
|
+
resolvedSecurity: requestSecurity,
|
|
105
|
+
|
|
106
|
+
securitySource: client._options.apiKey,
|
|
107
|
+
retryConfig: options?.retries
|
|
108
|
+
|| client._options.retryConfig
|
|
109
|
+
|| { strategy: "none" },
|
|
110
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const requestRes = client._createRequest(context, {
|
|
114
|
+
security: requestSecurity,
|
|
115
|
+
method: "POST",
|
|
116
|
+
baseURL: options?.serverURL,
|
|
117
|
+
path: path,
|
|
118
|
+
headers: headers,
|
|
119
|
+
body: body,
|
|
120
|
+
userAgent: client._options.userAgent,
|
|
121
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
122
|
+
}, options);
|
|
123
|
+
if (!requestRes.ok) {
|
|
124
|
+
return [requestRes, { status: "invalid" }];
|
|
125
|
+
}
|
|
126
|
+
const req = requestRes.value;
|
|
127
|
+
|
|
128
|
+
const doResult = await client._do(req, {
|
|
129
|
+
context,
|
|
130
|
+
errorCodes: ["4XX", "5XX"],
|
|
131
|
+
retryConfig: context.retryConfig,
|
|
132
|
+
retryCodes: context.retryCodes,
|
|
133
|
+
});
|
|
134
|
+
if (!doResult.ok) {
|
|
135
|
+
return [doResult, { status: "request-error", request: req }];
|
|
136
|
+
}
|
|
137
|
+
const response = doResult.value;
|
|
138
|
+
|
|
139
|
+
const [result] = await M.match<
|
|
140
|
+
void,
|
|
141
|
+
| OrqError
|
|
142
|
+
| ResponseValidationError
|
|
143
|
+
| ConnectionError
|
|
144
|
+
| RequestAbortedError
|
|
145
|
+
| RequestTimeoutError
|
|
146
|
+
| InvalidRequestError
|
|
147
|
+
| UnexpectedClientError
|
|
148
|
+
| SDKValidationError
|
|
149
|
+
>(
|
|
150
|
+
M.nil(200, z.void()),
|
|
151
|
+
M.fail("4XX"),
|
|
152
|
+
M.fail("5XX"),
|
|
153
|
+
)(response, req);
|
|
154
|
+
if (!result.ok) {
|
|
155
|
+
return [result, { status: "complete", request: req, response }];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return [result, { status: "complete", request: req, response }];
|
|
159
|
+
}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OrqCore } from "../core.js";
|
|
6
|
+
import { appendForm } from "../lib/encodings.js";
|
|
7
|
+
import {
|
|
8
|
+
getContentTypeFromFileName,
|
|
9
|
+
readableStreamToArrayBuffer,
|
|
10
|
+
} from "../lib/files.js";
|
|
11
|
+
import * as M from "../lib/matchers.js";
|
|
12
|
+
import { compactMap } from "../lib/primitives.js";
|
|
13
|
+
import { safeParse } from "../lib/schemas.js";
|
|
14
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
15
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
16
|
+
import { pathToFunc } from "../lib/url.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import * as errors from "../models/errors/index.js";
|
|
25
|
+
import { OrqError } from "../models/errors/orqerror.js";
|
|
26
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
27
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
28
|
+
import * as operations from "../models/operations/index.js";
|
|
29
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
30
|
+
import { isBlobLike } from "../types/blobs.js";
|
|
31
|
+
import { Result } from "../types/fp.js";
|
|
32
|
+
import { isReadableStream } from "../types/streams.js";
|
|
33
|
+
|
|
34
|
+
export function proxyAudioTranscriptions(
|
|
35
|
+
client: OrqCore,
|
|
36
|
+
request: operations.PostV2ProxyAudioTranscriptionsRequestBody,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.PostV2ProxyAudioTranscriptionsResponseBody,
|
|
41
|
+
| errors.PostV2ProxyAudioTranscriptionsResponseBody
|
|
42
|
+
| OrqError
|
|
43
|
+
| ResponseValidationError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| UnexpectedClientError
|
|
49
|
+
| SDKValidationError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function $do(
|
|
60
|
+
client: OrqCore,
|
|
61
|
+
request: operations.PostV2ProxyAudioTranscriptionsRequestBody,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): Promise<
|
|
64
|
+
[
|
|
65
|
+
Result<
|
|
66
|
+
operations.PostV2ProxyAudioTranscriptionsResponseBody,
|
|
67
|
+
| errors.PostV2ProxyAudioTranscriptionsResponseBody
|
|
68
|
+
| OrqError
|
|
69
|
+
| ResponseValidationError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| InvalidRequestError
|
|
74
|
+
| UnexpectedClientError
|
|
75
|
+
| SDKValidationError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) =>
|
|
83
|
+
operations.PostV2ProxyAudioTranscriptionsRequestBody$outboundSchema.parse(
|
|
84
|
+
value,
|
|
85
|
+
),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = new FormData();
|
|
93
|
+
|
|
94
|
+
if (isBlobLike(payload.file)) {
|
|
95
|
+
appendForm(body, "file", payload.file);
|
|
96
|
+
} else if (isReadableStream(payload.file.content)) {
|
|
97
|
+
const buffer = await readableStreamToArrayBuffer(payload.file.content);
|
|
98
|
+
const contentType = getContentTypeFromFileName(payload.file.fileName)
|
|
99
|
+
|| "application/octet-stream";
|
|
100
|
+
const blob = new Blob([buffer], { type: contentType });
|
|
101
|
+
appendForm(body, "file", blob, payload.file.fileName);
|
|
102
|
+
} else {
|
|
103
|
+
const contentType = getContentTypeFromFileName(payload.file.fileName)
|
|
104
|
+
|| "application/octet-stream";
|
|
105
|
+
appendForm(
|
|
106
|
+
body,
|
|
107
|
+
"file",
|
|
108
|
+
new Blob([payload.file.content], { type: contentType }),
|
|
109
|
+
payload.file.fileName,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (payload.diarize !== undefined) {
|
|
113
|
+
appendForm(body, "diarize", payload.diarize);
|
|
114
|
+
}
|
|
115
|
+
if (payload.enable_logging !== undefined) {
|
|
116
|
+
appendForm(body, "enable_logging", payload.enable_logging);
|
|
117
|
+
}
|
|
118
|
+
if (payload.language !== undefined) {
|
|
119
|
+
appendForm(body, "language", payload.language);
|
|
120
|
+
}
|
|
121
|
+
if (payload.model !== undefined) {
|
|
122
|
+
appendForm(body, "model", payload.model);
|
|
123
|
+
}
|
|
124
|
+
if (payload.num_speakers !== undefined) {
|
|
125
|
+
appendForm(body, "num_speakers", payload.num_speakers);
|
|
126
|
+
}
|
|
127
|
+
if (payload.prompt !== undefined) {
|
|
128
|
+
appendForm(body, "prompt", payload.prompt);
|
|
129
|
+
}
|
|
130
|
+
if (payload.response_format !== undefined) {
|
|
131
|
+
appendForm(body, "response_format", payload.response_format);
|
|
132
|
+
}
|
|
133
|
+
if (payload.tag_audio_events !== undefined) {
|
|
134
|
+
appendForm(body, "tag_audio_events", payload.tag_audio_events);
|
|
135
|
+
}
|
|
136
|
+
if (payload.temperature !== undefined) {
|
|
137
|
+
appendForm(body, "temperature", payload.temperature);
|
|
138
|
+
}
|
|
139
|
+
if (payload.timestamp_granularities !== undefined) {
|
|
140
|
+
appendForm(
|
|
141
|
+
body,
|
|
142
|
+
"timestamp_granularities",
|
|
143
|
+
payload.timestamp_granularities,
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
if (payload.timestamps_granularity !== undefined) {
|
|
147
|
+
appendForm(body, "timestamps_granularity", payload.timestamps_granularity);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const path = pathToFunc("/v2/proxy/audio/transcriptions")();
|
|
151
|
+
|
|
152
|
+
const headers = new Headers(compactMap({
|
|
153
|
+
Accept: "application/json",
|
|
154
|
+
}));
|
|
155
|
+
|
|
156
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
157
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
158
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
159
|
+
|
|
160
|
+
const context = {
|
|
161
|
+
options: client._options,
|
|
162
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
163
|
+
operationID: "post_/v2/proxy/audio/transcriptions",
|
|
164
|
+
oAuth2Scopes: [],
|
|
165
|
+
|
|
166
|
+
resolvedSecurity: requestSecurity,
|
|
167
|
+
|
|
168
|
+
securitySource: client._options.apiKey,
|
|
169
|
+
retryConfig: options?.retries
|
|
170
|
+
|| client._options.retryConfig
|
|
171
|
+
|| { strategy: "none" },
|
|
172
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const requestRes = client._createRequest(context, {
|
|
176
|
+
security: requestSecurity,
|
|
177
|
+
method: "POST",
|
|
178
|
+
baseURL: options?.serverURL,
|
|
179
|
+
path: path,
|
|
180
|
+
headers: headers,
|
|
181
|
+
body: body,
|
|
182
|
+
userAgent: client._options.userAgent,
|
|
183
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
184
|
+
}, options);
|
|
185
|
+
if (!requestRes.ok) {
|
|
186
|
+
return [requestRes, { status: "invalid" }];
|
|
187
|
+
}
|
|
188
|
+
const req = requestRes.value;
|
|
189
|
+
|
|
190
|
+
const doResult = await client._do(req, {
|
|
191
|
+
context,
|
|
192
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
193
|
+
retryConfig: context.retryConfig,
|
|
194
|
+
retryCodes: context.retryCodes,
|
|
195
|
+
});
|
|
196
|
+
if (!doResult.ok) {
|
|
197
|
+
return [doResult, { status: "request-error", request: req }];
|
|
198
|
+
}
|
|
199
|
+
const response = doResult.value;
|
|
200
|
+
|
|
201
|
+
const responseFields = {
|
|
202
|
+
HttpMeta: { Response: response, Request: req },
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const [result] = await M.match<
|
|
206
|
+
operations.PostV2ProxyAudioTranscriptionsResponseBody,
|
|
207
|
+
| errors.PostV2ProxyAudioTranscriptionsResponseBody
|
|
208
|
+
| OrqError
|
|
209
|
+
| ResponseValidationError
|
|
210
|
+
| ConnectionError
|
|
211
|
+
| RequestAbortedError
|
|
212
|
+
| RequestTimeoutError
|
|
213
|
+
| InvalidRequestError
|
|
214
|
+
| UnexpectedClientError
|
|
215
|
+
| SDKValidationError
|
|
216
|
+
>(
|
|
217
|
+
M.json(
|
|
218
|
+
200,
|
|
219
|
+
operations.PostV2ProxyAudioTranscriptionsResponseBody$inboundSchema,
|
|
220
|
+
),
|
|
221
|
+
M.jsonErr(
|
|
222
|
+
422,
|
|
223
|
+
errors.PostV2ProxyAudioTranscriptionsResponseBody$inboundSchema,
|
|
224
|
+
),
|
|
225
|
+
M.fail("4XX"),
|
|
226
|
+
M.fail("5XX"),
|
|
227
|
+
)(response, req, { extraFields: responseFields });
|
|
228
|
+
if (!result.ok) {
|
|
229
|
+
return [result, { status: "complete", request: req, response }];
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return [result, { status: "complete", request: req, response }];
|
|
233
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { OrqCore } from "../core.js";
|
|
6
|
+
import { appendForm } from "../lib/encodings.js";
|
|
7
|
+
import {
|
|
8
|
+
getContentTypeFromFileName,
|
|
9
|
+
readableStreamToArrayBuffer,
|
|
10
|
+
} from "../lib/files.js";
|
|
11
|
+
import * as M from "../lib/matchers.js";
|
|
12
|
+
import { compactMap } from "../lib/primitives.js";
|
|
13
|
+
import { safeParse } from "../lib/schemas.js";
|
|
14
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
15
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
16
|
+
import { pathToFunc } from "../lib/url.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import * as errors from "../models/errors/index.js";
|
|
25
|
+
import { OrqError } from "../models/errors/orqerror.js";
|
|
26
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
27
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
28
|
+
import * as operations from "../models/operations/index.js";
|
|
29
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
30
|
+
import { isBlobLike } from "../types/blobs.js";
|
|
31
|
+
import { Result } from "../types/fp.js";
|
|
32
|
+
import { isReadableStream } from "../types/streams.js";
|
|
33
|
+
|
|
34
|
+
export function proxyAudioTranslations(
|
|
35
|
+
client: OrqCore,
|
|
36
|
+
request: operations.PostV2ProxyAudioTranslationsRequestBody,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
operations.PostV2ProxyAudioTranslationsResponseBody,
|
|
41
|
+
| errors.PostV2ProxyAudioTranslationsResponseBody
|
|
42
|
+
| OrqError
|
|
43
|
+
| ResponseValidationError
|
|
44
|
+
| ConnectionError
|
|
45
|
+
| RequestAbortedError
|
|
46
|
+
| RequestTimeoutError
|
|
47
|
+
| InvalidRequestError
|
|
48
|
+
| UnexpectedClientError
|
|
49
|
+
| SDKValidationError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function $do(
|
|
60
|
+
client: OrqCore,
|
|
61
|
+
request: operations.PostV2ProxyAudioTranslationsRequestBody,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): Promise<
|
|
64
|
+
[
|
|
65
|
+
Result<
|
|
66
|
+
operations.PostV2ProxyAudioTranslationsResponseBody,
|
|
67
|
+
| errors.PostV2ProxyAudioTranslationsResponseBody
|
|
68
|
+
| OrqError
|
|
69
|
+
| ResponseValidationError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| InvalidRequestError
|
|
74
|
+
| UnexpectedClientError
|
|
75
|
+
| SDKValidationError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) =>
|
|
83
|
+
operations.PostV2ProxyAudioTranslationsRequestBody$outboundSchema.parse(
|
|
84
|
+
value,
|
|
85
|
+
),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = new FormData();
|
|
93
|
+
|
|
94
|
+
if (isBlobLike(payload.file)) {
|
|
95
|
+
appendForm(body, "file", payload.file);
|
|
96
|
+
} else if (isReadableStream(payload.file.content)) {
|
|
97
|
+
const buffer = await readableStreamToArrayBuffer(payload.file.content);
|
|
98
|
+
const contentType = getContentTypeFromFileName(payload.file.fileName)
|
|
99
|
+
|| "application/octet-stream";
|
|
100
|
+
const blob = new Blob([buffer], { type: contentType });
|
|
101
|
+
appendForm(body, "file", blob, payload.file.fileName);
|
|
102
|
+
} else {
|
|
103
|
+
const contentType = getContentTypeFromFileName(payload.file.fileName)
|
|
104
|
+
|| "application/octet-stream";
|
|
105
|
+
appendForm(
|
|
106
|
+
body,
|
|
107
|
+
"file",
|
|
108
|
+
new Blob([payload.file.content], { type: contentType }),
|
|
109
|
+
payload.file.fileName,
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
if (payload.diarize !== undefined) {
|
|
113
|
+
appendForm(body, "diarize", payload.diarize);
|
|
114
|
+
}
|
|
115
|
+
if (payload.enable_logging !== undefined) {
|
|
116
|
+
appendForm(body, "enable_logging", payload.enable_logging);
|
|
117
|
+
}
|
|
118
|
+
if (payload.model !== undefined) {
|
|
119
|
+
appendForm(body, "model", payload.model);
|
|
120
|
+
}
|
|
121
|
+
if (payload.num_speakers !== undefined) {
|
|
122
|
+
appendForm(body, "num_speakers", payload.num_speakers);
|
|
123
|
+
}
|
|
124
|
+
if (payload.prompt !== undefined) {
|
|
125
|
+
appendForm(body, "prompt", payload.prompt);
|
|
126
|
+
}
|
|
127
|
+
if (payload.response_format !== undefined) {
|
|
128
|
+
appendForm(body, "response_format", payload.response_format);
|
|
129
|
+
}
|
|
130
|
+
if (payload.tag_audio_events !== undefined) {
|
|
131
|
+
appendForm(body, "tag_audio_events", payload.tag_audio_events);
|
|
132
|
+
}
|
|
133
|
+
if (payload.temperature !== undefined) {
|
|
134
|
+
appendForm(body, "temperature", payload.temperature);
|
|
135
|
+
}
|
|
136
|
+
if (payload.timestamps_granularity !== undefined) {
|
|
137
|
+
appendForm(body, "timestamps_granularity", payload.timestamps_granularity);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const path = pathToFunc("/v2/proxy/audio/translations")();
|
|
141
|
+
|
|
142
|
+
const headers = new Headers(compactMap({
|
|
143
|
+
Accept: "application/json",
|
|
144
|
+
}));
|
|
145
|
+
|
|
146
|
+
const secConfig = await extractSecurity(client._options.apiKey);
|
|
147
|
+
const securityInput = secConfig == null ? {} : { apiKey: secConfig };
|
|
148
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
149
|
+
|
|
150
|
+
const context = {
|
|
151
|
+
options: client._options,
|
|
152
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
153
|
+
operationID: "post_/v2/proxy/audio/translations",
|
|
154
|
+
oAuth2Scopes: [],
|
|
155
|
+
|
|
156
|
+
resolvedSecurity: requestSecurity,
|
|
157
|
+
|
|
158
|
+
securitySource: client._options.apiKey,
|
|
159
|
+
retryConfig: options?.retries
|
|
160
|
+
|| client._options.retryConfig
|
|
161
|
+
|| { strategy: "none" },
|
|
162
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const requestRes = client._createRequest(context, {
|
|
166
|
+
security: requestSecurity,
|
|
167
|
+
method: "POST",
|
|
168
|
+
baseURL: options?.serverURL,
|
|
169
|
+
path: path,
|
|
170
|
+
headers: headers,
|
|
171
|
+
body: body,
|
|
172
|
+
userAgent: client._options.userAgent,
|
|
173
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || 600000,
|
|
174
|
+
}, options);
|
|
175
|
+
if (!requestRes.ok) {
|
|
176
|
+
return [requestRes, { status: "invalid" }];
|
|
177
|
+
}
|
|
178
|
+
const req = requestRes.value;
|
|
179
|
+
|
|
180
|
+
const doResult = await client._do(req, {
|
|
181
|
+
context,
|
|
182
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
183
|
+
retryConfig: context.retryConfig,
|
|
184
|
+
retryCodes: context.retryCodes,
|
|
185
|
+
});
|
|
186
|
+
if (!doResult.ok) {
|
|
187
|
+
return [doResult, { status: "request-error", request: req }];
|
|
188
|
+
}
|
|
189
|
+
const response = doResult.value;
|
|
190
|
+
|
|
191
|
+
const responseFields = {
|
|
192
|
+
HttpMeta: { Response: response, Request: req },
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
const [result] = await M.match<
|
|
196
|
+
operations.PostV2ProxyAudioTranslationsResponseBody,
|
|
197
|
+
| errors.PostV2ProxyAudioTranslationsResponseBody
|
|
198
|
+
| OrqError
|
|
199
|
+
| ResponseValidationError
|
|
200
|
+
| ConnectionError
|
|
201
|
+
| RequestAbortedError
|
|
202
|
+
| RequestTimeoutError
|
|
203
|
+
| InvalidRequestError
|
|
204
|
+
| UnexpectedClientError
|
|
205
|
+
| SDKValidationError
|
|
206
|
+
>(
|
|
207
|
+
M.json(
|
|
208
|
+
200,
|
|
209
|
+
operations.PostV2ProxyAudioTranslationsResponseBody$inboundSchema,
|
|
210
|
+
),
|
|
211
|
+
M.jsonErr(
|
|
212
|
+
422,
|
|
213
|
+
errors.PostV2ProxyAudioTranslationsResponseBody$inboundSchema,
|
|
214
|
+
),
|
|
215
|
+
M.fail("4XX"),
|
|
216
|
+
M.fail("5XX"),
|
|
217
|
+
)(response, req, { extraFields: responseFields });
|
|
218
|
+
if (!result.ok) {
|
|
219
|
+
return [result, { status: "complete", request: req, response }];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
return [result, { status: "complete", request: req, response }];
|
|
223
|
+
}
|