@layer-ai/sdk 2.1.1 → 2.3.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/dist/client.d.ts +21 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +22 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { LayerConfig, RequestOptions } from './types/index.js';
|
|
2
|
-
import type { LayerRequestInput, LayerResponse } from './types/index.js';
|
|
2
|
+
import type { LayerRequestInput, LayerResponse, ChatRequest, ImageGenerationRequest } from './types/index.js';
|
|
3
3
|
export declare class Layer {
|
|
4
4
|
private apiKey;
|
|
5
5
|
private baseUrl;
|
|
6
6
|
constructor(config: LayerConfig);
|
|
7
7
|
request<T>(options: RequestOptions): Promise<T>;
|
|
8
8
|
complete(request: LayerRequestInput): Promise<LayerResponse>;
|
|
9
|
+
/**
|
|
10
|
+
* v3 Chat completion endpoint - Type-safe chat requests
|
|
11
|
+
* @param request - Chat request with gateId and ChatRequest data
|
|
12
|
+
*/
|
|
13
|
+
chat(request: {
|
|
14
|
+
gateId: string;
|
|
15
|
+
data: ChatRequest;
|
|
16
|
+
model?: string;
|
|
17
|
+
metadata?: Record<string, unknown>;
|
|
18
|
+
}): Promise<LayerResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* v3 Image generation endpoint - Type-safe image requests
|
|
21
|
+
* @param request - Image request with gateId and ImageGenerationRequest data
|
|
22
|
+
*/
|
|
23
|
+
image(request: {
|
|
24
|
+
gateId: string;
|
|
25
|
+
data: ImageGenerationRequest;
|
|
26
|
+
model?: string;
|
|
27
|
+
metadata?: Record<string, unknown>;
|
|
28
|
+
}): Promise<LayerResponse>;
|
|
9
29
|
}
|
|
10
30
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAiB,iBAAiB,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAiB,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAE7H,qBAAa,KAAK;IAChB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,OAAO,CAAS;gBAEZ,MAAM,EAAE,WAAW;IAQlB,OAAO,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,CAAC,CAAC;IA4BtD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;IAQlE;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,WAAW,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,aAAa,CAAC;IAQ1B;;;OAGG;IACG,KAAK,CAAC,OAAO,EAAE;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,sBAAsB,CAAC;QAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACpC,GAAG,OAAO,CAAC,aAAa,CAAC;CAO3B"}
|
package/dist/client.js
CHANGED
|
@@ -35,4 +35,26 @@ export class Layer {
|
|
|
35
35
|
body: request,
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* v3 Chat completion endpoint - Type-safe chat requests
|
|
40
|
+
* @param request - Chat request with gateId and ChatRequest data
|
|
41
|
+
*/
|
|
42
|
+
async chat(request) {
|
|
43
|
+
return this.request({
|
|
44
|
+
method: 'POST',
|
|
45
|
+
path: '/v3/chat',
|
|
46
|
+
body: request,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* v3 Image generation endpoint - Type-safe image requests
|
|
51
|
+
* @param request - Image request with gateId and ImageGenerationRequest data
|
|
52
|
+
*/
|
|
53
|
+
async image(request) {
|
|
54
|
+
return this.request({
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: '/v3/image',
|
|
57
|
+
body: request,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
38
60
|
}
|