@gpuai/sdk 0.3.12 → 0.3.13

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.
Files changed (44) hide show
  1. package/.openapi-generator/FILES +10 -0
  2. package/README.md +8 -2
  3. package/dist/apis/InferenceApi.d.ts +19 -0
  4. package/dist/apis/InferenceApi.js +51 -0
  5. package/dist/esm/apis/InferenceApi.d.ts +19 -0
  6. package/dist/esm/apis/InferenceApi.js +51 -0
  7. package/dist/esm/models/Embedding.d.ts +51 -0
  8. package/dist/esm/models/Embedding.js +59 -0
  9. package/dist/esm/models/EmbeddingsRequest.d.ts +64 -0
  10. package/dist/esm/models/EmbeddingsRequest.js +60 -0
  11. package/dist/esm/models/EmbeddingsRequestInput.d.ts +21 -0
  12. package/dist/esm/models/EmbeddingsRequestInput.js +47 -0
  13. package/dist/esm/models/EmbeddingsResponse.d.ts +59 -0
  14. package/dist/esm/models/EmbeddingsResponse.js +65 -0
  15. package/dist/esm/models/EmbeddingsUsage.d.ts +38 -0
  16. package/dist/esm/models/EmbeddingsUsage.js +47 -0
  17. package/dist/esm/models/index.d.ts +5 -0
  18. package/dist/esm/models/index.js +5 -0
  19. package/dist/models/Embedding.d.ts +51 -0
  20. package/dist/models/Embedding.js +67 -0
  21. package/dist/models/EmbeddingsRequest.d.ts +64 -0
  22. package/dist/models/EmbeddingsRequest.js +68 -0
  23. package/dist/models/EmbeddingsRequestInput.d.ts +21 -0
  24. package/dist/models/EmbeddingsRequestInput.js +53 -0
  25. package/dist/models/EmbeddingsResponse.d.ts +59 -0
  26. package/dist/models/EmbeddingsResponse.js +73 -0
  27. package/dist/models/EmbeddingsUsage.d.ts +38 -0
  28. package/dist/models/EmbeddingsUsage.js +54 -0
  29. package/dist/models/index.d.ts +5 -0
  30. package/dist/models/index.js +5 -0
  31. package/docs/Embedding.md +38 -0
  32. package/docs/EmbeddingsRequest.md +42 -0
  33. package/docs/EmbeddingsRequestInput.md +33 -0
  34. package/docs/EmbeddingsResponse.md +40 -0
  35. package/docs/EmbeddingsUsage.md +37 -0
  36. package/docs/InferenceApi.md +83 -0
  37. package/package.json +1 -1
  38. package/src/apis/InferenceApi.ts +71 -0
  39. package/src/models/Embedding.ts +96 -0
  40. package/src/models/EmbeddingsRequest.ts +117 -0
  41. package/src/models/EmbeddingsRequestInput.ts +59 -0
  42. package/src/models/EmbeddingsResponse.ts +120 -0
  43. package/src/models/EmbeddingsUsage.ts +75 -0
  44. package/src/models/index.ts +5 -0
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * GPU.ai Public Developer API
6
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ * Contact: support@gpu.ai
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.instanceOfEmbeddingsUsage = instanceOfEmbeddingsUsage;
17
+ exports.EmbeddingsUsageFromJSON = EmbeddingsUsageFromJSON;
18
+ exports.EmbeddingsUsageFromJSONTyped = EmbeddingsUsageFromJSONTyped;
19
+ exports.EmbeddingsUsageToJSON = EmbeddingsUsageToJSON;
20
+ exports.EmbeddingsUsageToJSONTyped = EmbeddingsUsageToJSONTyped;
21
+ /**
22
+ * Check if a given object implements the EmbeddingsUsage interface.
23
+ */
24
+ function instanceOfEmbeddingsUsage(value) {
25
+ if ((!('promptTokens' in value) && !('prompt_tokens' in value)) || (value['promptTokens'] === undefined && value['prompt_tokens'] === undefined))
26
+ return false;
27
+ if ((!('totalTokens' in value) && !('total_tokens' in value)) || (value['totalTokens'] === undefined && value['total_tokens'] === undefined))
28
+ return false;
29
+ return true;
30
+ }
31
+ function EmbeddingsUsageFromJSON(json) {
32
+ return EmbeddingsUsageFromJSONTyped(json, false);
33
+ }
34
+ function EmbeddingsUsageFromJSONTyped(json, ignoreDiscriminator) {
35
+ if (json == null) {
36
+ return json;
37
+ }
38
+ return {
39
+ 'promptTokens': json['prompt_tokens'],
40
+ 'totalTokens': json['total_tokens'],
41
+ };
42
+ }
43
+ function EmbeddingsUsageToJSON(json) {
44
+ return EmbeddingsUsageToJSONTyped(json, false);
45
+ }
46
+ function EmbeddingsUsageToJSONTyped(value, ignoreDiscriminator = false) {
47
+ if (value == null) {
48
+ return value;
49
+ }
50
+ return {
51
+ 'prompt_tokens': value['promptTokens'],
52
+ 'total_tokens': value['totalTokens'],
53
+ };
54
+ }
@@ -17,6 +17,11 @@ export * from './CreateRegistryCredentialRequest';
17
17
  export * from './CreateSshKeyRequest';
