@gpuai/sdk 0.4.2 → 0.5.0
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/.openapi-generator/FILES +22 -0
- package/README.md +13 -2
- package/dist/apis/InstancesApi.d.ts +2 -0
- package/dist/apis/InstancesApi.js +2 -0
- package/dist/esm/apis/InstancesApi.d.ts +2 -0
- package/dist/esm/apis/InstancesApi.js +2 -0
- package/dist/esm/models/ChatCompletionRequest.d.ts +27 -0
- package/dist/esm/models/ChatCompletionRequest.js +11 -0
- package/dist/esm/models/ChatCompletionRequestToolChoice.d.ts +22 -0
- package/dist/esm/models/ChatCompletionRequestToolChoice.js +50 -0
- package/dist/esm/models/ChatJSONSchemaFormat.d.ts +52 -0
- package/dist/esm/models/ChatJSONSchemaFormat.js +51 -0
- package/dist/esm/models/ChatMessage.d.ts +21 -1
- package/dist/esm/models/ChatMessage.js +10 -4
- package/dist/esm/models/ChatNamedToolChoice.d.ts +46 -0
- package/dist/esm/models/ChatNamedToolChoice.js +56 -0
- package/dist/esm/models/ChatNamedToolChoiceFunction.d.ts +32 -0
- package/dist/esm/models/ChatNamedToolChoiceFunction.js +43 -0
- package/dist/esm/models/ChatResponseFormat.d.ts +48 -0
- package/dist/esm/models/ChatResponseFormat.js +54 -0
- package/dist/esm/models/ChatTool.d.ts +46 -0
- package/dist/esm/models/ChatTool.js +56 -0
- package/dist/esm/models/ChatToolCall.d.ts +52 -0
- package/dist/esm/models/ChatToolCall.js +60 -0
- package/dist/esm/models/ChatToolCallFunction.d.ts +38 -0
- package/dist/esm/models/ChatToolCallFunction.js +47 -0
- package/dist/esm/models/ChatToolFunction.d.ts +52 -0
- package/dist/esm/models/ChatToolFunction.js +49 -0
- package/dist/esm/models/CreateFunctionVersionRequest.d.ts +6 -0
- package/dist/esm/models/CreateFunctionVersionRequest.js +2 -0
- package/dist/esm/models/CreateInstanceRequest.d.ts +13 -0
- package/dist/esm/models/CreateInstanceRequest.js +5 -0
- package/dist/esm/models/DedicatedIPRequest.d.ts +32 -0
- package/dist/esm/models/DedicatedIPRequest.js +41 -0
- package/dist/esm/models/FunctionVersion.d.ts +6 -0
- package/dist/esm/models/FunctionVersion.js +4 -0
- package/dist/esm/models/Instance.d.ts +7 -0
- package/dist/esm/models/Instance.js +3 -0
- package/dist/esm/models/InstanceDedicatedIP.d.ts +83 -0
- package/dist/esm/models/InstanceDedicatedIP.js +77 -0
- package/dist/esm/models/Model.d.ts +12 -0
- package/dist/esm/models/Model.js +4 -0
- package/dist/esm/models/Problem.d.ts +2 -0
- package/dist/esm/models/Problem.js +2 -0
- package/dist/esm/models/index.d.ts +11 -0
- package/dist/esm/models/index.js +11 -0
- package/dist/esm/runtime.js +1 -1
- package/dist/models/ChatCompletionRequest.d.ts +27 -0
- package/dist/models/ChatCompletionRequest.js +11 -0
- package/dist/models/ChatCompletionRequestToolChoice.d.ts +22 -0
- package/dist/models/ChatCompletionRequestToolChoice.js +56 -0
- package/dist/models/ChatJSONSchemaFormat.d.ts +52 -0
- package/dist/models/ChatJSONSchemaFormat.js +58 -0
- package/dist/models/ChatMessage.d.ts +21 -1
- package/dist/models/ChatMessage.js +10 -4
- package/dist/models/ChatNamedToolChoice.d.ts +46 -0
- package/dist/models/ChatNamedToolChoice.js +64 -0
- package/dist/models/ChatNamedToolChoiceFunction.d.ts +32 -0
- package/dist/models/ChatNamedToolChoiceFunction.js +50 -0
- package/dist/models/ChatResponseFormat.d.ts +48 -0
- package/dist/models/ChatResponseFormat.js +62 -0
- package/dist/models/ChatTool.d.ts +46 -0
- package/dist/models/ChatTool.js +64 -0
- package/dist/models/ChatToolCall.d.ts +52 -0
- package/dist/models/ChatToolCall.js +68 -0
- package/dist/models/ChatToolCallFunction.d.ts +38 -0
- package/dist/models/ChatToolCallFunction.js +54 -0
- package/dist/models/ChatToolFunction.d.ts +52 -0
- package/dist/models/ChatToolFunction.js +56 -0
- package/dist/models/CreateFunctionVersionRequest.d.ts +6 -0
- package/dist/models/CreateFunctionVersionRequest.js +2 -0
- package/dist/models/CreateInstanceRequest.d.ts +13 -0
- package/dist/models/CreateInstanceRequest.js +5 -0
- package/dist/models/DedicatedIPRequest.d.ts +32 -0
- package/dist/models/DedicatedIPRequest.js +48 -0
- package/dist/models/FunctionVersion.d.ts +6 -0
- package/dist/models/FunctionVersion.js +4 -0
- package/dist/models/Instance.d.ts +7 -0
- package/dist/models/Instance.js +3 -0
- package/dist/models/InstanceDedicatedIP.d.ts +83 -0
- package/dist/models/InstanceDedicatedIP.js +85 -0
- package/dist/models/Model.d.ts +12 -0
- package/dist/models/Model.js +4 -0
- package/dist/models/Problem.d.ts +2 -0
- package/dist/models/Problem.js +2 -0
- package/dist/models/index.d.ts +11 -0
- package/dist/models/index.js +11 -0
- package/dist/runtime.js +1 -1
- package/docs/ChatCompletionRequest.md +8 -0
- package/docs/ChatCompletionRequestToolChoice.md +37 -0
- package/docs/ChatJSONSchemaFormat.md +40 -0
- package/docs/ChatMessage.md +6 -0
- package/docs/ChatNamedToolChoice.md +36 -0
- package/docs/ChatNamedToolChoiceFunction.md +34 -0
- package/docs/ChatResponseFormat.md +37 -0
- package/docs/ChatTool.md +36 -0
- package/docs/ChatToolCall.md +38 -0
- package/docs/ChatToolCallFunction.md +36 -0
- package/docs/ChatToolFunction.md +40 -0
- package/docs/CreateFunctionVersionRequest.md +2 -0
- package/docs/CreateInstanceRequest.md +4 -0
- package/docs/DedicatedIPRequest.md +35 -0
- package/docs/FunctionVersion.md +2 -0
- package/docs/Instance.md +2 -0
- package/docs/InstanceDedicatedIP.md +49 -0
- package/docs/InstancesApi.md +3 -1
- package/docs/Model.md +4 -0
- package/package.json +1 -1
- package/src/apis/InstancesApi.ts +2 -0
- package/src/models/ChatCompletionRequest.ts +53 -0
- package/src/models/ChatCompletionRequestToolChoice.ts +69 -0
- package/src/models/ChatJSONSchemaFormat.ts +91 -0
- package/src/models/ChatMessage.ts +36 -4
- package/src/models/ChatNamedToolChoice.ts +95 -0
- package/src/models/ChatNamedToolChoiceFunction.ts +66 -0
- package/src/models/ChatResponseFormat.ts +94 -0
- package/src/models/ChatTool.ts +95 -0
- package/src/models/ChatToolCall.ts +104 -0
- package/src/models/ChatToolCallFunction.ts +75 -0
- package/src/models/ChatToolFunction.ts +90 -0
- package/src/models/CreateFunctionVersionRequest.ts +8 -0
- package/src/models/CreateInstanceRequest.ts +23 -0
- package/src/models/DedicatedIPRequest.ts +65 -0
- package/src/models/FunctionVersion.ts +9 -0
- package/src/models/Instance.ts +15 -0
- package/src/models/InstanceDedicatedIP.ts +140 -0
- package/src/models/Model.ts +16 -0
- package/src/models/Problem.ts +2 -0
- package/src/models/index.ts +11 -0
- package/src/runtime.ts +1 -1
package/docs/FunctionVersion.md
CHANGED
|
@@ -22,6 +22,7 @@ Name | Type
|
|
|
22
22
|
`timeout` | number
|
|
23
23
|
`idleTimeout` | number
|
|
24
24
|
`maxConcurrency` | number
|
|
25
|
+
`secrets` | Array<string>
|
|
25
26
|
`createdAt` | Date
|
|
26
27
|
|
|
27
28
|
## Example
|
|
@@ -47,6 +48,7 @@ const example = {
|
|
|
47
48
|
"timeout": null,
|
|
48
49
|
"idleTimeout": null,
|
|
49
50
|
"maxConcurrency": null,
|
|
51
|
+
"secrets": null,
|
|
50
52
|
"createdAt": null,
|
|
51
53
|
} satisfies FunctionVersion
|
|
52
54
|
|
package/docs/Instance.md
CHANGED
|
@@ -27,6 +27,7 @@ Name | Type
|
|
|
27
27
|
`lastReachableAt` | Date
|
|
28
28
|
`unreachableSince` | Date
|
|
29
29
|
`bootPhase` | string
|
|
30
|
+
`dedicatedIp` | [InstanceDedicatedIP](InstanceDedicatedIP.md)
|
|
30
31
|
|
|
31
32
|
## Example
|
|
32
33
|
|
|
@@ -56,6 +57,7 @@ const example = {
|
|
|
56
57
|
"lastReachableAt": null,
|
|
57
58
|
"unreachableSince": null,
|
|
58
59
|
"bootPhase": null,
|
|
60
|
+
"dedicatedIp": null,
|
|
59
61
|
} satisfies Instance
|
|
60
62
|
|
|
61
63
|
console.log(example)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
|
|
2
|
+
# InstanceDedicatedIP
|
|
3
|
+
|
|
4
|
+
The instance\'s dedicated public IPv4 add-on. Present only on instances launched with `dedicated_ip`, and only on deployments where the add-on is enabled.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`address` | string
|
|
11
|
+
`ports` | Array<number>
|
|
12
|
+
`status` | string
|
|
13
|
+
`suspendReason` | string
|
|
14
|
+
`hourlyFee` | number
|
|
15
|
+
`transferPricePerGb` | number
|
|
16
|
+
`transferGb` | number
|
|
17
|
+
`chargedUsd` | number
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import type { InstanceDedicatedIP } from '@gpuai/sdk'
|
|
23
|
+
|
|
24
|
+
// TODO: Update the object below with actual values
|
|
25
|
+
const example = {
|
|
26
|
+
"address": 203.0.113.7,
|
|
27
|
+
"ports": [80, 443],
|
|
28
|
+
"status": null,
|
|
29
|
+
"suspendReason": null,
|
|
30
|
+
"hourlyFee": null,
|
|
31
|
+
"transferPricePerGb": null,
|
|
32
|
+
"transferGb": null,
|
|
33
|
+
"chargedUsd": null,
|
|
34
|
+
} satisfies InstanceDedicatedIP
|
|
35
|
+
|
|
36
|
+
console.log(example)
|
|
37
|
+
|
|
38
|
+
// Convert the instance to a JSON string
|
|
39
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
40
|
+
console.log(exampleJSON)
|
|
41
|
+
|
|
42
|
+
// Parse the JSON string back to an object
|
|
43
|
+
const exampleParsed = JSON.parse(exampleJSON) as InstanceDedicatedIP
|
|
44
|
+
console.log(exampleParsed)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
48
|
+
|
|
49
|
+
|
package/docs/InstancesApi.md
CHANGED
|
@@ -19,6 +19,8 @@ All URIs are relative to *https://api.gpu.ai/v1*
|
|
|
19
19
|
|
|
20
20
|
Create an instance (async — returns 202 + Operation-Id header)
|
|
21
21
|
|
|
22
|
+
Running a one-off script or batch work? Submit it as a job instead (POST /jobs): the machine is started for it and shut down a few minutes after it finishes, so nothing bills after the work is done.
|
|
23
|
+
|
|
22
24
|
### Example
|
|
23
25
|
|
|
24
26
|
```ts
|
|
@@ -80,7 +82,7 @@ example().catch(console.error);
|
|
|
80
82
|
### HTTP response details
|
|
81
83
|
| Status code | Description | Response headers |
|
|
82
84
|
|-------------|-------------|------------------|
|
|
83
|
-
| **202** | Accepted; long-running operation | * Operation-Id - Use GET /operations/{id} to poll <br> |
|
|
85
|
+
| **202** | Accepted; long-running operation | * Operation-Id - Use GET /operations/{id} to poll <br> * GPUAI-Hint - Advisory only, and absent on most launches. Sent when the request is a one-off batch run (a custom image with a command and auto_terminate_hours) to point at Jobs (POST /jobs), which start a machine for the work and shut it down a few minutes after it ends. It never changes the launch. <br> |
|
|
84
86
|
| **429** | Rate limit exceeded (RFC 7807). Retry-After header indicates seconds to wait. | * Retry-After - Seconds the client should wait before retrying. <br> |
|
|
85
87
|
| **0** | Error response (RFC 7807) | - |
|
|
86
88
|
|
package/docs/Model.md
CHANGED
|
@@ -15,6 +15,8 @@ Name | Type
|
|
|
15
15
|
`category` | string
|
|
16
16
|
`contextLength` | number
|
|
17
17
|
`supportedParameters` | Array<string>
|
|
18
|
+
`supportsTools` | boolean
|
|
19
|
+
`supportsStructuredOutputs` | boolean
|
|
18
20
|
`parameters` | [Array<ModelParametersInner>](ModelParametersInner.md)
|
|
19
21
|
`pricing` | [ModelPricing](ModelPricing.md)
|
|
20
22
|
`aliases` | Array<string>
|
|
@@ -38,6 +40,8 @@ const example = {
|
|
|
38
40
|
"category": null,
|
|
39
41
|
"contextLength": null,
|
|
40
42
|
"supportedParameters": null,
|
|
43
|
+
"supportsTools": null,
|
|
44
|
+
"supportsStructuredOutputs": null,
|
|
41
45
|
"parameters": null,
|
|
42
46
|
"pricing": null,
|
|
43
47
|
"aliases": null,
|
package/package.json
CHANGED
package/src/apis/InstancesApi.ts
CHANGED
|
@@ -127,6 +127,7 @@ export class InstancesApi extends runtime.BaseAPI {
|
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
+
* Running a one-off script or batch work? Submit it as a job instead (POST /jobs): the machine is started for it and shut down a few minutes after it finishes, so nothing bills after the work is done.
|
|
130
131
|
* Create an instance (async — returns 202 + Operation-Id header)
|
|
131
132
|
*/
|
|
132
133
|
async createInstanceRaw(requestParameters: CreateInstanceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Operation>> {
|
|
@@ -137,6 +138,7 @@ export class InstancesApi extends runtime.BaseAPI {
|
|
|
137
138
|
}
|
|
138
139
|
|
|
139
140
|
/**
|
|
141
|
+
* Running a one-off script or batch work? Submit it as a job instead (POST /jobs): the machine is started for it and shut down a few minutes after it finishes, so nothing bills after the work is done.
|
|
140
142
|
* Create an instance (async — returns 202 + Operation-Id header)
|
|
141
143
|
*/
|
|
142
144
|
async createInstance(requestParameters: CreateInstanceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Operation> {
|
|
@@ -13,6 +13,13 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
+
import type { ChatCompletionRequestToolChoice } from './ChatCompletionRequestToolChoice';
|
|
17
|
+
import {
|
|
18
|
+
ChatCompletionRequestToolChoiceFromJSON,
|
|
19
|
+
ChatCompletionRequestToolChoiceFromJSONTyped,
|
|
20
|
+
ChatCompletionRequestToolChoiceToJSON,
|
|
21
|
+
ChatCompletionRequestToolChoiceToJSONTyped,
|
|
22
|
+
} from './ChatCompletionRequestToolChoice';
|
|
16
23
|
import type { ChatMessage } from './ChatMessage';
|
|
17
24
|
import {
|
|
18
25
|
ChatMessageFromJSON,
|
|
@@ -27,6 +34,20 @@ import {
|
|
|
27
34
|
StreamOptionsToJSON,
|
|
28
35
|
StreamOptionsToJSONTyped,
|
|
29
36
|
} from './StreamOptions';
|
|
37
|
+
import type { ChatTool } from './ChatTool';
|
|
38
|
+
import {
|
|
39
|
+
ChatToolFromJSON,
|
|
40
|
+
ChatToolFromJSONTyped,
|
|
41
|
+
ChatToolToJSON,
|
|
42
|
+
ChatToolToJSONTyped,
|
|
43
|
+
} from './ChatTool';
|
|
44
|
+
import type { ChatResponseFormat } from './ChatResponseFormat';
|
|
45
|
+
import {
|
|
46
|
+
ChatResponseFormatFromJSON,
|
|
47
|
+
ChatResponseFormatFromJSONTyped,
|
|
48
|
+
ChatResponseFormatToJSON,
|
|
49
|
+
ChatResponseFormatToJSONTyped,
|
|
50
|
+
} from './ChatResponseFormat';
|
|
30
51
|
|
|
31
52
|
/**
|
|
32
53
|
*
|
|
@@ -70,6 +91,30 @@ export interface ChatCompletionRequest {
|
|
|
70
91
|
* @memberof ChatCompletionRequest
|
|
71
92
|
*/
|
|
72
93
|
streamOptions?: StreamOptions;
|
|
94
|
+
/**
|
|
95
|
+
* Functions the model may call (OpenAI shape). Only models whose /v1/models entry has supports_tools: true accept it; any other model returns 400 unsupported_parameter (param "tools").
|
|
96
|
+
* @type {Array<ChatTool>}
|
|
97
|
+
* @memberof ChatCompletionRequest
|
|
98
|
+
*/
|
|
99
|
+
tools?: Array<ChatTool>;
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @type {ChatCompletionRequestToolChoice}
|
|
103
|
+
* @memberof ChatCompletionRequest
|
|
104
|
+
*/
|
|
105
|
+
toolChoice?: ChatCompletionRequestToolChoice;
|
|
106
|
+
/**
|
|
107
|
+
* Whether the model may call several tools in one turn. Passed through.
|
|
108
|
+
* @type {boolean}
|
|
109
|
+
* @memberof ChatCompletionRequest
|
|
110
|
+
*/
|
|
111
|
+
parallelToolCalls?: boolean;
|
|
112
|
+
/**
|
|
113
|
+
*
|
|
114
|
+
* @type {ChatResponseFormat}
|
|
115
|
+
* @memberof ChatCompletionRequest
|
|
116
|
+
*/
|
|
117
|
+
responseFormat?: ChatResponseFormat;
|
|
73
118
|
}
|
|
74
119
|
|
|
75
120
|
/**
|
|
@@ -97,6 +142,10 @@ export function ChatCompletionRequestFromJSONTyped(json: any, ignoreDiscriminato
|
|
|
97
142
|
'maxTokens': json['max_tokens'] == null ? undefined : json['max_tokens'],
|
|
98
143
|
'stream': json['stream'] == null ? undefined : json['stream'],
|
|
99
144
|
'streamOptions': json['stream_options'] == null ? undefined : StreamOptionsFromJSON(json['stream_options']),
|
|
145
|
+
'tools': json['tools'] == null ? undefined : ((json['tools'] as Array<any>).map(ChatToolFromJSON)),
|
|
146
|
+
'toolChoice': json['tool_choice'] == null ? undefined : ChatCompletionRequestToolChoiceFromJSON(json['tool_choice']),
|
|
147
|
+
'parallelToolCalls': json['parallel_tool_calls'] == null ? undefined : json['parallel_tool_calls'],
|
|
148
|
+
'responseFormat': json['response_format'] == null ? undefined : ChatResponseFormatFromJSON(json['response_format']),
|
|
100
149
|
};
|
|
101
150
|
}
|
|
102
151
|
|
|
@@ -117,6 +166,10 @@ export function ChatCompletionRequestToJSONTyped(value?: ChatCompletionRequest |
|
|
|
117
166
|
'max_tokens': value['maxTokens'],
|
|
118
167
|
'stream': value['stream'],
|
|
119
168
|
'stream_options': StreamOptionsToJSON(value['streamOptions']),
|
|
169
|
+
'tools': value['tools'] == null ? undefined : ((value['tools'] as Array<any>).map(ChatToolToJSON)),
|
|
170
|
+
'tool_choice': ChatCompletionRequestToolChoiceToJSON(value['toolChoice']),
|
|
171
|
+
'parallel_tool_calls': value['parallelToolCalls'],
|
|
172
|
+
'response_format': ChatResponseFormatToJSON(value['responseFormat']),
|
|
120
173
|
};
|
|
121
174
|
}
|
|
122
175
|
|
|
@@ -0,0 +1,69 @@
|
|
|
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 type { ChatNamedToolChoice } from './ChatNamedToolChoice';
|
|
16
|
+
import {
|
|
17
|
+
instanceOfChatNamedToolChoice,
|
|
18
|
+
ChatNamedToolChoiceFromJSON,
|
|
19
|
+
ChatNamedToolChoiceFromJSONTyped,
|
|
20
|
+
ChatNamedToolChoiceToJSON,
|
|
21
|
+
} from './ChatNamedToolChoice';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @type ChatCompletionRequestToolChoice
|
|
25
|
+
* "auto" (default), "none", "required", or a named function ({"type":"function","function":{"name":"..."}}) that must be defined in tools.
|
|
26
|
+
* @export
|
|
27
|
+
*/
|
|
28
|
+
export type ChatCompletionRequestToolChoice = ChatNamedToolChoice | string;
|
|
29
|
+
|
|
30
|
+
export function ChatCompletionRequestToolChoiceFromJSON(json: any): ChatCompletionRequestToolChoice {
|
|
31
|
+
return ChatCompletionRequestToolChoiceFromJSONTyped(json, false);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function ChatCompletionRequestToolChoiceFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChatCompletionRequestToolChoice {
|
|
35
|
+
if (json == null) {
|
|
36
|
+
return json;
|
|
37
|
+
}
|
|
38
|
+
if (typeof json !== 'object') {
|
|
39
|
+
return json;
|
|
40
|
+
}
|
|
41
|
+
if (instanceOfChatNamedToolChoice(json)) {
|
|
42
|
+
return ChatNamedToolChoiceFromJSONTyped(json, true);
|
|
43
|
+
}
|
|
44
|
+
if (typeof json === 'string' && (json === 'none' || json === 'auto' || json === 'required')) {
|
|
45
|
+
return json;
|
|
46
|
+
}
|
|
47
|
+
return {} as any;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function ChatCompletionRequestToolChoiceToJSON(json: any): any {
|
|
51
|
+
return ChatCompletionRequestToolChoiceToJSONTyped(json, false);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function ChatCompletionRequestToolChoiceToJSONTyped(value?: ChatCompletionRequestToolChoice | null, ignoreDiscriminator: boolean = false): any {
|
|
55
|
+
if (value == null) {
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
if (typeof value !== 'object') {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
if (instanceOfChatNamedToolChoice(value)) {
|
|
62
|
+
return ChatNamedToolChoiceToJSON(value as ChatNamedToolChoice);
|
|
63
|
+
}
|
|
64
|
+
if (typeof value === 'string' && (value === 'none' || value === 'auto' || value === 'required')) {
|
|
65
|
+
return value;
|
|
66
|
+
}
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
|
|
@@ -0,0 +1,91 @@
|
|
|
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 ChatJSONSchemaFormat
|
|
20
|
+
*/
|
|
21
|
+
export interface ChatJSONSchemaFormat {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof ChatJSONSchemaFormat
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @type {string}
|
|
31
|
+
* @memberof ChatJSONSchemaFormat
|
|
32
|
+
*/
|
|
33
|
+
description?: string;
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @type {{ [key: string]: any; }}
|
|
37
|
+
* @memberof ChatJSONSchemaFormat
|
|
38
|
+
*/
|
|
39
|
+
schema: { [key: string]: any; };
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @type {boolean}
|
|
43
|
+
* @memberof ChatJSONSchemaFormat
|
|
44
|
+
*/
|
|
45
|
+
strict?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Check if a given object implements the ChatJSONSchemaFormat interface.
|
|
50
|
+
*/
|
|
51
|
+
export function instanceOfChatJSONSchemaFormat(value: object): value is ChatJSONSchemaFormat {
|
|
52
|
+
if (!('name' in value) || value['name'] === undefined) return false;
|
|
53
|
+
if (!('schema' in value) || value['schema'] === undefined) return false;
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function ChatJSONSchemaFormatFromJSON(json: any): ChatJSONSchemaFormat {
|
|
58
|
+
return ChatJSONSchemaFormatFromJSONTyped(json, false);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function ChatJSONSchemaFormatFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChatJSONSchemaFormat {
|
|
62
|
+
if (json == null) {
|
|
63
|
+
return json;
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
|
|
67
|
+
'name': json['name'],
|
|
68
|
+
'description': json['description'] == null ? undefined : json['description'],
|
|
69
|
+
'schema': json['schema'],
|
|
70
|
+
'strict': json['strict'] == null ? undefined : json['strict'],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function ChatJSONSchemaFormatToJSON(json: any): ChatJSONSchemaFormat {
|
|
75
|
+
return ChatJSONSchemaFormatToJSONTyped(json, false);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function ChatJSONSchemaFormatToJSONTyped(value?: ChatJSONSchemaFormat | null, ignoreDiscriminator: boolean = false): any {
|
|
79
|
+
if (value == null) {
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return {
|
|
84
|
+
|
|
85
|
+
'name': value['name'],
|
|
86
|
+
'description': value['description'],
|
|
87
|
+
'schema': value['schema'],
|
|
88
|
+
'strict': value['strict'],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
@@ -13,6 +13,14 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { mapValues } from '../runtime';
|
|
16
|
+
import type { ChatToolCall } from './ChatToolCall';
|
|
17
|
+
import {
|
|
18
|
+
ChatToolCallFromJSON,
|
|
19
|
+
ChatToolCallFromJSONTyped,
|
|
20
|
+
ChatToolCallToJSON,
|
|
21
|
+
ChatToolCallToJSONTyped,
|
|
22
|
+
} from './ChatToolCall';
|
|
23
|
+
|
|
16
24
|
/**
|
|
17
25
|
*
|
|
18
26
|
* @export
|
|
@@ -25,12 +33,30 @@ export interface ChatMessage {
|
|
|
25
33
|
* @memberof ChatMessage
|
|
26
34
|
*/
|
|
27
35
|
role: ChatMessageRoleEnum;
|
|
36
|
+
/**
|
|
37
|
+
* Message text. null on an assistant message that only calls tools. Requests may also send an array of content parts, passed through unchanged.
|
|
38
|
+
* @type {string}
|
|
39
|
+
* @memberof ChatMessage
|
|
40
|
+
*/
|
|
41
|
+
content?: string | null;
|
|
28
42
|
/**
|
|
29
43
|
*
|
|
30
44
|
* @type {string}
|
|
31
45
|
* @memberof ChatMessage
|
|
32
46
|
*/
|
|
33
|
-
|
|
47
|
+
name?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Tool calls made by the assistant (assistant messages only).
|
|
50
|
+
* @type {Array<ChatToolCall>}
|
|
51
|
+
* @memberof ChatMessage
|
|
52
|
+
*/
|
|
53
|
+
toolCalls?: Array<ChatToolCall>;
|
|
54
|
+
/**
|
|
55
|
+
* The tool call this message answers (required on role "tool").
|
|
56
|
+
* @type {string}
|
|
57
|
+
* @memberof ChatMessage
|
|
58
|
+
*/
|
|
59
|
+
toolCallId?: string;
|
|
34
60
|
}
|
|
35
61
|
|
|
36
62
|
|
|
@@ -40,7 +66,8 @@ export interface ChatMessage {
|
|
|
40
66
|
export const ChatMessageRoleEnum = {
|
|
41
67
|
System: 'system',
|
|
42
68
|
User: 'user',
|
|
43
|
-
Assistant: 'assistant'
|
|
69
|
+
Assistant: 'assistant',
|
|
70
|
+
Tool: 'tool'
|
|
44
71
|
} as const;
|
|
45
72
|
export type ChatMessageRoleEnum = typeof ChatMessageRoleEnum[keyof typeof ChatMessageRoleEnum];
|
|
46
73
|
|
|
@@ -50,7 +77,6 @@ export type ChatMessageRoleEnum = typeof ChatMessageRoleEnum[keyof typeof ChatMe
|
|
|
50
77
|
*/
|
|
51
78
|
export function instanceOfChatMessage(value: object): value is ChatMessage {
|
|
52
79
|
if (!('role' in value) || value['role'] === undefined) return false;
|
|
53
|
-
if (!('content' in value) || value['content'] === undefined) return false;
|
|
54
80
|
return true;
|
|
55
81
|
}
|
|
56
82
|
|
|
@@ -65,7 +91,10 @@ export function ChatMessageFromJSONTyped(json: any, ignoreDiscriminator: boolean
|
|
|
65
91
|
return {
|
|
66
92
|
|
|
67
93
|
'role': json['role'],
|
|
68
|
-
'content': json['content'],
|
|
94
|
+
'content': json['content'] === undefined ? undefined : json['content'] === null ? null : json['content'],
|
|
95
|
+
'name': json['name'] == null ? undefined : json['name'],
|
|
96
|
+
'toolCalls': json['tool_calls'] == null ? undefined : ((json['tool_calls'] as Array<any>).map(ChatToolCallFromJSON)),
|
|
97
|
+
'toolCallId': json['tool_call_id'] == null ? undefined : json['tool_call_id'],
|
|
69
98
|
};
|
|
70
99
|
}
|
|
71
100
|
|
|
@@ -82,6 +111,9 @@ export function ChatMessageToJSONTyped(value?: ChatMessage | null, ignoreDiscrim
|
|
|
82
111
|
|
|
83
112
|
'role': value['role'],
|
|
84
113
|
'content': value['content'],
|
|
114
|
+
'name': value['name'],
|
|
115
|
+
'tool_calls': value['toolCalls'] == null ? undefined : ((value['toolCalls'] as Array<any>).map(ChatToolCallToJSON)),
|
|
116
|
+
'tool_call_id': value['toolCallId'],
|
|
85
117
|
};
|
|
86
118
|
}
|
|
87
119
|
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { ChatNamedToolChoiceFunction } from './ChatNamedToolChoiceFunction';
|
|
17
|
+
import {
|
|
18
|
+
ChatNamedToolChoiceFunctionFromJSON,
|
|
19
|
+
ChatNamedToolChoiceFunctionFromJSONTyped,
|
|
20
|
+
ChatNamedToolChoiceFunctionToJSON,
|
|
21
|
+
ChatNamedToolChoiceFunctionToJSONTyped,
|
|
22
|
+
} from './ChatNamedToolChoiceFunction';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @export
|
|
27
|
+
* @interface ChatNamedToolChoice
|
|
28
|
+
*/
|
|
29
|
+
export interface ChatNamedToolChoice {
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @type {ChatNamedToolChoiceTypeEnum}
|
|
33
|
+
* @memberof ChatNamedToolChoice
|
|
34
|
+
*/
|
|
35
|
+
type: ChatNamedToolChoiceTypeEnum;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @type {ChatNamedToolChoiceFunction}
|
|
39
|
+
* @memberof ChatNamedToolChoice
|
|
40
|
+
*/
|
|
41
|
+
_function: ChatNamedToolChoiceFunction;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @export
|
|
47
|
+
*/
|
|
48
|
+
export const ChatNamedToolChoiceTypeEnum = {
|
|
49
|
+
Function: 'function'
|
|
50
|
+
} as const;
|
|
51
|
+
export type ChatNamedToolChoiceTypeEnum = typeof ChatNamedToolChoiceTypeEnum[keyof typeof ChatNamedToolChoiceTypeEnum];
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Check if a given object implements the ChatNamedToolChoice interface.
|
|
56
|
+
*/
|
|
57
|
+
export function instanceOfChatNamedToolChoice(value: object): value is ChatNamedToolChoice {
|
|
58
|
+
if (!('type' in value) || value['type'] === undefined) return false;
|
|
59
|
+
if (value['type'] !== 'function') return false;
|
|
60
|
+
|
|
61
|
+
if ((!('_function' in (value as Record<string, any>)) && !('function' in (value as Record<string, any>))) || ((value as Record<string, any>)['_function'] === undefined && (value as Record<string, any>)['function'] === undefined)) return false;
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function ChatNamedToolChoiceFromJSON(json: any): ChatNamedToolChoice {
|
|
66
|
+
return ChatNamedToolChoiceFromJSONTyped(json, false);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function ChatNamedToolChoiceFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChatNamedToolChoice {
|
|
70
|
+
if (json == null) {
|
|
71
|
+
return json;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
|
|
75
|
+
'type': json['type'],
|
|
76
|
+
'_function': ChatNamedToolChoiceFunctionFromJSON(json['function']),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function ChatNamedToolChoiceToJSON(json: any): ChatNamedToolChoice {
|
|
81
|
+
return ChatNamedToolChoiceToJSONTyped(json, false);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function ChatNamedToolChoiceToJSONTyped(value?: ChatNamedToolChoice | null, ignoreDiscriminator: boolean = false): any {
|
|
85
|
+
if (value == null) {
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
|
|
91
|
+
'type': value['type'],
|
|
92
|
+
'function': ChatNamedToolChoiceFunctionToJSON(value['_function']),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
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 ChatNamedToolChoiceFunction
|
|
20
|
+
*/
|
|
21
|
+
export interface ChatNamedToolChoiceFunction {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @type {string}
|
|
25
|
+
* @memberof ChatNamedToolChoiceFunction
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Check if a given object implements the ChatNamedToolChoiceFunction interface.
|
|
32
|
+
*/
|
|
33
|
+
export function instanceOfChatNamedToolChoiceFunction(value: object): value is ChatNamedToolChoiceFunction {
|
|
34
|
+
if (!('name' in value) || value['name'] === undefined) return false;
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function ChatNamedToolChoiceFunctionFromJSON(json: any): ChatNamedToolChoiceFunction {
|
|
39
|
+
return ChatNamedToolChoiceFunctionFromJSONTyped(json, false);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function ChatNamedToolChoiceFunctionFromJSONTyped(json: any, ignoreDiscriminator: boolean): ChatNamedToolChoiceFunction {
|
|
43
|
+
if (json == null) {
|
|
44
|
+
return json;
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
|
|
48
|
+
'name': json['name'],
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function ChatNamedToolChoiceFunctionToJSON(json: any): ChatNamedToolChoiceFunction {
|
|
53
|
+
return ChatNamedToolChoiceFunctionToJSONTyped(json, false);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function ChatNamedToolChoiceFunctionToJSONTyped(value?: ChatNamedToolChoiceFunction | null, ignoreDiscriminator: boolean = false): any {
|
|
57
|
+
if (value == null) {
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
|
|
63
|
+
'name': value['name'],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|