@ampt/ai 1.0.2 → 1.0.3
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/index.cjs +22268 -21995
- package/dist/index.d.ts +30 -17
- package/dist/index.js +8882 -8611
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,28 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
type ModelId = 'anthropic.claude-v2' | 'anthropic.claude-instant-v1' | 'anthropic.claude-v1' | 'stability.stable-diffusion-xl-v0';
|
|
2
|
+
declare function models(): Promise<ModelId[]>;
|
|
3
|
+
declare enum ModelType {
|
|
4
|
+
Language = "language",
|
|
5
|
+
Image = "image"
|
|
6
|
+
}
|
|
7
|
+
type LanguageInferenceCostFunction = (inputSize: number, outputSize: number) => number;
|
|
8
|
+
type ImageInferenceCostFunction = (width: number, height: number, steps: number) => number;
|
|
9
|
+
type InferenceCostFunction = LanguageInferenceCostFunction | ImageInferenceCostFunction;
|
|
10
|
+
interface ModelInfo {
|
|
11
|
+
name: string;
|
|
12
|
+
type: ModelType;
|
|
13
|
+
streaming: boolean;
|
|
14
|
+
provider: string;
|
|
15
|
+
description: string;
|
|
16
|
+
version: string;
|
|
17
|
+
inferenceUsage: InferenceCostFunction;
|
|
18
|
+
}
|
|
19
|
+
interface LanguageModelInfo extends ModelInfo {
|
|
20
|
+
type: ModelType.Language;
|
|
21
|
+
inferenceUsage: LanguageInferenceCostFunction;
|
|
22
|
+
}
|
|
23
|
+
interface ImageModelInfo extends ModelInfo {
|
|
24
|
+
type: ModelType.Image;
|
|
25
|
+
inferenceUsage: ImageInferenceCostFunction;
|
|
26
|
+
}
|
|
27
|
+
declare function getModelInfo(id: ModelId): Promise<LanguageModelInfo | ImageModelInfo>;
|
|
2
28
|
|
|
3
29
|
interface InvokeOptions {
|
|
30
|
+
modelId: ModelId;
|
|
4
31
|
body: any;
|
|
5
32
|
contentType?: string;
|
|
6
33
|
accept?: string;
|
|
7
|
-
streaming?: boolean;
|
|
8
|
-
modelId: string;
|
|
9
|
-
}
|
|
10
|
-
interface InvokeStreamingDisabledOptions extends InvokeOptions {
|
|
11
|
-
streaming: false;
|
|
12
|
-
}
|
|
13
|
-
interface InvokeStreamingEnabledOptions extends InvokeOptions {
|
|
14
|
-
streaming?: true;
|
|
15
34
|
}
|
|
16
35
|
/**
|
|
17
36
|
* Invoke model and return events as a ReadableStream.
|
|
18
37
|
* @param options
|
|
19
38
|
* @returns
|
|
20
39
|
*/
|
|
21
|
-
declare function invoke(options:
|
|
22
|
-
declare function invoke(options: InvokeStreamingEnabledOptions): Promise<ReadableStream<Uint8Array>>;
|
|
23
|
-
|
|
24
|
-
type ModelId = 'anthropic.claude-v2' | 'anthropic.claude-instant-v1' | 'anthropic.claude-v1' | 'stability.stable-diffusion-xl-v0';
|
|
25
|
-
declare function models(): Promise<ModelId[]>;
|
|
40
|
+
declare function invoke(options: InvokeOptions): Promise<ReadableStream<any> | undefined>;
|
|
26
41
|
|
|
27
42
|
type MessageRole = 'assistant' | 'human';
|
|
28
43
|
/**
|
|
@@ -53,8 +68,6 @@ declare namespace chat {
|
|
|
53
68
|
var models: () => Promise<ModelId[]>;
|
|
54
69
|
}
|
|
55
70
|
|
|
56
|
-
declare const bedrock: BedrockRuntime;
|
|
57
|
-
|
|
58
71
|
interface RenderOptions {
|
|
59
72
|
width?: number;
|
|
60
73
|
height?: number;
|
|
@@ -68,4 +81,4 @@ declare namespace render {
|
|
|
68
81
|
var models: () => Promise<string[]>;
|
|
69
82
|
}
|
|
70
83
|
|
|
71
|
-
export { ChatMessage, ChatOptions,
|
|
84
|
+
export { ChatMessage, ChatOptions, ImageModelInfo, InvokeOptions, LanguageModelInfo, MessageRole, ModelId, ModelInfo, ModelType, RenderOptions, buildPrompt, chat, getModelInfo, invoke, models, render };
|