18
18
  export * from './CreateWebhookEndpointRequest';
19
19
  export * from './CryptoDeposit';
20
+ export * from './Embedding';
21
+ export * from './EmbeddingsRequest';
22
+ export * from './EmbeddingsRequestInput';
23
+ export * from './EmbeddingsResponse';
24
+ export * from './EmbeddingsUsage';
20
25
  export * from './Environments';
21
26
  export * from './FileObject';
22
27
  export * from './FineTuningJob';
@@ -35,6 +35,11 @@ __exportStar(require("./CreateRegistryCredentialRequest"), exports);
35
35
  __exportStar(require("./CreateSshKeyRequest"), exports);
36
36
  __exportStar(require("./CreateWebhookEndpointRequest"), exports);
37
37
  __exportStar(require("./CryptoDeposit"), exports);
38
+ __exportStar(require("./Embedding"), exports);
39
+ __exportStar(require("./EmbeddingsRequest"), exports);
40
+ __exportStar(require("./EmbeddingsRequestInput"), exports);
41
+ __exportStar(require("./EmbeddingsResponse"), exports);
42
+ __exportStar(require("./EmbeddingsUsage"), exports);
38
43
  __exportStar(require("./Environments"), exports);
39
44
  __exportStar(require("./FileObject"), exports);
40
45
  __exportStar(require("./FineTuningJob"), exports);
