190proof 1.0.52 → 1.0.53

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/README.md ADDED
@@ -0,0 +1,163 @@
1
+ # 190proof
2
+
3
+ A unified interface for interacting with multiple AI providers including **OpenAI**, **Anthropic**, **Google**, and **Groq**. This package provides a consistent API for making requests to different LLM providers while handling retries, streaming, and multimodal inputs.
4
+
5
+ ## Features
6
+
7
+ Fully-local unified interface across multiple AI providers that includes:
8
+
9
+ - 🖼️ Image format & size normalization
10
+ - 🛠️ Consistent function calling
11
+ - 💬 Consistent message alternation & system instructions
12
+ - 🔄 Automatic retries with configurable attempts
13
+ - 📡 Streaming by default
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install 190proof
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### Basic Example
24
+
25
+ ```typescript
26
+ import { callWithRetries } from "190proof";
27
+ import { GPTModel, GenericPayload } from "190proof/interfaces";
28
+
29
+ const payload: GenericPayload = {
30
+ model: GPTModel.O1_MINI,
31
+ messages: [
32
+ {
33
+ role: "user",
34
+ content: "Tell me a joke.",
35
+ },
36
+ ],
37
+ };
38
+
39
+ const response = await callWithRetries("my-request-id", payload);
40
+ console.log(response.content);
41
+ ```
42
+
43
+ ### With Function Calling
44
+
45
+ ```typescript
46
+ const payload: GenericPayload = {
47
+ model: GPTModel.O1_MINI,
48
+ messages: [
49
+ {
50
+ role: "user",
51
+ content: "What is the capital of France?",
52
+ },
53
+ ],
54
+ functions: [
55
+ {
56
+ name: "get_country_capital",
57
+ description: "Get the capital of a given country",
58
+ parameters: {
59
+ type: "object",
60
+ properties: {
61
+ country_name: {
62
+ type: "string",
63
+ description: "The name of the country",
64
+ },
65
+ },
66
+ required: ["country_name"],
67
+ },
68
+ },
69
+ ],
70
+ };
71
+
72
+ const response = await callWithRetries("function-call-example", payload);
73
+ ```
74
+
75
+ ### With Images
76
+
77
+ ```typescript
78
+ const payload: GenericPayload = {
79
+ model: GPTModel.O1_MINI,
80
+ messages: [
81
+ {
82
+ role: "user",
83
+ content: "What's in this image?",
84
+ files: [
85
+ {
86
+ mimeType: "image/jpeg",
87
+ url: "https://example.com/image.jpg",
88
+ },
89
+ ],
90
+ },
91
+ ],
92
+ };
93
+
94
+ const response = await callWithRetries("image-example", payload);
95
+ ```
96
+
97
+ ### With System Messages
98
+
99
+ ```typescript
100
+ const payload: GenericPayload = {
101
+ model: GPTModel.O1_MINI,
102
+ messages: [
103
+ {
104
+ role: "system",
105
+ content: "You are a helpful assistant that speaks in a friendly tone.",
106
+ },
107
+ {
108
+ role: "user",
109
+ content: "Tell me about yourself.",
110
+ },
111
+ ],
112
+ };
113
+
114
+ const response = await callWithRetries("system-message-example", payload);
115
+ ```
116
+
117
+ ## Supported Models
118
+
119
+ ### OpenAI Models
120
+
121
+ - `gpt-3.5-turbo-0613`
122
+ - `gpt-3.5-turbo-16k-0613`
123
+ - `gpt-3.5-turbo-0125`
124
+ - `gpt-4-1106-preview`
125
+ - `gpt-4-0125-preview`
126
+ - `gpt-4-turbo-2024-04-09`
127
+ - `gpt-4o`
128
+ - `gpt-4o-mini`
129
+ - `o1-preview`
130
+ - `o1-mini`
131
+
132
+ ### Anthropic Models
133
+
134
+ - `claude-3-haiku-20240307`
135
+ - `claude-3-sonnet-20240229`
136
+ - `claude-3-opus-20240229`
137
+ - `claude-3-5-sonnet-20241022`
138
+
139
+ ### Google Models
140
+
141
+ - `gemini-1.5-pro-latest`
142
+
143
+ ### Groq Models
144
+
145
+ - `llama3-70b-8192`
146
+
147
+ ## API Reference
148
+
149
+ ### `callWithRetries(identifier: string, payload: GenericPayload, config?: Config, retries?: number, chunkTimeoutMs?: number)`
150
+
151
+ Main function to make requests to any supported AI provider.
152
+
153
+ #### Parameters
154
+
155
+ - `identifier`: Unique identifier for the request
156
+ - `payload`: Request payload containing model, messages, and optional functions
157
+ - `config`: Optional configuration for the specific provider
158
+ - `retries`: Number of retry attempts (default: 5)
159
+ - `chunkTimeoutMs`: Timeout for streaming chunks (default: 15000)
160
+
161
+ ## License
162
+
163
+ ISC