-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathadapters.ts
More file actions
117 lines (102 loc) · 3.11 KB
/
Copy pathadapters.ts
File metadata and controls
117 lines (102 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
import { APIPromise } from '../../core/api-promise';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
export class Adapters extends APIResource {
/**
* Returns all LoRA adapters bound to the specified dedicated endpoint.
*
* @example
* ```ts
* const adapters = await client.endpoints.adapters.list(
* 'endpointId',
* );
* ```
*/
list(endpointID: string, options?: RequestOptions): APIPromise<AdapterListResponse> {
return this._client.get(path`/endpoints/${endpointID}/adapters`, options);
}
/**
* Adds a LoRA adapter model to a dedicated endpoint. After this call, inference
* requests to the adapter model name will be routed to the specified endpoint. The
* endpoint must have LoRA enabled, and the adapter's base model must be compatible
* with the endpoint's model. The endpoint name prefix in model_id must match the
* resolved endpoint.
*
* @example
* ```ts
* const response = await client.endpoints.adapters.add(
* 'endpointId',
* {
* model_id:
* 'username/Meta-Llama-3.1-8B-Instruct-def456:username/my-adapter-abc123',
* },
* );
* ```
*/
add(endpointID: string, body: AdapterAddParams, options?: RequestOptions): APIPromise<AdapterAddResponse> {
return this._client.post(path`/endpoints/${endpointID}/adapters`, { body, ...options });
}
/**
* Removes the routing rule that binds an adapter to an endpoint. The adapter must
* be currently bound to this specific endpoint.
*
* @example
* ```ts
* const adapter = await client.endpoints.adapters.remove(
* 'endpointId',
* { model_id: 'model_id' },
* );
* ```
*/
remove(
endpointID: string,
body: AdapterRemoveParams,
options?: RequestOptions,
): APIPromise<AdapterRemoveResponse> {
return this._client.delete(path`/endpoints/${endpointID}/adapters`, { body, ...options });
}
}
export interface AdapterListResponse {
data?: Array<AdapterListResponse.Data>;
object?: string;
}
export namespace AdapterListResponse {
export interface Data {
adapter_name?: string;
endpoint_name?: string;
/**
* Combined endpoint:adapter identifier
*/
model_id?: string;
}
}
export interface AdapterAddResponse {
model_id?: string;
}
export interface AdapterRemoveResponse {
deleted?: boolean;
model_id?: string;
}
export interface AdapterAddParams {
/**
* Combined identifier in format "endpoint_name:adapter_model_name".
*/
model_id: string;
}
export interface AdapterRemoveParams {
/**
* Combined identifier in format "endpoint_name:adapter_model_name".
*/
model_id: string;
}
export declare namespace Adapters {
export {
type AdapterListResponse as AdapterListResponse,
type AdapterAddResponse as AdapterAddResponse,
type AdapterRemoveResponse as AdapterRemoveResponse,
type AdapterAddParams as AdapterAddParams,
type AdapterRemoveParams as AdapterRemoveParams,
};
}