@@ -0,0 +1,38 @@
1
+
2
+ # Embedding
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `object` | string
10
+ `embedding` | Array<number>
11
+ `index` | number
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { Embedding } from '@gpuai/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "object": null,
21
+ "embedding": null,
22
+ "index": null,
23
+ } satisfies Embedding
24
+
25
+ console.log(example)
26
+
27
+ // Convert the instance to a JSON string
28
+ const exampleJSON: string = JSON.stringify(example)
29
+ console.log(exampleJSON)
30
+
31
+ // Parse the JSON string back to an object
32
+ const exampleParsed = JSON.parse(exampleJSON) as Embedding
33
+ console.log(exampleParsed)
34
+ ```
35
+
36
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
37
+
38
+
@@ -0,0 +1,42 @@
1
+
2
+ # EmbeddingsRequest
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `model` | string
10
+ `input` | [EmbeddingsRequestInput](EmbeddingsRequestInput.md)
11
+ `encodingFormat` | string
12
+ `dimensions` | number
13
+ `user` | string
14
+
15
+ ## Example
16
+
17
+ ```typescript
18
+ import type { EmbeddingsRequest } from '@gpuai/sdk'
19
+
20
+ // TODO: Update the object below with actual values
21
+ const example = {
22
+ "model": null,
23
+ "input": null,
24
+ "encodingFormat": null,
25
+ "dimensions": null,
26
+ "user": null,
27
+ } satisfies EmbeddingsRequest
28
+
29
+ console.log(example)
30
+
31
+ // Convert the instance to a JSON string
32
+ const exampleJSON: string = JSON.stringify(example)
33
+ console.log(exampleJSON)
34
+
35
+ // Parse the JSON string back to an object
36
+ const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsRequest
37
+ console.log(exampleParsed)
38
+ ```
39
+
40
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
41
+
42
+
@@ -0,0 +1,33 @@
1
+
2
+ # EmbeddingsRequestInput
3
+
4
+ Text to embed: either a single string or an array of up to 2048 strings. Token-id arrays are not supported. The per-request ceiling is bounded so the response stays under 64 MiB — about 680 inputs at 4096 dimensions, fewer at a larger `dimensions` value; an over-limit batch is rejected with 400 invalid_request_error whose message states the limit, before any processing.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+
11
+ ## Example
12
+
13
+ ```typescript
14
+ import type { EmbeddingsRequestInput } from '@gpuai/sdk'
15
+
16
+ // TODO: Update the object below with actual values
17
+ const example = {
18
+ } satisfies EmbeddingsRequestInput
19
+
20
+ console.log(example)
21
+
22
+ // Convert the instance to a JSON string
23
+ const exampleJSON: string = JSON.stringify(example)
24
+ console.log(exampleJSON)
25
+
26
+ // Parse the JSON string back to an object
27
+ const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsRequestInput
28
+ console.log(exampleParsed)
29
+ ```
30
+
31
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
32
+
33
+
@@ -0,0 +1,40 @@
1
+
2
+ # EmbeddingsResponse
3
+
4
+
5
+ ## Properties
6
+
7
+ Name | Type
8
+ ------------ | -------------
9
+ `object` | string
10
+ `data` | [Array<Embedding>](Embedding.md)
11
+ `model` | string
12
+ `usage` | [EmbeddingsUsage](EmbeddingsUsage.md)
13
+
14
+ ## Example
15
+
16
+ ```typescript
17
+ import type { EmbeddingsResponse } from '@gpuai/sdk'
18
+
19
+ // TODO: Update the object below with actual values
20
+ const example = {
21
+ "object": null,
22
+ "data": null,
23
+ "model": null,
24
+ "usage": null,
25
+ } satisfies EmbeddingsResponse
26
+
27
+ console.log(example)
28
+
29
+ // Convert the instance to a JSON string
30
+ const exampleJSON: string = JSON.stringify(example)
31
+ console.log(exampleJSON)
32
+
33
+ // Parse the JSON string back to an object
34
+ const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsResponse
35
+ console.log(exampleParsed)
36
+ ```
37
+
38
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
39
+
40
+
@@ -0,0 +1,37 @@
1
+
2
+ # EmbeddingsUsage
3
+
4
+ Embeddings are billed on input tokens only, so this block carries no completion_tokens field — an embeddings call emits none, and total_tokens always equals prompt_tokens.
5
+
6
+ ## Properties
7
+
8
+ Name | Type
9
+ ------------ | -------------
10
+ `promptTokens` | number
11
+ `totalTokens` | number
12
+
13
+ ## Example
14
+
15
+ ```typescript
16
+ import type { EmbeddingsUsage } from '@gpuai/sdk'
17
+
18
+ // TODO: Update the object below with actual values
19
+ const example = {
20
+ "promptTokens": null,
21
+ "totalTokens": null,
22
+ } satisfies EmbeddingsUsage
23
+
24
+ console.log(example)
25
+
26
+ // Convert the instance to a JSON string
27
+ const exampleJSON: string = JSON.stringify(example)
28
+ console.log(exampleJSON)
29
+
30
+ // Parse the JSON string back to an object
31
+ const exampleParsed = JSON.parse(exampleJSON) as EmbeddingsUsage
32
+ console.log(exampleParsed)
33
+ ```
34
+
35
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
36
+
37
+
@@ -6,6 +6,7 @@ All URIs are relative to *https://api.gpu.ai/v1*
6
6
  |------------- | ------------- | -------------|
7
7
  | [**cancelVideo**](InferenceApi.md#cancelvideo) | **POST** /videos/{id}/cancel | Cancel a video generation job |
8
8
  | [**createChatCompletion**](InferenceApi.md#createchatcompletion) | **POST** /chat/completions | Create a chat completion (OpenAI-compatible) |
9
+ | [**createEmbeddings**](InferenceApi.md#createembeddings) | **POST** /embeddings | Create embeddings (OpenAI-compatible) |
9
10
  | [**createImage**](InferenceApi.md#createimage) | **POST** /images/generations | Create image (OpenAI-compatible) |
10
11
  | [**createVideo**](InferenceApi.md#createvideo) | **POST** /videos | Create a video generation job (async) |
11
12
  | [**getModel**](InferenceApi.md#getmodel) | **GET** /models/{id} | Get a specific model (OpenAI-compatible) |
@@ -168,6 +169,88 @@ example().catch(console.error);
168
169
  [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
169
170
 
170
171
 
172
+ ## createEmbeddings
173
+
174
+ > EmbeddingsResponse createEmbeddings(embeddingsRequest)
175
+
176
+ Create embeddings (OpenAI-compatible)
177
+
178
+ Synchronous text embeddings. Accepts a single string or an array of up to 2048 strings, bounded so the response stays under 64 MiB (about 680 inputs at 4096 dimensions; fewer at a larger `dimensions` value) — over-limit requests are rejected with 400 before any processing. Returns one float vector per input, in request order. Billed on the upstream\'s reported prompt tokens at the model\'s listed input rate, rounded up to the next whole cent per request; an embeddings call emits no completion tokens, so `usage` carries `prompt_tokens` and `total_tokens` only. `encoding_format` accepts only `float` — a value of `base64` is rejected with `unsupported_parameter`. A chat model id on this route returns 404 `model_not_found`: the id is valid, but not on this surface.
179
+
180
+ ### Example
181
+
182
+ ```ts
183
+ import {
184
+ Configuration,
185
+ InferenceApi,
186
+ } from '@gpuai/sdk';
187
+ import type { CreateEmbeddingsRequest } from '@gpuai/sdk';
188
+
189
+ async function example() {
190
+ console.log("🚀 Testing @gpuai/sdk SDK...");
191
+ const config = new Configuration({
192
+ // Configure HTTP bearer authorization: bearerAuth
193
+ accessToken: "YOUR BEARER TOKEN",
194
+ });
195
+ const api = new InferenceApi(config);
196
+
197
+ const body = {
198
+ // EmbeddingsRequest
199
+ embeddingsRequest: ...,
200
+ } satisfies CreateEmbeddingsRequest;
201
+
202
+ try {
203
+ const data = await api.createEmbeddings(body);
204
+ console.log(data);
205
+ } catch (error) {
206
+ console.error(error);
207
+ }
208
+ }
209
+
210
+ // Run the test
211
+ example().catch(console.error);
212
+ ```
213
+
214
+ ### Parameters
215
+
216
+
217
+ | Name | Type | Description | Notes |
218
+ |------------- | ------------- | ------------- | -------------|
219
+ | **embeddingsRequest** | [EmbeddingsRequest](EmbeddingsRequest.md) | | |
220
+
221
+ ### Return type
222
+
223
+ [**EmbeddingsResponse**](EmbeddingsResponse.md)
224
+
225
+ ### Authorization
226
+
227
+ [bearerAuth](../README.md#bearerAuth)
228
+
229
+ ### HTTP request headers
230
+
231
+ - **Content-Type**: `application/json`
232
+ - **Accept**: `application/json`
233
+
234
+
235
+ ### HTTP response details
236
+ | Status code | Description | Response headers |
237
+ |-------------|-------------|------------------|
238
+ | **200** | One embedding vector per input, in request order. | - |
239
+ | **400** | Invalid request (OpenAI error envelope). | - |
240
+ | **401** | Missing or invalid API key (OpenAI error envelope). | - |
241
+ | **402** | Insufficient balance (OpenAI error envelope, SERV-06). | - |
242
+ | **403** | API key lacks the required scope (OpenAI error envelope). | - |
243
+ | **404** | Model or resource not found (OpenAI error envelope). | - |
244
+ | **413** | Request body too large (OpenAI error envelope, code request_too_large). | - |
245
+ | **429** | Rate limit exceeded (OpenAI error envelope). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
246
+ | **500** | Internal server error (OpenAI error envelope). | - |
247
+ | **502** | The upstream answered but its response could not be used (OpenAI error envelope): code upstream_response_too_large when the vector payload exceeded the per-request size limit, or upstream_error for a malformed / misaligned response. Not retryable as-is for upstream_response_too_large — send fewer inputs. | - |
248
+ | **503** | Upstream provider unavailable (OpenAI error envelope). Retry-After header may indicate seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
249
+ | **504** | Upstream provider exceeded the synchronous per-attempt deadline (OpenAI error envelope). 504 semantic — distinct from 503 OpenAIUpstreamUnavailable which signals a connection or routing failure rather than a timeout. | - |
250
+
251
+ [[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
252
+
253
+
171
254
  ## createImage
172
255
 
173
256
  > ImagesResponse createImage(imagesGenerationsRequest, idempotencyKey)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gpuai/sdk",
3
- "version": "0.3.12",
3
+ "version": "0.3.13",
4
4
  "description": "TypeScript SDK for the GPU.ai Public Developer API",
5
5
  "author": "GPU.ai Support <support@gpu.ai>",
6
6
  "repository": {
@@ -23,6 +23,16 @@ import {
23
23
  ChatCompletionResponseFromJSON,
24
24
  ChatCompletionResponseToJSON,
25
25
  } from '../models/ChatCompletionResponse';
26
+ import {
27
+ type EmbeddingsRequest,
28
+ EmbeddingsRequestFromJSON,
29
+ EmbeddingsRequestToJSON,
30
+ } from '../models/EmbeddingsRequest';
31
+ import {
32
+ type EmbeddingsResponse,
33
+ EmbeddingsResponseFromJSON,
34
+ EmbeddingsResponseToJSON,
35
+ } from '../models/EmbeddingsResponse';
26
36
  import {
27
37
  type ImagesGenerationsRequest,
28
38
  ImagesGenerationsRequestFromJSON,
@@ -72,6 +82,10 @@ export interface CreateChatCompletionRequest {
72
82
  chatCompletionRequest: ChatCompletionRequest;
73
83
  }
74
84
 
85
+ export interface CreateEmbeddingsRequest {
86
+ embeddingsRequest: EmbeddingsRequest;
87
+ }
88
+
75
89
  export interface CreateImageRequest {
76
90
  imagesGenerationsRequest: ImagesGenerationsRequest;
77
91
  idempotencyKey?: string;
@@ -216,6 +230,63 @@ export class InferenceApi extends runtime.BaseAPI {
216
230
  return await response.value();
217
231
  }
218
232
 
233
+ /**
234
+ * Creates request options for createEmbeddings without sending the request
235
+ */
236
+ async createEmbeddingsRequestOpts(requestParameters: CreateEmbeddingsRequest): Promise<runtime.RequestOpts> {
237
+ if (requestParameters['embeddingsRequest'] == null) {
238
+ throw new runtime.RequiredError(
239
+ 'embeddingsRequest',
240
+ 'Required parameter "embeddingsRequest" was null or undefined when calling createEmbeddings().'
241
+ );
242
+ }
243
+
244
+ const queryParameters: any = {};
245
+
246
+ const headerParameters: runtime.HTTPHeaders = {};
247
+
248
+ headerParameters['Content-Type'] = 'application/json';
249
+
250
+ if (this.configuration && this.configuration.accessToken) {
251
+ const token = this.configuration.accessToken;
252
+ const tokenString = await token("bearerAuth", []);
253
+
254
+ if (tokenString) {
255
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
256
+ }
257
+ }
258
+
259
+ let urlPath = `/embeddings`;
260
+
261
+ return {
262
+ path: urlPath,
263
+ method: 'POST',
264
+ headers: headerParameters,
265
+ query: queryParameters,
266
+ body: EmbeddingsRequestToJSON(requestParameters['embeddingsRequest']),
267
+ };
268
+ }
269
+
270
+ /**
271
+ * Synchronous text embeddings. Accepts a single string or an array of up to 2048 strings, bounded so the response stays under 64 MiB (about 680 inputs at 4096 dimensions; fewer at a larger `dimensions` value) — over-limit requests are rejected with 400 before any processing. Returns one float vector per input, in request order. Billed on the upstream\'s reported prompt tokens at the model\'s listed input rate, rounded up to the next whole cent per request; an embeddings call emits no completion tokens, so `usage` carries `prompt_tokens` and `total_tokens` only. `encoding_format` accepts only `float` — a value of `base64` is rejected with `unsupported_parameter`. A chat model id on this route returns 404 `model_not_found`: the id is valid, but not on this surface.
272
+ * Create embeddings (OpenAI-compatible)
273
+ */
274
+ async createEmbeddingsRaw(requestParameters: CreateEmbeddingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EmbeddingsResponse>> {
275
+ const requestOptions = await this.createEmbeddingsRequestOpts(requestParameters);
276
+ const response = await this.request(requestOptions, initOverrides);
277
+
278
+ return new runtime.JSONApiResponse(response, (jsonValue) => EmbeddingsResponseFromJSON(jsonValue));
279
+ }
280
+
281
+ /**
282
+ * Synchronous text embeddings. Accepts a single string or an array of up to 2048 strings, bounded so the response stays under 64 MiB (about 680 inputs at 4096 dimensions; fewer at a larger `dimensions` value) — over-limit requests are rejected with 400 before any processing. Returns one float vector per input, in request order. Billed on the upstream\'s reported prompt tokens at the model\'s listed input rate, rounded up to the next whole cent per request; an embeddings call emits no completion tokens, so `usage` carries `prompt_tokens` and `total_tokens` only. `encoding_format` accepts only `float` — a value of `base64` is rejected with `unsupported_parameter`. A chat model id on this route returns 404 `model_not_found`: the id is valid, but not on this surface.
283
+ * Create embeddings (OpenAI-compatible)
284
+ */
285
+ async createEmbeddings(requestParameters: CreateEmbeddingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EmbeddingsResponse> {
286
+ const response = await this.createEmbeddingsRaw(requestParameters, initOverrides);
287
+ return await response.value();
288
+ }
289
+
219
290
  /**
220
291
  * Creates request options for createImage without sending the request
221
292
  */
@@ -0,0 +1,96 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ /**
17
+ *
18
+ * @export
19
+ * @interface Embedding
20
+ */
21
+ export interface Embedding {
22
+ /**
23
+ *
24
+ * @type {EmbeddingObjectEnum}
25
+ * @memberof Embedding
26
+ */
27
+ object: EmbeddingObjectEnum;
28
+ /**
29
+ * The embedding vector as 32-bit floats.
30
+ * @type {Array<number>}
31
+ * @memberof Embedding
32
+ */
33
+ embedding: Array<number>;
34
+ /**
35
+ * Position of this vector's input in the request.
36
+ * @type {number}
37
+ * @memberof Embedding
38
+ */
39
+ index: number;
40
+ }
41
+
42
+
43
+ /**
44
+ * @export
45
+ */
46
+ export const EmbeddingObjectEnum = {
47
+ Embedding: 'embedding'
48
+ } as const;
49
+ export type EmbeddingObjectEnum = typeof EmbeddingObjectEnum[keyof typeof EmbeddingObjectEnum];
50
+
51
+
52
+ /**
53
+ * Check if a given object implements the Embedding interface.
54
+ */
55
+ export function instanceOfEmbedding(value: object): value is Embedding {
56
+ if (!('object' in value) || value['object'] === undefined) return false;
57
+ if (value['object'] !== 'embedding') return false;
58
+
59
+ if (!('embedding' in value) || value['embedding'] === undefined) return false;
60
+ if (!('index' in value) || value['index'] === undefined) return false;
61
+ return true;
62
+ }
63
+
64
+ export function EmbeddingFromJSON(json: any): Embedding {
65
+ return EmbeddingFromJSONTyped(json, false);
66
+ }
67
+
68
+ export function EmbeddingFromJSONTyped(json: any, ignoreDiscriminator: boolean): Embedding {
69
+ if (json == null) {
70
+ return json;
71
+ }
72
+ return {
73
+
74
+ 'object': json['object'],
75
+ 'embedding': json['embedding'],
76
+ 'index': json['index'],
77
+ };
78
+ }
79
+
80
+ export function EmbeddingToJSON(json: any): Embedding {
81
+ return EmbeddingToJSONTyped(json, false);
82
+ }
83
+
84
+ export function EmbeddingToJSONTyped(value?: Embedding | null, ignoreDiscriminator: boolean = false): any {
85
+ if (value == null) {
86
+ return value;
87
+ }
88
+
89
+ return {
90
+
91
+ 'object': value['object'],
92
+ 'embedding': value['embedding'],
93
+ 'index': value['index'],
94
+ };
95
+ }
96
+
@@ -0,0 +1,117 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * GPU.ai Public Developer API
5
+ * Programmatic API for GPU.ai. Authenticate with API keys minted from the dashboard. See https://gpu.ai/docs for details.
6
+ *
7
+ * The version of the OpenAPI document: 1.0.0
8
+ * Contact: support@gpu.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+
15
+ import { mapValues } from '../runtime';
16
+ import type { EmbeddingsRequestInput } from './EmbeddingsRequestInput';
17
+ import {
18
+ EmbeddingsRequestInputFromJSON,
19
+ EmbeddingsRequestInputFromJSONTyped,
20
+ EmbeddingsRequestInputToJSON,
21
+ EmbeddingsRequestInputToJSONTyped,
22
+ } from './EmbeddingsRequestInput';
23
+
24
+ /**
25
+ *
26
+ * @export
27
+ * @interface EmbeddingsRequest
28
+ */
29
+ export interface EmbeddingsRequest {
30
+ /**
31
+ * Canonical embedding model id, e.g. "gpuai/qwen3-embedding-8b".
32
+ * @type {string}
33
+ * @memberof EmbeddingsRequest
34
+ */
35
+ model: string;
36
+ /**
37
+ *
38
+ * @type {EmbeddingsRequestInput}
39
+ * @memberof EmbeddingsRequest
40
+ */
41
+ input: EmbeddingsRequestInput;
42
+ /**
43
+ * Only "float" is supported. A value of "base64" is rejected with invalid_request_error / unsupported_parameter.
44
+ * @type {EmbeddingsRequestEncodingFormatEnum}
45
+ * @memberof EmbeddingsRequest
46
+ */
47
+ encodingFormat?: EmbeddingsRequestEncodingFormatEnum;
48
+ /**
49
+ * Requested output dimensionality, for models that support truncated (Matryoshka) embeddings. Passed through to the model when set.
50
+ * @type {number}
51
+ * @memberof EmbeddingsRequest
52
+ */
53
+ dimensions?: number;
54
+ /**
55
+ * Opaque end-user identifier for abuse tracing. Optional.
56
+ * @type {string}
57
+ * @memberof EmbeddingsRequest
58
+ */
59
+ user?: string;
60
+ }
61
+
62
+
63
+ /**
64
+ * @export
65
+ */
66
+ export const EmbeddingsRequestEncodingFormatEnum = {
67
+ Float: 'float'
68
+ } as const;
69
+ export type EmbeddingsRequestEncodingFormatEnum = typeof EmbeddingsRequestEncodingFormatEnum[keyof typeof EmbeddingsRequestEncodingFormatEnum];
70
+
71
+
72
+ /**
73
+ * Check if a given object implements the EmbeddingsRequest interface.
74
+ */
75
+ export function instanceOfEmbeddingsRequest(value: object): value is EmbeddingsRequest {
76
+ if (!('model' in value) || value['model'] === undefined) return false;
77
+ if (!('input' in value) || value['input'] === undefined) return false;
78
+ return true;
79
+ }
80
+
81
+ export function EmbeddingsRequestFromJSON(json: any): EmbeddingsRequest {
82
+ return EmbeddingsRequestFromJSONTyped(json, false);
83
+ }
84
+
85
+ export function EmbeddingsRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): EmbeddingsRequest {
86
+ if (json == null) {
87
+ return json;
88
+ }
89
+ return {
90
+
91
+ 'model': json['model'],
92
+ 'input': EmbeddingsRequestInputFromJSON(json['input']),
93
+ 'encodingFormat': json['encoding_format'] == null ? undefined : json['encoding_format'],
94
+ 'dimensions': json['dimensions'] == null ? undefined : json['dimensions'],
95
+ 'user': json['user'] == null ? undefined : json['user'],
96
+ };
97
+ }
98
+
99
+ export function EmbeddingsRequestToJSON(json: any): EmbeddingsRequest {
100
+ return EmbeddingsRequestToJSONTyped(json, false);
101
+ }
102
+
103
+ export function EmbeddingsRequestToJSONTyped(value?: EmbeddingsRequest | null, ignoreDiscriminator: boolean = false): any {
104
+ if (value == null) {
105
+ return value;
106
+ }
107
+
108
+ return {
109
+
110
+ 'model': value['model'],
111
+ 'input': EmbeddingsRequestInputToJSON(value['input']),
112
+ 'encoding_format': value['encodingFormat'],
113
+ 'dimensions': value['dimensions'],
114
+ 'user': value['user'],
115
+ };
116
+ }
117
+