@ampt/ai 1.0.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.
@@ -0,0 +1,41 @@
1
+ interface InvokeModelOptions {
2
+ prompt: string;
3
+ maxTokens?: number;
4
+ modelId?: string;
5
+ }
6
+ type ModelId = 'anthropic.claude-v2' | 'anthropic.claude-instant-v1' | 'anthropic.claude-v1';
7
+ /**
8
+ * Invoke model and return events as a ReadableStream.
9
+ * @param options
10
+ * @returns
11
+ */
12
+ declare function invokeModel(options: InvokeModelOptions): Promise<ReadableStream<any>>;
13
+ type MessageRole = 'assistant' | 'human';
14
+ /**
15
+ * A message to send to the model
16
+ * @param role The role of the message (assistant or human)
17
+ * @param content The content of the message
18
+ */
19
+ declare class ChatMessage {
20
+ role: MessageRole;
21
+ content: string;
22
+ constructor({ content, role }: {
23
+ role: MessageRole;
24
+ content: string;
25
+ });
26
+ }
27
+ declare function buildPrompt(messages: ChatMessage[]): string;
28
+ interface ChatOptions {
29
+ modelId?: ModelId;
30
+ }
31
+ /**
32
+ * Send messages to the model and return the completion
33
+ * @param messages Array of messages to send to the model
34
+ * @returns Chat completion as a ReadableStream
35
+ */
36
+ declare function chat(messages: ChatMessage[], options?: ChatOptions): Promise<ReadableStream<any>>;
37
+ declare namespace chat {
38
+ var models: ModelId[];
39
+ }
40
+
41
+ export { ChatOptions, InvokeModelOptions, ModelId, buildPrompt, chat, invokeModel };