190proof 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.
- package/dist/index.d.mts +111 -0
- package/dist/index.d.ts +111 -0
- package/dist/index.js +32044 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +32035 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +24 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
declare enum ClaudeModel {
|
|
2
|
+
HAIKU = "claude-3-haiku-20240307",
|
|
3
|
+
SONNET = "claude-3-sonnet-20240229",
|
|
4
|
+
OPUS = "claude-3-opus-20240229"
|
|
5
|
+
}
|
|
6
|
+
declare enum GPTModel {
|
|
7
|
+
GPT35_0613 = "gpt-3.5-turbo-0613",
|
|
8
|
+
GPT35_0613_16K = "gpt-3.5-turbo-16k-0613",
|
|
9
|
+
GPT35_0125 = "gpt-3.5-turbo-0125",
|
|
10
|
+
GPT4_1106_PREVIEW = "gpt-4-1106-preview",
|
|
11
|
+
GPT4_0125_PREVIEW = "gpt-4-0125-preview"
|
|
12
|
+
}
|
|
13
|
+
declare enum GroqModel {
|
|
14
|
+
LLAMA_3_70B_8192 = "llama3-70b-8192"
|
|
15
|
+
}
|
|
16
|
+
declare enum Role {
|
|
17
|
+
User = "user",
|
|
18
|
+
Assistant = "assistant",
|
|
19
|
+
System = "system"
|
|
20
|
+
}
|
|
21
|
+
interface GenericMessage {
|
|
22
|
+
role: Role;
|
|
23
|
+
content: string;
|
|
24
|
+
timestamp?: string;
|
|
25
|
+
files?: File[];
|
|
26
|
+
functionCalls?: FunctionCall[];
|
|
27
|
+
}
|
|
28
|
+
interface File {
|
|
29
|
+
name: string;
|
|
30
|
+
mimetype: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
data?: string;
|
|
33
|
+
}
|
|
34
|
+
interface OpenAIMessage {
|
|
35
|
+
role: "user" | "assistant" | "system";
|
|
36
|
+
content: string;
|
|
37
|
+
}
|
|
38
|
+
interface AnthropicAIMessage {
|
|
39
|
+
role: "user" | "assistant" | "system";
|
|
40
|
+
content: string | AnthropicContentBlock[];
|
|
41
|
+
}
|
|
42
|
+
type AnthropicContentBlock = AnthropicTextContentBlock | AnthropicImageContentBlock;
|
|
43
|
+
interface AnthropicTextContentBlock {
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
interface AnthropicImageContentBlock {
|
|
48
|
+
type: "image";
|
|
49
|
+
source: {
|
|
50
|
+
type: "base64";
|
|
51
|
+
media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
|
|
52
|
+
data: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface ParsedResponseMessage {
|
|
56
|
+
role: "assistant";
|
|
57
|
+
content: string | null;
|
|
58
|
+
function_call: FunctionCall | null;
|
|
59
|
+
}
|
|
60
|
+
interface FunctionCall {
|
|
61
|
+
name: string;
|
|
62
|
+
arguments: Record<string, any>;
|
|
63
|
+
}
|
|
64
|
+
interface FunctionCall {
|
|
65
|
+
name: string;
|
|
66
|
+
arguments: Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
interface OpenAIConfig {
|
|
69
|
+
service: "azure" | "openai";
|
|
70
|
+
apiKey: string;
|
|
71
|
+
baseUrl: string;
|
|
72
|
+
orgId?: string;
|
|
73
|
+
modelConfigMap?: Record<GPTModel, {
|
|
74
|
+
resource: string;
|
|
75
|
+
deployment: string;
|
|
76
|
+
apiVersion: string;
|
|
77
|
+
apiKey: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
interface AnthropicAIConfig {
|
|
81
|
+
service: "anthropic" | "bedrock";
|
|
82
|
+
}
|
|
83
|
+
interface OpenAIPayload {
|
|
84
|
+
model: GPTModel;
|
|
85
|
+
messages: OpenAIMessage[];
|
|
86
|
+
functions?: any[];
|
|
87
|
+
function_call?: "none" | "auto" | {
|
|
88
|
+
name: string;
|
|
89
|
+
};
|
|
90
|
+
temperature?: number;
|
|
91
|
+
}
|
|
92
|
+
interface AnthropicAIPayload {
|
|
93
|
+
model: ClaudeModel;
|
|
94
|
+
messages: AnthropicAIMessage[];
|
|
95
|
+
functions?: any[];
|
|
96
|
+
}
|
|
97
|
+
interface GenericPayload {
|
|
98
|
+
model: GPTModel | ClaudeModel | GroqModel;
|
|
99
|
+
messages: GenericMessage[];
|
|
100
|
+
functions?: any[];
|
|
101
|
+
function_call?: "none" | "auto" | {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
temperature?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare function callOpenAiWithRetries(identifier: string, openAiPayload: OpenAIPayload, openAiConfig?: OpenAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
108
|
+
declare function callAnthropicWithRetries(identifier: string, AiPayload: AnthropicAIPayload, AiConfig?: AnthropicAIConfig, attempts?: number): Promise<ParsedResponseMessage>;
|
|
109
|
+
declare function callWithRetries(identifier: string, aiPayload: GenericPayload, aiConfig?: OpenAIConfig | AnthropicAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
110
|
+
|
|
111
|
+
export { ClaudeModel, GPTModel, GroqModel, Role, callAnthropicWithRetries, callOpenAiWithRetries, callWithRetries };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
declare enum ClaudeModel {
|
|
2
|
+
HAIKU = "claude-3-haiku-20240307",
|
|
3
|
+
SONNET = "claude-3-sonnet-20240229",
|
|
4
|
+
OPUS = "claude-3-opus-20240229"
|
|
5
|
+
}
|
|
6
|
+
declare enum GPTModel {
|
|
7
|
+
GPT35_0613 = "gpt-3.5-turbo-0613",
|
|
8
|
+
GPT35_0613_16K = "gpt-3.5-turbo-16k-0613",
|
|
9
|
+
GPT35_0125 = "gpt-3.5-turbo-0125",
|
|
10
|
+
GPT4_1106_PREVIEW = "gpt-4-1106-preview",
|
|
11
|
+
GPT4_0125_PREVIEW = "gpt-4-0125-preview"
|
|
12
|
+
}
|
|
13
|
+
declare enum GroqModel {
|
|
14
|
+
LLAMA_3_70B_8192 = "llama3-70b-8192"
|
|
15
|
+
}
|
|
16
|
+
declare enum Role {
|
|
17
|
+
User = "user",
|
|
18
|
+
Assistant = "assistant",
|
|
19
|
+
System = "system"
|
|
20
|
+
}
|
|
21
|
+
interface GenericMessage {
|
|
22
|
+
role: Role;
|
|
23
|
+
content: string;
|
|
24
|
+
timestamp?: string;
|
|
25
|
+
files?: File[];
|
|
26
|
+
functionCalls?: FunctionCall[];
|
|
27
|
+
}
|
|
28
|
+
interface File {
|
|
29
|
+
name: string;
|
|
30
|
+
mimetype: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
data?: string;
|
|
33
|
+
}
|
|
34
|
+
interface OpenAIMessage {
|
|
35
|
+
role: "user" | "assistant" | "system";
|
|
36
|
+
content: string;
|
|
37
|
+
}
|
|
38
|
+
interface AnthropicAIMessage {
|
|
39
|
+
role: "user" | "assistant" | "system";
|
|
40
|
+
content: string | AnthropicContentBlock[];
|
|
41
|
+
}
|
|
42
|
+
type AnthropicContentBlock = AnthropicTextContentBlock | AnthropicImageContentBlock;
|
|
43
|
+
interface AnthropicTextContentBlock {
|
|
44
|
+
type: "text";
|
|
45
|
+
text: string;
|
|
46
|
+
}
|
|
47
|
+
interface AnthropicImageContentBlock {
|
|
48
|
+
type: "image";
|
|
49
|
+
source: {
|
|
50
|
+
type: "base64";
|
|
51
|
+
media_type: "image/jpeg" | "image/png" | "image/gif" | "image/webp";
|
|
52
|
+
data: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
interface ParsedResponseMessage {
|
|
56
|
+
role: "assistant";
|
|
57
|
+
content: string | null;
|
|
58
|
+
function_call: FunctionCall | null;
|
|
59
|
+
}
|
|
60
|
+
interface FunctionCall {
|
|
61
|
+
name: string;
|
|
62
|
+
arguments: Record<string, any>;
|
|
63
|
+
}
|
|
64
|
+
interface FunctionCall {
|
|
65
|
+
name: string;
|
|
66
|
+
arguments: Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
interface OpenAIConfig {
|
|
69
|
+
service: "azure" | "openai";
|
|
70
|
+
apiKey: string;
|
|
71
|
+
baseUrl: string;
|
|
72
|
+
orgId?: string;
|
|
73
|
+
modelConfigMap?: Record<GPTModel, {
|
|
74
|
+
resource: string;
|
|
75
|
+
deployment: string;
|
|
76
|
+
apiVersion: string;
|
|
77
|
+
apiKey: string;
|
|
78
|
+
}>;
|
|
79
|
+
}
|
|
80
|
+
interface AnthropicAIConfig {
|
|
81
|
+
service: "anthropic" | "bedrock";
|
|
82
|
+
}
|
|
83
|
+
interface OpenAIPayload {
|
|
84
|
+
model: GPTModel;
|
|
85
|
+
messages: OpenAIMessage[];
|
|
86
|
+
functions?: any[];
|
|
87
|
+
function_call?: "none" | "auto" | {
|
|
88
|
+
name: string;
|
|
89
|
+
};
|
|
90
|
+
temperature?: number;
|
|
91
|
+
}
|
|
92
|
+
interface AnthropicAIPayload {
|
|
93
|
+
model: ClaudeModel;
|
|
94
|
+
messages: AnthropicAIMessage[];
|
|
95
|
+
functions?: any[];
|
|
96
|
+
}
|
|
97
|
+
interface GenericPayload {
|
|
98
|
+
model: GPTModel | ClaudeModel | GroqModel;
|
|
99
|
+
messages: GenericMessage[];
|
|
100
|
+
functions?: any[];
|
|
101
|
+
function_call?: "none" | "auto" | {
|
|
102
|
+
name: string;
|
|
103
|
+
};
|
|
104
|
+
temperature?: number;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
declare function callOpenAiWithRetries(identifier: string, openAiPayload: OpenAIPayload, openAiConfig?: OpenAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
108
|
+
declare function callAnthropicWithRetries(identifier: string, AiPayload: AnthropicAIPayload, AiConfig?: AnthropicAIConfig, attempts?: number): Promise<ParsedResponseMessage>;
|
|
109
|
+
declare function callWithRetries(identifier: string, aiPayload: GenericPayload, aiConfig?: OpenAIConfig | AnthropicAIConfig, retries?: number, chunkTimeoutMs?: number): Promise<ParsedResponseMessage>;
|
|
110
|
+
|
|
111
|
+
export { ClaudeModel, GPTModel, GroqModel, Role, callAnthropicWithRetries, callOpenAiWithRetries, callWithRetries };
|