@orq-ai/node 3.11.7 → 3.11.8
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/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/proxy/README.md +1212 -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/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/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 +543 -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/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
|
@@ -0,0 +1,1212 @@
|
|
|
1
|
+
# Proxy
|
|
2
|
+
(*proxy*)
|
|
3
|
+
|
|
4
|
+
## Overview
|
|
5
|
+
|
|
6
|
+
### Available Operations
|
|
7
|
+
|
|
8
|
+
* [chatCompletions](#chatcompletions) - Create chat completion
|
|
9
|
+
* [moderations](#moderations)
|
|
10
|
+
* [embeddings](#embeddings) - Create embeddings
|
|
11
|
+
* [rerank](#rerank) - Rerank a list of documents based on their relevance to a query.
|
|
12
|
+
* [audioSpeech](#audiospeech) - Generates audio from the input text.
|
|
13
|
+
* [completions](#completions) - Create a completion
|
|
14
|
+
* [imagesGenerate](#imagesgenerate) - Create an Image
|
|
15
|
+
* [imagesEdit](#imagesedit) - Edit an Image
|
|
16
|
+
* [imagesVariation](#imagesvariation) - Create an Image Variation
|
|
17
|
+
* [audioTranscriptions](#audiotranscriptions)
|
|
18
|
+
* [audioTranslations](#audiotranslations)
|
|
19
|
+
* [responsesCreate](#responsescreate) - Create response
|
|
20
|
+
|
|
21
|
+
## chatCompletions
|
|
22
|
+
|
|
23
|
+
Creates a model response for the given chat conversation with support for retries, fallbacks, prompts, and variables.
|
|
24
|
+
|
|
25
|
+
### Example Usage
|
|
26
|
+
|
|
27
|
+
<!-- UsageSnippet language="typescript" operationID="CreateChatCompletion" method="post" path="/v2/proxy/chat/completions" -->
|
|
28
|
+
```typescript
|
|
29
|
+
import { Orq } from "@orq-ai/node";
|
|
30
|
+
|
|
31
|
+
const orq = new Orq({
|
|
32
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
async function run() {
|
|
36
|
+
const result = await orq.proxy.chatCompletions({
|
|
37
|
+
messages: [
|
|
38
|
+
{
|
|
39
|
+
role: "assistant",
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
model: "Camaro",
|
|
43
|
+
orq: {
|
|
44
|
+
retry: {
|
|
45
|
+
onCodes: [
|
|
46
|
+
429,
|
|
47
|
+
500,
|
|
48
|
+
502,
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
fallbacks: [
|
|
52
|
+
{
|
|
53
|
+
model: "openai/gpt-5",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
model: "anthropic/claude-4-opus",
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
contact: {
|
|
60
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
61
|
+
displayName: "Jane Doe",
|
|
62
|
+
email: "jane.doe@example.com",
|
|
63
|
+
},
|
|
64
|
+
thread: {
|
|
65
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
66
|
+
tags: [
|
|
67
|
+
"customer-support",
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
inputs: {
|
|
71
|
+
"customer_name": "John Smith",
|
|
72
|
+
"issue_type": "billing",
|
|
73
|
+
},
|
|
74
|
+
cache: {
|
|
75
|
+
ttl: 3600,
|
|
76
|
+
type: "exact_match",
|
|
77
|
+
},
|
|
78
|
+
knowledgeBases: [
|
|
79
|
+
{
|
|
80
|
+
topK: 5,
|
|
81
|
+
knowledgeId: "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
for await (const event of result) {
|
|
88
|
+
// Handle the event
|
|
89
|
+
console.log(event);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
run();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Standalone function
|
|
97
|
+
|
|
98
|
+
The standalone function version of this method:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
102
|
+
import { proxyChatCompletions } from "@orq-ai/node/funcs/proxyChatCompletions.js";
|
|
103
|
+
|
|
104
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
105
|
+
// You can create one instance of it to use across an application.
|
|
106
|
+
const orq = new OrqCore({
|
|
107
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
async function run() {
|
|
111
|
+
const res = await proxyChatCompletions(orq, {
|
|
112
|
+
messages: [
|
|
113
|
+
{
|
|
114
|
+
role: "assistant",
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
model: "Camaro",
|
|
118
|
+
orq: {
|
|
119
|
+
retry: {
|
|
120
|
+
onCodes: [
|
|
121
|
+
429,
|
|
122
|
+
500,
|
|
123
|
+
502,
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
fallbacks: [
|
|
127
|
+
{
|
|
128
|
+
model: "openai/gpt-5",
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
model: "anthropic/claude-4-opus",
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
contact: {
|
|
135
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
136
|
+
displayName: "Jane Doe",
|
|
137
|
+
email: "jane.doe@example.com",
|
|
138
|
+
},
|
|
139
|
+
thread: {
|
|
140
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
141
|
+
tags: [
|
|
142
|
+
"customer-support",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
145
|
+
inputs: {
|
|
146
|
+
"customer_name": "John Smith",
|
|
147
|
+
"issue_type": "billing",
|
|
148
|
+
},
|
|
149
|
+
cache: {
|
|
150
|
+
ttl: 3600,
|
|
151
|
+
type: "exact_match",
|
|
152
|
+
},
|
|
153
|
+
knowledgeBases: [
|
|
154
|
+
{
|
|
155
|
+
topK: 5,
|
|
156
|
+
knowledgeId: "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
});
|
|
161
|
+
if (res.ok) {
|
|
162
|
+
const { value: result } = res;
|
|
163
|
+
for await (const event of result) {
|
|
164
|
+
// Handle the event
|
|
165
|
+
console.log(event);
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
console.log("proxyChatCompletions failed:", res.error);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
run();
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Parameters
|
|
176
|
+
|
|
177
|
+
| Parameter | Type | Required | Description |
|
|
178
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
179
|
+
| `request` | [operations.CreateChatCompletionRequestBody](../../models/operations/createchatcompletionrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
180
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
181
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
182
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
183
|
+
|
|
184
|
+
### Response
|
|
185
|
+
|
|
186
|
+
**Promise\<[operations.CreateChatCompletionResponse](../../models/operations/createchatcompletionresponse.md)\>**
|
|
187
|
+
|
|
188
|
+
### Errors
|
|
189
|
+
|
|
190
|
+
| Error Type | Status Code | Content Type |
|
|
191
|
+
| --------------- | --------------- | --------------- |
|
|
192
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
193
|
+
|
|
194
|
+
## moderations
|
|
195
|
+
|
|
196
|
+
### Example Usage
|
|
197
|
+
|
|
198
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/moderations" method="post" path="/v2/proxy/moderations" -->
|
|
199
|
+
```typescript
|
|
200
|
+
import { Orq } from "@orq-ai/node";
|
|
201
|
+
|
|
202
|
+
const orq = new Orq({
|
|
203
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
async function run() {
|
|
207
|
+
const result = await orq.proxy.moderations({
|
|
208
|
+
input: "<value>",
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
console.log(result);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
run();
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Standalone function
|
|
218
|
+
|
|
219
|
+
The standalone function version of this method:
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
223
|
+
import { proxyModerations } from "@orq-ai/node/funcs/proxyModerations.js";
|
|
224
|
+
|
|
225
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
226
|
+
// You can create one instance of it to use across an application.
|
|
227
|
+
const orq = new OrqCore({
|
|
228
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
async function run() {
|
|
232
|
+
const res = await proxyModerations(orq, {
|
|
233
|
+
input: "<value>",
|
|
234
|
+
});
|
|
235
|
+
if (res.ok) {
|
|
236
|
+
const { value: result } = res;
|
|
237
|
+
console.log(result);
|
|
238
|
+
} else {
|
|
239
|
+
console.log("proxyModerations failed:", res.error);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
run();
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Parameters
|
|
247
|
+
|
|
248
|
+
| Parameter | Type | Required | Description |
|
|
249
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
250
|
+
| `request` | [operations.PostV2ProxyModerationsRequestBody](../../models/operations/postv2proxymoderationsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
251
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
252
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
253
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
254
|
+
|
|
255
|
+
### Response
|
|
256
|
+
|
|
257
|
+
**Promise\<[operations.PostV2ProxyModerationsResponseBody](../../models/operations/postv2proxymoderationsresponsebody.md)\>**
|
|
258
|
+
|
|
259
|
+
### Errors
|
|
260
|
+
|
|
261
|
+
| Error Type | Status Code | Content Type |
|
|
262
|
+
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
|
263
|
+
| errors.PostV2ProxyModerationsResponseBody | 422 | application/json |
|
|
264
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
265
|
+
|
|
266
|
+
## embeddings
|
|
267
|
+
|
|
268
|
+
Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms.
|
|
269
|
+
|
|
270
|
+
### Example Usage
|
|
271
|
+
|
|
272
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/embeddings" method="post" path="/v2/proxy/embeddings" -->
|
|
273
|
+
```typescript
|
|
274
|
+
import { Orq } from "@orq-ai/node";
|
|
275
|
+
|
|
276
|
+
const orq = new Orq({
|
|
277
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
async function run() {
|
|
281
|
+
const result = await orq.proxy.embeddings({
|
|
282
|
+
input: "<value>",
|
|
283
|
+
model: "Golf",
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
console.log(result);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
run();
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Standalone function
|
|
293
|
+
|
|
294
|
+
The standalone function version of this method:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
298
|
+
import { proxyEmbeddings } from "@orq-ai/node/funcs/proxyEmbeddings.js";
|
|
299
|
+
|
|
300
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
301
|
+
// You can create one instance of it to use across an application.
|
|
302
|
+
const orq = new OrqCore({
|
|
303
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
async function run() {
|
|
307
|
+
const res = await proxyEmbeddings(orq, {
|
|
308
|
+
input: "<value>",
|
|
309
|
+
model: "Golf",
|
|
310
|
+
});
|
|
311
|
+
if (res.ok) {
|
|
312
|
+
const { value: result } = res;
|
|
313
|
+
console.log(result);
|
|
314
|
+
} else {
|
|
315
|
+
console.log("proxyEmbeddings failed:", res.error);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
run();
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Parameters
|
|
323
|
+
|
|
324
|
+
| Parameter | Type | Required | Description |
|
|
325
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
326
|
+
| `request` | [operations.PostV2ProxyEmbeddingsRequestBody](../../models/operations/postv2proxyembeddingsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
327
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
328
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
329
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
330
|
+
|
|
331
|
+
### Response
|
|
332
|
+
|
|
333
|
+
**Promise\<[operations.PostV2ProxyEmbeddingsResponseBody](../../models/operations/postv2proxyembeddingsresponsebody.md)\>**
|
|
334
|
+
|
|
335
|
+
### Errors
|
|
336
|
+
|
|
337
|
+
| Error Type | Status Code | Content Type |
|
|
338
|
+
| --------------- | --------------- | --------------- |
|
|
339
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
340
|
+
|
|
341
|
+
## rerank
|
|
342
|
+
|
|
343
|
+
Rerank a list of documents based on their relevance to a query.
|
|
344
|
+
|
|
345
|
+
### Example Usage
|
|
346
|
+
|
|
347
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/rerank" method="post" path="/v2/proxy/rerank" -->
|
|
348
|
+
```typescript
|
|
349
|
+
import { Orq } from "@orq-ai/node";
|
|
350
|
+
|
|
351
|
+
const orq = new Orq({
|
|
352
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
async function run() {
|
|
356
|
+
const result = await orq.proxy.rerank({
|
|
357
|
+
query: "<value>",
|
|
358
|
+
documents: [],
|
|
359
|
+
model: "Prius",
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
console.log(result);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
run();
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Standalone function
|
|
369
|
+
|
|
370
|
+
The standalone function version of this method:
|
|
371
|
+
|
|
372
|
+
```typescript
|
|
373
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
374
|
+
import { proxyRerank } from "@orq-ai/node/funcs/proxyRerank.js";
|
|
375
|
+
|
|
376
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
377
|
+
// You can create one instance of it to use across an application.
|
|
378
|
+
const orq = new OrqCore({
|
|
379
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
async function run() {
|
|
383
|
+
const res = await proxyRerank(orq, {
|
|
384
|
+
query: "<value>",
|
|
385
|
+
documents: [],
|
|
386
|
+
model: "Prius",
|
|
387
|
+
});
|
|
388
|
+
if (res.ok) {
|
|
389
|
+
const { value: result } = res;
|
|
390
|
+
console.log(result);
|
|
391
|
+
} else {
|
|
392
|
+
console.log("proxyRerank failed:", res.error);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
run();
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
### Parameters
|
|
400
|
+
|
|
401
|
+
| Parameter | Type | Required | Description |
|
|
402
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
403
|
+
| `request` | [operations.PostV2ProxyRerankRequestBody](../../models/operations/postv2proxyrerankrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
404
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
405
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
406
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
407
|
+
|
|
408
|
+
### Response
|
|
409
|
+
|
|
410
|
+
**Promise\<[operations.PostV2ProxyRerankResponseBody](../../models/operations/postv2proxyrerankresponsebody.md)\>**
|
|
411
|
+
|
|
412
|
+
### Errors
|
|
413
|
+
|
|
414
|
+
| Error Type | Status Code | Content Type |
|
|
415
|
+
| --------------- | --------------- | --------------- |
|
|
416
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
417
|
+
|
|
418
|
+
## audioSpeech
|
|
419
|
+
|
|
420
|
+
Generates audio from the input text.
|
|
421
|
+
|
|
422
|
+
### Example Usage
|
|
423
|
+
|
|
424
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/audio/speech" method="post" path="/v2/proxy/audio/speech" -->
|
|
425
|
+
```typescript
|
|
426
|
+
import { Orq } from "@orq-ai/node";
|
|
427
|
+
|
|
428
|
+
const orq = new Orq({
|
|
429
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
async function run() {
|
|
433
|
+
await orq.proxy.audioSpeech({
|
|
434
|
+
input: "<value>",
|
|
435
|
+
model: "openai/tts-1-hd",
|
|
436
|
+
voice: "<value>",
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
run();
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Standalone function
|
|
446
|
+
|
|
447
|
+
The standalone function version of this method:
|
|
448
|
+
|
|
449
|
+
```typescript
|
|
450
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
451
|
+
import { proxyAudioSpeech } from "@orq-ai/node/funcs/proxyAudioSpeech.js";
|
|
452
|
+
|
|
453
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
454
|
+
// You can create one instance of it to use across an application.
|
|
455
|
+
const orq = new OrqCore({
|
|
456
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
async function run() {
|
|
460
|
+
const res = await proxyAudioSpeech(orq, {
|
|
461
|
+
input: "<value>",
|
|
462
|
+
model: "openai/tts-1-hd",
|
|
463
|
+
voice: "<value>",
|
|
464
|
+
});
|
|
465
|
+
if (res.ok) {
|
|
466
|
+
const { value: result } = res;
|
|
467
|
+
|
|
468
|
+
} else {
|
|
469
|
+
console.log("proxyAudioSpeech failed:", res.error);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
run();
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Parameters
|
|
477
|
+
|
|
478
|
+
| Parameter | Type | Required | Description |
|
|
479
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
480
|
+
| `request` | [operations.PostV2ProxyAudioSpeechRequestBody](../../models/operations/postv2proxyaudiospeechrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
481
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
482
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
483
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
484
|
+
|
|
485
|
+
### Response
|
|
486
|
+
|
|
487
|
+
**Promise\<void\>**
|
|
488
|
+
|
|
489
|
+
### Errors
|
|
490
|
+
|
|
491
|
+
| Error Type | Status Code | Content Type |
|
|
492
|
+
| --------------- | --------------- | --------------- |
|
|
493
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
494
|
+
|
|
495
|
+
## completions
|
|
496
|
+
|
|
497
|
+
For sending requests to legacy completion models
|
|
498
|
+
|
|
499
|
+
### Example Usage
|
|
500
|
+
|
|
501
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/completions" method="post" path="/v2/proxy/completions" -->
|
|
502
|
+
```typescript
|
|
503
|
+
import { Orq } from "@orq-ai/node";
|
|
504
|
+
|
|
505
|
+
const orq = new Orq({
|
|
506
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
async function run() {
|
|
510
|
+
const result = await orq.proxy.completions({
|
|
511
|
+
model: "XTS",
|
|
512
|
+
prompt: "<value>",
|
|
513
|
+
orq: {
|
|
514
|
+
retry: {
|
|
515
|
+
onCodes: [
|
|
516
|
+
429,
|
|
517
|
+
500,
|
|
518
|
+
502,
|
|
519
|
+
],
|
|
520
|
+
},
|
|
521
|
+
fallbacks: [
|
|
522
|
+
{
|
|
523
|
+
model: "openai/gpt-5",
|
|
524
|
+
},
|
|
525
|
+
{
|
|
526
|
+
model: "anthropic/claude-4-opus",
|
|
527
|
+
},
|
|
528
|
+
],
|
|
529
|
+
contact: {
|
|
530
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
531
|
+
displayName: "Jane Doe",
|
|
532
|
+
email: "jane.doe@example.com",
|
|
533
|
+
},
|
|
534
|
+
thread: {
|
|
535
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
536
|
+
tags: [
|
|
537
|
+
"customer-support",
|
|
538
|
+
],
|
|
539
|
+
},
|
|
540
|
+
inputs: {
|
|
541
|
+
"customer_name": "John Smith",
|
|
542
|
+
"issue_type": "billing",
|
|
543
|
+
},
|
|
544
|
+
cache: {
|
|
545
|
+
ttl: 3600,
|
|
546
|
+
type: "exact_match",
|
|
547
|
+
},
|
|
548
|
+
knowledgeBases: [
|
|
549
|
+
{
|
|
550
|
+
topK: 5,
|
|
551
|
+
knowledgeId: "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
552
|
+
},
|
|
553
|
+
],
|
|
554
|
+
},
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
for await (const event of result) {
|
|
558
|
+
// Handle the event
|
|
559
|
+
console.log(event);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
run();
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Standalone function
|
|
567
|
+
|
|
568
|
+
The standalone function version of this method:
|
|
569
|
+
|
|
570
|
+
```typescript
|
|
571
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
572
|
+
import { proxyCompletions } from "@orq-ai/node/funcs/proxyCompletions.js";
|
|
573
|
+
|
|
574
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
575
|
+
// You can create one instance of it to use across an application.
|
|
576
|
+
const orq = new OrqCore({
|
|
577
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
async function run() {
|
|
581
|
+
const res = await proxyCompletions(orq, {
|
|
582
|
+
model: "XTS",
|
|
583
|
+
prompt: "<value>",
|
|
584
|
+
orq: {
|
|
585
|
+
retry: {
|
|
586
|
+
onCodes: [
|
|
587
|
+
429,
|
|
588
|
+
500,
|
|
589
|
+
502,
|
|
590
|
+
],
|
|
591
|
+
},
|
|
592
|
+
fallbacks: [
|
|
593
|
+
{
|
|
594
|
+
model: "openai/gpt-5",
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
model: "anthropic/claude-4-opus",
|
|
598
|
+
},
|
|
599
|
+
],
|
|
600
|
+
contact: {
|
|
601
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
602
|
+
displayName: "Jane Doe",
|
|
603
|
+
email: "jane.doe@example.com",
|
|
604
|
+
},
|
|
605
|
+
thread: {
|
|
606
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
607
|
+
tags: [
|
|
608
|
+
"customer-support",
|
|
609
|
+
],
|
|
610
|
+
},
|
|
611
|
+
inputs: {
|
|
612
|
+
"customer_name": "John Smith",
|
|
613
|
+
"issue_type": "billing",
|
|
614
|
+
},
|
|
615
|
+
cache: {
|
|
616
|
+
ttl: 3600,
|
|
617
|
+
type: "exact_match",
|
|
618
|
+
},
|
|
619
|
+
knowledgeBases: [
|
|
620
|
+
{
|
|
621
|
+
topK: 5,
|
|
622
|
+
knowledgeId: "knowledge_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
},
|
|
626
|
+
});
|
|
627
|
+
if (res.ok) {
|
|
628
|
+
const { value: result } = res;
|
|
629
|
+
for await (const event of result) {
|
|
630
|
+
// Handle the event
|
|
631
|
+
console.log(event);
|
|
632
|
+
}
|
|
633
|
+
} else {
|
|
634
|
+
console.log("proxyCompletions failed:", res.error);
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
run();
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
### Parameters
|
|
642
|
+
|
|
643
|
+
| Parameter | Type | Required | Description |
|
|
644
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
645
|
+
| `request` | [operations.PostV2ProxyCompletionsRequestBody](../../models/operations/postv2proxycompletionsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
646
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
647
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
648
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
649
|
+
|
|
650
|
+
### Response
|
|
651
|
+
|
|
652
|
+
**Promise\<[operations.PostV2ProxyCompletionsResponse](../../models/operations/postv2proxycompletionsresponse.md)\>**
|
|
653
|
+
|
|
654
|
+
### Errors
|
|
655
|
+
|
|
656
|
+
| Error Type | Status Code | Content Type |
|
|
657
|
+
| --------------- | --------------- | --------------- |
|
|
658
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
659
|
+
|
|
660
|
+
## imagesGenerate
|
|
661
|
+
|
|
662
|
+
Create an Image
|
|
663
|
+
|
|
664
|
+
### Example Usage
|
|
665
|
+
|
|
666
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/images/generations" method="post" path="/v2/proxy/images/generations" -->
|
|
667
|
+
```typescript
|
|
668
|
+
import { Orq } from "@orq-ai/node";
|
|
669
|
+
|
|
670
|
+
const orq = new Orq({
|
|
671
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
672
|
+
});
|
|
673
|
+
|
|
674
|
+
async function run() {
|
|
675
|
+
const result = await orq.proxy.imagesGenerate({
|
|
676
|
+
prompt: "<value>",
|
|
677
|
+
model: "F-150",
|
|
678
|
+
orq: {
|
|
679
|
+
retry: {
|
|
680
|
+
onCodes: [
|
|
681
|
+
429,
|
|
682
|
+
500,
|
|
683
|
+
502,
|
|
684
|
+
503,
|
|
685
|
+
504,
|
|
686
|
+
],
|
|
687
|
+
},
|
|
688
|
+
fallbacks: [
|
|
689
|
+
{
|
|
690
|
+
model: "openai/gpt-4o-mini",
|
|
691
|
+
},
|
|
692
|
+
],
|
|
693
|
+
contact: {
|
|
694
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
695
|
+
displayName: "Jane Doe",
|
|
696
|
+
email: "jane.doe@example.com",
|
|
697
|
+
metadata: [
|
|
698
|
+
{
|
|
699
|
+
"department": "Engineering",
|
|
700
|
+
"role": "Senior Developer",
|
|
701
|
+
},
|
|
702
|
+
],
|
|
703
|
+
logoUrl: "https://example.com/avatars/jane-doe.jpg",
|
|
704
|
+
tags: [
|
|
705
|
+
"hr",
|
|
706
|
+
"engineering",
|
|
707
|
+
],
|
|
708
|
+
},
|
|
709
|
+
thread: {
|
|
710
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
711
|
+
tags: [
|
|
712
|
+
"customer-support",
|
|
713
|
+
"priority-high",
|
|
714
|
+
],
|
|
715
|
+
},
|
|
716
|
+
cache: {
|
|
717
|
+
ttl: 3600,
|
|
718
|
+
type: "exact_match",
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
});
|
|
722
|
+
|
|
723
|
+
console.log(result);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
run();
|
|
727
|
+
```
|
|
728
|
+
|
|
729
|
+
### Standalone function
|
|
730
|
+
|
|
731
|
+
The standalone function version of this method:
|
|
732
|
+
|
|
733
|
+
```typescript
|
|
734
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
735
|
+
import { proxyImagesGenerate } from "@orq-ai/node/funcs/proxyImagesGenerate.js";
|
|
736
|
+
|
|
737
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
738
|
+
// You can create one instance of it to use across an application.
|
|
739
|
+
const orq = new OrqCore({
|
|
740
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
741
|
+
});
|
|
742
|
+
|
|
743
|
+
async function run() {
|
|
744
|
+
const res = await proxyImagesGenerate(orq, {
|
|
745
|
+
prompt: "<value>",
|
|
746
|
+
model: "F-150",
|
|
747
|
+
orq: {
|
|
748
|
+
retry: {
|
|
749
|
+
onCodes: [
|
|
750
|
+
429,
|
|
751
|
+
500,
|
|
752
|
+
502,
|
|
753
|
+
503,
|
|
754
|
+
504,
|
|
755
|
+
],
|
|
756
|
+
},
|
|
757
|
+
fallbacks: [
|
|
758
|
+
{
|
|
759
|
+
model: "openai/gpt-4o-mini",
|
|
760
|
+
},
|
|
761
|
+
],
|
|
762
|
+
contact: {
|
|
763
|
+
id: "contact_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
764
|
+
displayName: "Jane Doe",
|
|
765
|
+
email: "jane.doe@example.com",
|
|
766
|
+
metadata: [
|
|
767
|
+
{
|
|
768
|
+
"department": "Engineering",
|
|
769
|
+
"role": "Senior Developer",
|
|
770
|
+
},
|
|
771
|
+
],
|
|
772
|
+
logoUrl: "https://example.com/avatars/jane-doe.jpg",
|
|
773
|
+
tags: [
|
|
774
|
+
"hr",
|
|
775
|
+
"engineering",
|
|
776
|
+
],
|
|
777
|
+
},
|
|
778
|
+
thread: {
|
|
779
|
+
id: "thread_01ARZ3NDEKTSV4RRFFQ69G5FAV",
|
|
780
|
+
tags: [
|
|
781
|
+
"customer-support",
|
|
782
|
+
"priority-high",
|
|
783
|
+
],
|
|
784
|
+
},
|
|
785
|
+
cache: {
|
|
786
|
+
ttl: 3600,
|
|
787
|
+
type: "exact_match",
|
|
788
|
+
},
|
|
789
|
+
},
|
|
790
|
+
});
|
|
791
|
+
if (res.ok) {
|
|
792
|
+
const { value: result } = res;
|
|
793
|
+
console.log(result);
|
|
794
|
+
} else {
|
|
795
|
+
console.log("proxyImagesGenerate failed:", res.error);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
run();
|
|
800
|
+
```
|
|
801
|
+
|
|
802
|
+
### Parameters
|
|
803
|
+
|
|
804
|
+
| Parameter | Type | Required | Description |
|
|
805
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
806
|
+
| `request` | [operations.PostV2ProxyImagesGenerationsRequestBody](../../models/operations/postv2proxyimagesgenerationsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
807
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
808
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
809
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
810
|
+
|
|
811
|
+
### Response
|
|
812
|
+
|
|
813
|
+
**Promise\<[operations.PostV2ProxyImagesGenerationsResponseBody](../../models/operations/postv2proxyimagesgenerationsresponsebody.md)\>**
|
|
814
|
+
|
|
815
|
+
### Errors
|
|
816
|
+
|
|
817
|
+
| Error Type | Status Code | Content Type |
|
|
818
|
+
| --------------- | --------------- | --------------- |
|
|
819
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
820
|
+
|
|
821
|
+
## imagesEdit
|
|
822
|
+
|
|
823
|
+
Edit an Image
|
|
824
|
+
|
|
825
|
+
### Example Usage
|
|
826
|
+
|
|
827
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/images/edits" method="post" path="/v2/proxy/images/edits" -->
|
|
828
|
+
```typescript
|
|
829
|
+
import { Orq } from "@orq-ai/node";
|
|
830
|
+
|
|
831
|
+
const orq = new Orq({
|
|
832
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
async function run() {
|
|
836
|
+
const result = await orq.proxy.imagesEdit({
|
|
837
|
+
model: "Grand Cherokee",
|
|
838
|
+
image: "https://picsum.photos/seed/4IopZRfO/3966/2653",
|
|
839
|
+
prompt: "<value>",
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
console.log(result);
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
run();
|
|
846
|
+
```
|
|
847
|
+
|
|
848
|
+
### Standalone function
|
|
849
|
+
|
|
850
|
+
The standalone function version of this method:
|
|
851
|
+
|
|
852
|
+
```typescript
|
|
853
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
854
|
+
import { proxyImagesEdit } from "@orq-ai/node/funcs/proxyImagesEdit.js";
|
|
855
|
+
|
|
856
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
857
|
+
// You can create one instance of it to use across an application.
|
|
858
|
+
const orq = new OrqCore({
|
|
859
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
860
|
+
});
|
|
861
|
+
|
|
862
|
+
async function run() {
|
|
863
|
+
const res = await proxyImagesEdit(orq, {
|
|
864
|
+
model: "Grand Cherokee",
|
|
865
|
+
image: "https://picsum.photos/seed/4IopZRfO/3966/2653",
|
|
866
|
+
prompt: "<value>",
|
|
867
|
+
});
|
|
868
|
+
if (res.ok) {
|
|
869
|
+
const { value: result } = res;
|
|
870
|
+
console.log(result);
|
|
871
|
+
} else {
|
|
872
|
+
console.log("proxyImagesEdit failed:", res.error);
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
run();
|
|
877
|
+
```
|
|
878
|
+
|
|
879
|
+
### Parameters
|
|
880
|
+
|
|
881
|
+
| Parameter | Type | Required | Description |
|
|
882
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
883
|
+
| `request` | [operations.PostV2ProxyImagesEditsRequestBody](../../models/operations/postv2proxyimageseditsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
884
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
885
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
886
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
887
|
+
|
|
888
|
+
### Response
|
|
889
|
+
|
|
890
|
+
**Promise\<[operations.PostV2ProxyImagesEditsResponseBody](../../models/operations/postv2proxyimageseditsresponsebody.md)\>**
|
|
891
|
+
|
|
892
|
+
### Errors
|
|
893
|
+
|
|
894
|
+
| Error Type | Status Code | Content Type |
|
|
895
|
+
| --------------- | --------------- | --------------- |
|
|
896
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
897
|
+
|
|
898
|
+
## imagesVariation
|
|
899
|
+
|
|
900
|
+
Create an Image Variation
|
|
901
|
+
|
|
902
|
+
### Example Usage
|
|
903
|
+
|
|
904
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/images/variations" method="post" path="/v2/proxy/images/variations" -->
|
|
905
|
+
```typescript
|
|
906
|
+
import { Orq } from "@orq-ai/node";
|
|
907
|
+
|
|
908
|
+
const orq = new Orq({
|
|
909
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
async function run() {
|
|
913
|
+
const result = await orq.proxy.imagesVariation({
|
|
914
|
+
image: "https://picsum.photos/seed/3tyQFc/1182/550",
|
|
915
|
+
model: "Cruze",
|
|
916
|
+
});
|
|
917
|
+
|
|
918
|
+
console.log(result);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
run();
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
### Standalone function
|
|
925
|
+
|
|
926
|
+
The standalone function version of this method:
|
|
927
|
+
|
|
928
|
+
```typescript
|
|
929
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
930
|
+
import { proxyImagesVariation } from "@orq-ai/node/funcs/proxyImagesVariation.js";
|
|
931
|
+
|
|
932
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
933
|
+
// You can create one instance of it to use across an application.
|
|
934
|
+
const orq = new OrqCore({
|
|
935
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
async function run() {
|
|
939
|
+
const res = await proxyImagesVariation(orq, {
|
|
940
|
+
image: "https://picsum.photos/seed/3tyQFc/1182/550",
|
|
941
|
+
model: "Cruze",
|
|
942
|
+
});
|
|
943
|
+
if (res.ok) {
|
|
944
|
+
const { value: result } = res;
|
|
945
|
+
console.log(result);
|
|
946
|
+
} else {
|
|
947
|
+
console.log("proxyImagesVariation failed:", res.error);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
run();
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
### Parameters
|
|
955
|
+
|
|
956
|
+
| Parameter | Type | Required | Description |
|
|
957
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
958
|
+
| `request` | [operations.PostV2ProxyImagesVariationsRequestBody](../../models/operations/postv2proxyimagesvariationsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
959
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
960
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
961
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
962
|
+
|
|
963
|
+
### Response
|
|
964
|
+
|
|
965
|
+
**Promise\<[operations.PostV2ProxyImagesVariationsResponseBody](../../models/operations/postv2proxyimagesvariationsresponsebody.md)\>**
|
|
966
|
+
|
|
967
|
+
### Errors
|
|
968
|
+
|
|
969
|
+
| Error Type | Status Code | Content Type |
|
|
970
|
+
| --------------- | --------------- | --------------- |
|
|
971
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
972
|
+
|
|
973
|
+
## audioTranscriptions
|
|
974
|
+
|
|
975
|
+
### Example Usage
|
|
976
|
+
|
|
977
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/audio/transcriptions" method="post" path="/v2/proxy/audio/transcriptions" -->
|
|
978
|
+
```typescript
|
|
979
|
+
import { Orq } from "@orq-ai/node";
|
|
980
|
+
import { openAsBlob } from "node:fs";
|
|
981
|
+
|
|
982
|
+
const orq = new Orq({
|
|
983
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
984
|
+
});
|
|
985
|
+
|
|
986
|
+
async function run() {
|
|
987
|
+
const result = await orq.proxy.audioTranscriptions({
|
|
988
|
+
temperature: 0.5,
|
|
989
|
+
timestampGranularities: [
|
|
990
|
+
"word",
|
|
991
|
+
"segment",
|
|
992
|
+
],
|
|
993
|
+
file: await openAsBlob("example.file"),
|
|
994
|
+
});
|
|
995
|
+
|
|
996
|
+
console.log(result);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
run();
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
### Standalone function
|
|
1003
|
+
|
|
1004
|
+
The standalone function version of this method:
|
|
1005
|
+
|
|
1006
|
+
```typescript
|
|
1007
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
1008
|
+
import { proxyAudioTranscriptions } from "@orq-ai/node/funcs/proxyAudioTranscriptions.js";
|
|
1009
|
+
import { openAsBlob } from "node:fs";
|
|
1010
|
+
|
|
1011
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
1012
|
+
// You can create one instance of it to use across an application.
|
|
1013
|
+
const orq = new OrqCore({
|
|
1014
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
1015
|
+
});
|
|
1016
|
+
|
|
1017
|
+
async function run() {
|
|
1018
|
+
const res = await proxyAudioTranscriptions(orq, {
|
|
1019
|
+
temperature: 0.5,
|
|
1020
|
+
timestampGranularities: [
|
|
1021
|
+
"word",
|
|
1022
|
+
"segment",
|
|
1023
|
+
],
|
|
1024
|
+
file: await openAsBlob("example.file"),
|
|
1025
|
+
});
|
|
1026
|
+
if (res.ok) {
|
|
1027
|
+
const { value: result } = res;
|
|
1028
|
+
console.log(result);
|
|
1029
|
+
} else {
|
|
1030
|
+
console.log("proxyAudioTranscriptions failed:", res.error);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
run();
|
|
1035
|
+
```
|
|
1036
|
+
|
|
1037
|
+
### Parameters
|
|
1038
|
+
|
|
1039
|
+
| Parameter | Type | Required | Description |
|
|
1040
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1041
|
+
| `request` | [operations.PostV2ProxyAudioTranscriptionsRequestBody](../../models/operations/postv2proxyaudiotranscriptionsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
1042
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
1043
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
1044
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
1045
|
+
|
|
1046
|
+
### Response
|
|
1047
|
+
|
|
1048
|
+
**Promise\<[operations.PostV2ProxyAudioTranscriptionsResponseBody](../../models/operations/postv2proxyaudiotranscriptionsresponsebody.md)\>**
|
|
1049
|
+
|
|
1050
|
+
### Errors
|
|
1051
|
+
|
|
1052
|
+
| Error Type | Status Code | Content Type |
|
|
1053
|
+
| ------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------- |
|
|
1054
|
+
| errors.PostV2ProxyAudioTranscriptionsResponseBody | 422 | application/json |
|
|
1055
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
1056
|
+
|
|
1057
|
+
## audioTranslations
|
|
1058
|
+
|
|
1059
|
+
### Example Usage
|
|
1060
|
+
|
|
1061
|
+
<!-- UsageSnippet language="typescript" operationID="post_/v2/proxy/audio/translations" method="post" path="/v2/proxy/audio/translations" -->
|
|
1062
|
+
```typescript
|
|
1063
|
+
import { Orq } from "@orq-ai/node";
|
|
1064
|
+
import { openAsBlob } from "node:fs";
|
|
1065
|
+
|
|
1066
|
+
const orq = new Orq({
|
|
1067
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
1068
|
+
});
|
|
1069
|
+
|
|
1070
|
+
async function run() {
|
|
1071
|
+
const result = await orq.proxy.audioTranslations({
|
|
1072
|
+
temperature: 0.5,
|
|
1073
|
+
file: await openAsBlob("example.file"),
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
console.log(result);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
run();
|
|
1080
|
+
```
|
|
1081
|
+
|
|
1082
|
+
### Standalone function
|
|
1083
|
+
|
|
1084
|
+
The standalone function version of this method:
|
|
1085
|
+
|
|
1086
|
+
```typescript
|
|
1087
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
1088
|
+
import { proxyAudioTranslations } from "@orq-ai/node/funcs/proxyAudioTranslations.js";
|
|
1089
|
+
import { openAsBlob } from "node:fs";
|
|
1090
|
+
|
|
1091
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
1092
|
+
// You can create one instance of it to use across an application.
|
|
1093
|
+
const orq = new OrqCore({
|
|
1094
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
1095
|
+
});
|
|
1096
|
+
|
|
1097
|
+
async function run() {
|
|
1098
|
+
const res = await proxyAudioTranslations(orq, {
|
|
1099
|
+
temperature: 0.5,
|
|
1100
|
+
file: await openAsBlob("example.file"),
|
|
1101
|
+
});
|
|
1102
|
+
if (res.ok) {
|
|
1103
|
+
const { value: result } = res;
|
|
1104
|
+
console.log(result);
|
|
1105
|
+
} else {
|
|
1106
|
+
console.log("proxyAudioTranslations failed:", res.error);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
run();
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
### Parameters
|
|
1114
|
+
|
|
1115
|
+
| Parameter | Type | Required | Description |
|
|
1116
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1117
|
+
| `request` | [operations.PostV2ProxyAudioTranslationsRequestBody](../../models/operations/postv2proxyaudiotranslationsrequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
1118
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
1119
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
1120
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
1121
|
+
|
|
1122
|
+
### Response
|
|
1123
|
+
|
|
1124
|
+
**Promise\<[operations.PostV2ProxyAudioTranslationsResponseBody](../../models/operations/postv2proxyaudiotranslationsresponsebody.md)\>**
|
|
1125
|
+
|
|
1126
|
+
### Errors
|
|
1127
|
+
|
|
1128
|
+
| Error Type | Status Code | Content Type |
|
|
1129
|
+
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
|
1130
|
+
| errors.PostV2ProxyAudioTranslationsResponseBody | 422 | application/json |
|
|
1131
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
1132
|
+
|
|
1133
|
+
## responsesCreate
|
|
1134
|
+
|
|
1135
|
+
Creates a model response for the given input.
|
|
1136
|
+
|
|
1137
|
+
### Example Usage
|
|
1138
|
+
|
|
1139
|
+
<!-- UsageSnippet language="typescript" operationID="CreateResponse" method="post" path="/v2/proxy/responses" -->
|
|
1140
|
+
```typescript
|
|
1141
|
+
import { Orq } from "@orq-ai/node";
|
|
1142
|
+
|
|
1143
|
+
const orq = new Orq({
|
|
1144
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
async function run() {
|
|
1148
|
+
const result = await orq.proxy.responsesCreate({
|
|
1149
|
+
model: "Element",
|
|
1150
|
+
input: "<value>",
|
|
1151
|
+
});
|
|
1152
|
+
|
|
1153
|
+
for await (const event of result) {
|
|
1154
|
+
// Handle the event
|
|
1155
|
+
console.log(event);
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
run();
|
|
1160
|
+
```
|
|
1161
|
+
|
|
1162
|
+
### Standalone function
|
|
1163
|
+
|
|
1164
|
+
The standalone function version of this method:
|
|
1165
|
+
|
|
1166
|
+
```typescript
|
|
1167
|
+
import { OrqCore } from "@orq-ai/node/core.js";
|
|
1168
|
+
import { proxyResponsesCreate } from "@orq-ai/node/funcs/proxyResponsesCreate.js";
|
|
1169
|
+
|
|
1170
|
+
// Use `OrqCore` for best tree-shaking performance.
|
|
1171
|
+
// You can create one instance of it to use across an application.
|
|
1172
|
+
const orq = new OrqCore({
|
|
1173
|
+
apiKey: process.env["ORQ_API_KEY"] ?? "",
|
|
1174
|
+
});
|
|
1175
|
+
|
|
1176
|
+
async function run() {
|
|
1177
|
+
const res = await proxyResponsesCreate(orq, {
|
|
1178
|
+
model: "Element",
|
|
1179
|
+
input: "<value>",
|
|
1180
|
+
});
|
|
1181
|
+
if (res.ok) {
|
|
1182
|
+
const { value: result } = res;
|
|
1183
|
+
for await (const event of result) {
|
|
1184
|
+
// Handle the event
|
|
1185
|
+
console.log(event);
|
|
1186
|
+
}
|
|
1187
|
+
} else {
|
|
1188
|
+
console.log("proxyResponsesCreate failed:", res.error);
|
|
1189
|
+
}
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
run();
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
### Parameters
|
|
1196
|
+
|
|
1197
|
+
| Parameter | Type | Required | Description |
|
|
1198
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
1199
|
+
| `request` | [operations.CreateResponseRequestBody](../../models/operations/createresponserequestbody.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
1200
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
1201
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
1202
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
1203
|
+
|
|
1204
|
+
### Response
|
|
1205
|
+
|
|
1206
|
+
**Promise\<[operations.CreateResponseResponse](../../models/operations/createresponseresponse.md)\>**
|
|
1207
|
+
|
|
1208
|
+
### Errors
|
|
1209
|
+
|
|
1210
|
+
| Error Type | Status Code | Content Type |
|
|
1211
|
+
| --------------- | --------------- | --------------- |
|
|
1212
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|