retab 0.0.38__py3-none-any.whl → 0.0.40__py3-none-any.whl
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.
- retab/_utils/_model_cards/anthropic.yaml +59 -0
- retab/_utils/_model_cards/auto.yaml +43 -0
- retab/_utils/_model_cards/gemini.yaml +117 -0
- retab/_utils/_model_cards/openai.yaml +301 -0
- retab/_utils/_model_cards/xai.yaml +28 -0
- retab/_utils/ai_models.py +109 -71
- retab/_utils/responses.py +7 -7
- retab/_utils/usage/usage.py +2 -1
- retab/resources/consensus/completions.py +14 -14
- retab/resources/consensus/completions_stream.py +18 -18
- retab/resources/consensus/responses.py +5 -5
- retab/resources/consensus/responses_stream.py +5 -5
- retab/resources/documents/client.py +122 -27
- retab/resources/documents/extractions.py +22 -22
- retab/resources/evaluations/documents.py +5 -5
- retab/resources/evaluations/iterations.py +7 -7
- retab/resources/jsonlUtils.py +2 -2
- retab/resources/processors/automations/endpoints.py +2 -2
- retab/resources/processors/automations/links.py +2 -2
- retab/resources/processors/automations/mailboxes.py +2 -2
- retab/resources/processors/automations/outlook.py +2 -2
- retab/resources/processors/client.py +7 -7
- retab/types/ai_models.py +41 -513
- retab/types/automations/webhooks.py +3 -3
- retab/types/completions.py +7 -7
- retab/types/documents/__init__.py +3 -0
- retab/types/documents/extractions.py +17 -17
- retab/types/documents/parse.py +32 -0
- retab/types/extractions.py +2 -2
- retab/types/logs.py +2 -2
- {retab-0.0.38.dist-info → retab-0.0.40.dist-info}/METADATA +4 -4
- {retab-0.0.38.dist-info → retab-0.0.40.dist-info}/RECORD +34 -28
- {retab-0.0.38.dist-info → retab-0.0.40.dist-info}/WHEEL +0 -0
- {retab-0.0.38.dist-info → retab-0.0.40.dist-info}/top_level.txt +0 -0
retab/types/ai_models.py
CHANGED
@@ -1,24 +1,32 @@
|
|
1
1
|
import datetime
|
2
2
|
from typing import List, Literal, Optional
|
3
|
+
from pydantic import BaseModel, Field, computed_field
|
4
|
+
from retab.types.inference_settings import InferenceSettings
|
3
5
|
|
4
|
-
from pydantic import BaseModel, Field
|
5
6
|
|
6
|
-
|
7
|
-
|
8
|
-
AIProvider = Literal["OpenAI", "Gemini", "xAI", "Retab"] # , "Anthropic", "xAI"]
|
9
|
-
OpenAICompatibleProvider = Literal["OpenAI", "xAI"] # , "xAI"]
|
7
|
+
AIProvider = Literal["OpenAI", "Anthropic", "Gemini", "xAI", "Retab"]
|
8
|
+
OpenAICompatibleProvider = Literal["OpenAI", "xAI"]
|
10
9
|
GeminiModel = Literal[
|
10
|
+
"gemini-2.5-pro",
|
11
|
+
"gemini-2.5-flash",
|
11
12
|
"gemini-2.5-pro-preview-06-05",
|
12
13
|
"gemini-2.5-pro-preview-05-06",
|
14
|
+
"gemini-2.5-pro-preview-03-25",
|
13
15
|
"gemini-2.5-flash-preview-05-20",
|
14
16
|
"gemini-2.5-flash-preview-04-17",
|
17
|
+
"gemini-2.5-flash-lite-preview-06-17",
|
15
18
|
"gemini-2.5-pro-exp-03-25",
|
16
19
|
"gemini-2.0-flash-lite",
|
17
20
|
"gemini-2.0-flash",
|
18
21
|
]
|
19
22
|
|
20
23
|
AnthropicModel = Literal[
|
21
|
-
"claude-3-5-sonnet-latest",
|
24
|
+
"claude-3-5-sonnet-latest",
|
25
|
+
"claude-3-5-sonnet-20241022",
|
26
|
+
# "claude-3-5-haiku-20241022",
|
27
|
+
"claude-3-opus-20240229",
|
28
|
+
"claude-3-sonnet-20240229",
|
29
|
+
"claude-3-haiku-20240307",
|
22
30
|
]
|
23
31
|
OpenAIModel = Literal[
|
24
32
|
"gpt-4o",
|
@@ -26,24 +34,25 @@ OpenAIModel = Literal[
|
|
26
34
|
"chatgpt-4o-latest",
|
27
35
|
"gpt-4.1",
|
28
36
|
"gpt-4.1-mini",
|
37
|
+
"gpt-4.1-mini-2025-04-14",
|
38
|
+
"gpt-4.1-2025-04-14",
|
29
39
|
"gpt-4.1-nano",
|
40
|
+
"gpt-4.1-nano-2025-04-14",
|
30
41
|
"gpt-4o-2024-11-20",
|
31
42
|
"gpt-4o-2024-08-06",
|
32
43
|
"gpt-4o-2024-05-13",
|
33
44
|
"gpt-4o-mini-2024-07-18",
|
34
|
-
"o3-mini",
|
35
|
-
"o3-mini-2025-01-31",
|
45
|
+
# "o3-mini",
|
46
|
+
# "o3-mini-2025-01-31",
|
36
47
|
"o1",
|
37
48
|
"o1-2024-12-17",
|
38
|
-
"o1-preview-2024-09-12",
|
39
|
-
"o1-mini",
|
40
|
-
"o1-mini-2024-09-12",
|
49
|
+
# "o1-preview-2024-09-12",
|
50
|
+
# "o1-mini",
|
51
|
+
# "o1-mini-2024-09-12",
|
41
52
|
"o3",
|
42
53
|
"o3-2025-04-16",
|
43
54
|
"o4-mini",
|
44
55
|
"o4-mini-2025-04-16",
|
45
|
-
"gpt-4.5-preview",
|
46
|
-
"gpt-4.5-preview-2025-02-27",
|
47
56
|
"gpt-4o-audio-preview-2024-12-17",
|
48
57
|
"gpt-4o-audio-preview-2024-10-01",
|
49
58
|
"gpt-4o-realtime-preview-2024-12-17",
|
@@ -51,9 +60,10 @@ OpenAIModel = Literal[
|
|
51
60
|
"gpt-4o-mini-audio-preview-2024-12-17",
|
52
61
|
"gpt-4o-mini-realtime-preview-2024-12-17",
|
53
62
|
]
|
54
|
-
xAI_Model = Literal["grok-3
|
55
|
-
RetabModel = Literal["auto", "auto-small"]
|
56
|
-
|
63
|
+
xAI_Model = Literal["grok-3", "grok-3-mini"]
|
64
|
+
RetabModel = Literal["auto-large", "auto-small", "auto-micro"]
|
65
|
+
PureLLMModel = Literal[OpenAIModel, AnthropicModel, xAI_Model, GeminiModel, RetabModel]
|
66
|
+
LLMModel = Literal[PureLLMModel, "human"]
|
57
67
|
|
58
68
|
|
59
69
|
class FinetunedModel(BaseModel):
|
@@ -88,7 +98,7 @@ class TokenPrice(BaseModel):
|
|
88
98
|
|
89
99
|
prompt: float # Price per 1M prompt tokens.
|
90
100
|
completion: float # Price per 1M completion tokens.
|
91
|
-
cached_discount: float = 0
|
101
|
+
cached_discount: float = 1.0 # Price discount for cached tokens. (1.0 means no discount or tokens are not cached)
|
92
102
|
|
93
103
|
|
94
104
|
class Pricing(BaseModel):
|
@@ -124,7 +134,7 @@ EndpointType = Literal[
|
|
124
134
|
]
|
125
135
|
|
126
136
|
# Define supported features
|
127
|
-
FeatureType = Literal["streaming", "function_calling", "structured_outputs", "distillation", "fine_tuning", "predicted_outputs"]
|
137
|
+
FeatureType = Literal["streaming", "function_calling", "structured_outputs", "distillation", "fine_tuning", "predicted_outputs", "schema_generation"]
|
128
138
|
|
129
139
|
|
130
140
|
class ModelCapabilities(BaseModel):
|
@@ -138,6 +148,11 @@ class ModelCapabilities(BaseModel):
|
|
138
148
|
features: List[FeatureType]
|
139
149
|
|
140
150
|
|
151
|
+
class ModelCardPermissions(BaseModel):
|
152
|
+
show_in_free_picker: bool = False
|
153
|
+
show_in_paid_picker: bool = False
|
154
|
+
|
155
|
+
|
141
156
|
class ModelCard(BaseModel):
|
142
157
|
"""
|
143
158
|
Model card that includes pricing and capabilities.
|
@@ -148,498 +163,11 @@ class ModelCard(BaseModel):
|
|
148
163
|
capabilities: ModelCapabilities
|
149
164
|
temperature_support: bool = True
|
150
165
|
reasoning_effort_support: bool = False
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
# ----------------------
|
160
|
-
########################
|
161
|
-
########################
|
162
|
-
# ----------------------
|
163
|
-
# o1 family
|
164
|
-
# ----------------------
|
165
|
-
ModelCard(
|
166
|
-
model="o1",
|
167
|
-
pricing=Pricing(text=TokenPrice(prompt=15.00, cached_discount=0.5, completion=60.00), audio=None),
|
168
|
-
capabilities=ModelCapabilities(
|
169
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
170
|
-
),
|
171
|
-
temperature_support=False,
|
172
|
-
reasoning_effort_support=True,
|
173
|
-
),
|
174
|
-
ModelCard(
|
175
|
-
model="o1-2024-12-17",
|
176
|
-
pricing=Pricing(text=TokenPrice(prompt=15.00, cached_discount=0.5, completion=60.00), audio=None),
|
177
|
-
capabilities=ModelCapabilities(
|
178
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
179
|
-
),
|
180
|
-
temperature_support=False,
|
181
|
-
reasoning_effort_support=True,
|
182
|
-
),
|
183
|
-
ModelCard(
|
184
|
-
model="o1-preview-2024-09-12",
|
185
|
-
pricing=Pricing(text=TokenPrice(prompt=15.00, cached_discount=0.5, completion=60.00), audio=None),
|
186
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling"]),
|
187
|
-
temperature_support=False,
|
188
|
-
reasoning_effort_support=True,
|
189
|
-
),
|
190
|
-
# ----------------------
|
191
|
-
# o1-mini family
|
192
|
-
# ----------------------
|
193
|
-
ModelCard(
|
194
|
-
model="o1-mini",
|
195
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.5, completion=4.40), audio=None),
|
196
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions", "responses", "assistants"], features=["streaming"]),
|
197
|
-
temperature_support=False,
|
198
|
-
reasoning_effort_support=True,
|
199
|
-
),
|
200
|
-
ModelCard(
|
201
|
-
model="o1-mini-2024-09-12",
|
202
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.5, completion=4.40), audio=None),
|
203
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions", "responses", "assistants"], features=["streaming"]),
|
204
|
-
temperature_support=False,
|
205
|
-
reasoning_effort_support=True,
|
206
|
-
),
|
207
|
-
# ----------------------
|
208
|
-
# o3 family
|
209
|
-
# ----------------------
|
210
|
-
ModelCard(
|
211
|
-
model="o3",
|
212
|
-
pricing=Pricing(text=TokenPrice(prompt=10.0, cached_discount=2.5 / 10.0, completion=40.0), audio=None, ft_price_hike=1.5),
|
213
|
-
capabilities=ModelCapabilities(
|
214
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
215
|
-
),
|
216
|
-
temperature_support=False,
|
217
|
-
reasoning_effort_support=True,
|
218
|
-
),
|
219
|
-
ModelCard(
|
220
|
-
model="o3-2025-04-16",
|
221
|
-
pricing=Pricing(text=TokenPrice(prompt=10.0, cached_discount=2.5 / 10.0, completion=40.0), audio=None, ft_price_hike=1.5),
|
222
|
-
capabilities=ModelCapabilities(
|
223
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
224
|
-
),
|
225
|
-
temperature_support=False,
|
226
|
-
reasoning_effort_support=True,
|
227
|
-
),
|
228
|
-
# ----------------------
|
229
|
-
# o3-mini family
|
230
|
-
# ----------------------
|
231
|
-
ModelCard(
|
232
|
-
model="o3-mini-2025-01-31",
|
233
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.5, completion=4.40), audio=None, ft_price_hike=1.5),
|
234
|
-
capabilities=ModelCapabilities(
|
235
|
-
modalities=["text"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
236
|
-
),
|
237
|
-
temperature_support=False,
|
238
|
-
reasoning_effort_support=True,
|
239
|
-
),
|
240
|
-
ModelCard(
|
241
|
-
model="o3-mini",
|
242
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.5, completion=4.40), audio=None, ft_price_hike=1.5),
|
243
|
-
capabilities=ModelCapabilities(
|
244
|
-
modalities=["text"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
245
|
-
),
|
246
|
-
temperature_support=False,
|
247
|
-
reasoning_effort_support=True,
|
248
|
-
),
|
249
|
-
# ----------------------
|
250
|
-
# o4-mini family
|
251
|
-
# ----------------------
|
252
|
-
ModelCard(
|
253
|
-
model="o4-mini",
|
254
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.275 / 1.1, completion=4.40), audio=None, ft_price_hike=1.5),
|
255
|
-
capabilities=ModelCapabilities(
|
256
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
257
|
-
),
|
258
|
-
temperature_support=False,
|
259
|
-
reasoning_effort_support=True,
|
260
|
-
),
|
261
|
-
ModelCard(
|
262
|
-
model="o4-mini-2025-04-16",
|
263
|
-
pricing=Pricing(text=TokenPrice(prompt=1.10, cached_discount=0.275 / 1.1, completion=4.40), audio=None, ft_price_hike=1.5),
|
264
|
-
capabilities=ModelCapabilities(
|
265
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
266
|
-
),
|
267
|
-
temperature_support=False,
|
268
|
-
reasoning_effort_support=True,
|
269
|
-
),
|
270
|
-
########################
|
271
|
-
########################
|
272
|
-
# ----------------------
|
273
|
-
# Chat models
|
274
|
-
# ----------------------
|
275
|
-
########################
|
276
|
-
########################
|
277
|
-
# ----------------------
|
278
|
-
# gpt-4.1 family
|
279
|
-
# ----------------------
|
280
|
-
ModelCard(
|
281
|
-
model="gpt-4.1",
|
282
|
-
pricing=Pricing(text=TokenPrice(prompt=2.00, cached_discount=0.25, completion=8.00), audio=None, ft_price_hike=1.5),
|
283
|
-
capabilities=ModelCapabilities(
|
284
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
285
|
-
),
|
286
|
-
temperature_support=True,
|
287
|
-
reasoning_effort_support=False,
|
288
|
-
),
|
289
|
-
ModelCard(
|
290
|
-
model="gpt-4.1-2025-04-14",
|
291
|
-
pricing=Pricing(text=TokenPrice(prompt=2.00, cached_discount=0.25, completion=8.00), audio=None, ft_price_hike=1.5),
|
292
|
-
capabilities=ModelCapabilities(
|
293
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
294
|
-
),
|
295
|
-
temperature_support=True,
|
296
|
-
reasoning_effort_support=False,
|
297
|
-
),
|
298
|
-
ModelCard(
|
299
|
-
model="gpt-4.1-mini",
|
300
|
-
pricing=Pricing(text=TokenPrice(prompt=0.40, cached_discount=0.25, completion=1.60), audio=None, ft_price_hike=1.5),
|
301
|
-
capabilities=ModelCapabilities(
|
302
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
303
|
-
),
|
304
|
-
temperature_support=True,
|
305
|
-
reasoning_effort_support=False,
|
306
|
-
),
|
307
|
-
ModelCard(
|
308
|
-
model="gpt-4.1-mini-2025-04-14",
|
309
|
-
pricing=Pricing(text=TokenPrice(prompt=0.40, cached_discount=0.25, completion=1.60), audio=None, ft_price_hike=1.5),
|
310
|
-
capabilities=ModelCapabilities(
|
311
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
312
|
-
),
|
313
|
-
temperature_support=True,
|
314
|
-
reasoning_effort_support=False,
|
315
|
-
),
|
316
|
-
ModelCard(
|
317
|
-
model="gpt-4.1-nano",
|
318
|
-
pricing=Pricing(text=TokenPrice(prompt=0.10, cached_discount=0.25, completion=0.40), audio=None, ft_price_hike=1.5),
|
319
|
-
capabilities=ModelCapabilities(
|
320
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
321
|
-
),
|
322
|
-
temperature_support=True,
|
323
|
-
reasoning_effort_support=False,
|
324
|
-
),
|
325
|
-
ModelCard(
|
326
|
-
model="gpt-4.1-nano-2025-04-14",
|
327
|
-
pricing=Pricing(text=TokenPrice(prompt=0.10, cached_discount=0.25, completion=0.40), audio=None, ft_price_hike=1.5),
|
328
|
-
capabilities=ModelCapabilities(
|
329
|
-
modalities=["text", "image"], endpoints=["chat_completions", "responses", "assistants", "batch"], features=["streaming", "function_calling", "structured_outputs"]
|
330
|
-
),
|
331
|
-
temperature_support=True,
|
332
|
-
reasoning_effort_support=False,
|
333
|
-
),
|
334
|
-
# ----------------------
|
335
|
-
# gpt-4.5 family
|
336
|
-
# ----------------------
|
337
|
-
# ModelCard(
|
338
|
-
# model="gpt-4.5-preview",
|
339
|
-
# pricing=Pricing(
|
340
|
-
# text=TokenPrice(prompt=75, cached_discount=0.5, completion=150.00),
|
341
|
-
# audio=None,
|
342
|
-
# ft_price_hike=1.5
|
343
|
-
# ),
|
344
|
-
# capabilities=ModelCapabilities(
|
345
|
-
# modalities=["text", "image"],
|
346
|
-
# endpoints=["chat_completions", "responses", "assistants", "batch"],
|
347
|
-
# features=["streaming", "function_calling", "structured_outputs"]
|
348
|
-
# ),
|
349
|
-
# logprobs_support=False,
|
350
|
-
# ),
|
351
|
-
# ModelCard(
|
352
|
-
# model="gpt-4.5-preview-2025-02-27",
|
353
|
-
# pricing=Pricing(
|
354
|
-
# text=TokenPrice(prompt=75, cached_discount=0.5, completion=150.00),
|
355
|
-
# audio=None,
|
356
|
-
# ft_price_hike=1.5
|
357
|
-
# ),
|
358
|
-
# capabilities=ModelCapabilities(
|
359
|
-
# modalities=["text", "image"],
|
360
|
-
# endpoints=["chat_completions", "responses", "assistants", "batch"],
|
361
|
-
# features=["streaming", "function_calling", "structured_outputs"]
|
362
|
-
# ),
|
363
|
-
# logprobs_support=False,
|
364
|
-
# ),
|
365
|
-
# ----------------------
|
366
|
-
# gpt-4o family
|
367
|
-
# ----------------------
|
368
|
-
ModelCard(
|
369
|
-
model="chatgpt-4o-latest",
|
370
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=None, ft_price_hike=1.5),
|
371
|
-
capabilities=ModelCapabilities(
|
372
|
-
modalities=["text", "image"],
|
373
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
374
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning", "distillation", "predicted_outputs"],
|
375
|
-
),
|
376
|
-
),
|
377
|
-
ModelCard(
|
378
|
-
model="gpt-4o",
|
379
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=None, ft_price_hike=1.5),
|
380
|
-
capabilities=ModelCapabilities(
|
381
|
-
modalities=["text", "image"],
|
382
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
383
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning", "distillation", "predicted_outputs"],
|
384
|
-
),
|
385
|
-
),
|
386
|
-
ModelCard(
|
387
|
-
model="gpt-4o-2024-08-06",
|
388
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=None, ft_price_hike=1.5),
|
389
|
-
capabilities=ModelCapabilities(
|
390
|
-
modalities=["text", "image"],
|
391
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
392
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning", "distillation", "predicted_outputs"],
|
393
|
-
),
|
394
|
-
),
|
395
|
-
ModelCard(
|
396
|
-
model="gpt-4o-2024-11-20",
|
397
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=None, ft_price_hike=1.5),
|
398
|
-
capabilities=ModelCapabilities(
|
399
|
-
modalities=["text", "image"],
|
400
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
401
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning", "distillation", "predicted_outputs"],
|
402
|
-
),
|
403
|
-
),
|
404
|
-
ModelCard(
|
405
|
-
model="gpt-4o-2024-05-13",
|
406
|
-
pricing=Pricing(text=TokenPrice(prompt=5.00, cached_discount=0.5, completion=15.00), audio=None, ft_price_hike=1.5),
|
407
|
-
capabilities=ModelCapabilities(
|
408
|
-
modalities=["text", "image"],
|
409
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
410
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning", "distillation", "predicted_outputs"],
|
411
|
-
),
|
412
|
-
),
|
413
|
-
# ----------------------
|
414
|
-
# gpt-4o-audio family
|
415
|
-
# ----------------------
|
416
|
-
ModelCard(
|
417
|
-
model="gpt-4o-audio-preview-2024-12-17",
|
418
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=TokenPrice(prompt=40.00, cached_discount=0.2, completion=80.00)),
|
419
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
420
|
-
),
|
421
|
-
ModelCard(
|
422
|
-
model="gpt-4o-audio-preview-2024-10-01",
|
423
|
-
pricing=Pricing(text=TokenPrice(prompt=2.50, cached_discount=0.5, completion=10.00), audio=TokenPrice(prompt=100.00, cached_discount=0.2, completion=200.00)),
|
424
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
425
|
-
),
|
426
|
-
ModelCard(
|
427
|
-
model="gpt-4o-realtime-preview-2024-12-17",
|
428
|
-
pricing=Pricing(text=TokenPrice(prompt=5.00, cached_discount=0.5, completion=20.00), audio=TokenPrice(prompt=40.00, cached_discount=0.2, completion=80.00)),
|
429
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
430
|
-
),
|
431
|
-
ModelCard(
|
432
|
-
model="gpt-4o-realtime-preview-2024-10-01",
|
433
|
-
pricing=Pricing(text=TokenPrice(prompt=5.00, cached_discount=0.5, completion=20.00), audio=TokenPrice(prompt=100.00, cached_discount=0.2, completion=200.00)),
|
434
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
435
|
-
),
|
436
|
-
# ----------------------
|
437
|
-
# gpt-4o-mini family
|
438
|
-
# ----------------------
|
439
|
-
ModelCard(
|
440
|
-
model="gpt-4o-mini",
|
441
|
-
pricing=Pricing(text=TokenPrice(prompt=0.15, cached_discount=0.5, completion=0.60), audio=None, ft_price_hike=2.0),
|
442
|
-
capabilities=ModelCapabilities(
|
443
|
-
modalities=["text", "image"],
|
444
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
445
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning"],
|
446
|
-
),
|
447
|
-
),
|
448
|
-
ModelCard(
|
449
|
-
model="gpt-4o-mini-2024-07-18",
|
450
|
-
pricing=Pricing(text=TokenPrice(prompt=0.15, cached_discount=0.5, completion=0.60), audio=None, ft_price_hike=2.0),
|
451
|
-
capabilities=ModelCapabilities(
|
452
|
-
modalities=["text", "image"],
|
453
|
-
endpoints=["chat_completions", "responses", "assistants", "batch", "fine_tuning"],
|
454
|
-
features=["streaming", "function_calling", "structured_outputs", "fine_tuning"],
|
455
|
-
),
|
456
|
-
),
|
457
|
-
# ----------------------
|
458
|
-
# gpt-4o-mini-audio family
|
459
|
-
# ----------------------
|
460
|
-
ModelCard(
|
461
|
-
model="gpt-4o-mini-audio-preview-2024-12-17",
|
462
|
-
pricing=Pricing(
|
463
|
-
text=TokenPrice(prompt=0.15, cached_discount=0.5, completion=0.60), audio=TokenPrice(prompt=10.00, cached_discount=0.2, completion=20.00), ft_price_hike=2.0
|
464
|
-
),
|
465
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
466
|
-
),
|
467
|
-
ModelCard(
|
468
|
-
model="gpt-4o-mini-realtime-preview-2024-12-17",
|
469
|
-
pricing=Pricing(
|
470
|
-
text=TokenPrice(prompt=0.60, cached_discount=0.5, completion=2.40), audio=TokenPrice(prompt=10.00, cached_discount=0.2, completion=20.00), ft_price_hike=2.0
|
471
|
-
),
|
472
|
-
capabilities=ModelCapabilities(modalities=["text", "audio"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
473
|
-
),
|
474
|
-
]
|
475
|
-
|
476
|
-
# Anthropic Model Cards
|
477
|
-
anthropic_model_cards = [
|
478
|
-
ModelCard(
|
479
|
-
model="claude-3-5-sonnet-20241022",
|
480
|
-
pricing=Pricing(text=TokenPrice(prompt=3.00, cached_discount=0.5, completion=15.00), audio=None),
|
481
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
482
|
-
),
|
483
|
-
ModelCard(
|
484
|
-
model="claude-3-5-haiku-20241022",
|
485
|
-
pricing=Pricing(text=TokenPrice(prompt=0.80, cached_discount=0.5, completion=4.00), audio=None),
|
486
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
487
|
-
),
|
488
|
-
ModelCard(
|
489
|
-
model="claude-3-opus-20240229",
|
490
|
-
pricing=Pricing(text=TokenPrice(prompt=15.00, cached_discount=0.5, completion=75.00), audio=None),
|
491
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
492
|
-
),
|
493
|
-
ModelCard(
|
494
|
-
model="claude-3-sonnet-20240229",
|
495
|
-
pricing=Pricing(text=TokenPrice(prompt=3.00, cached_discount=0.5, completion=15.00), audio=None),
|
496
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
497
|
-
),
|
498
|
-
ModelCard(
|
499
|
-
model="claude-3-haiku-20240307",
|
500
|
-
pricing=Pricing(text=TokenPrice(prompt=0.25, cached_discount=0.5, completion=1.25), audio=None),
|
501
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
502
|
-
),
|
503
|
-
]
|
504
|
-
|
505
|
-
# xAI model cards
|
506
|
-
xai_model_cards = [
|
507
|
-
ModelCard(
|
508
|
-
model="grok-2-vision-1212",
|
509
|
-
pricing=Pricing(text=TokenPrice(prompt=2.00, cached_discount=0.5, completion=10.00), audio=None),
|
510
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
511
|
-
),
|
512
|
-
ModelCard(
|
513
|
-
model="grok-2-1212",
|
514
|
-
pricing=Pricing(text=TokenPrice(prompt=2.00, cached_discount=0.5, completion=10.00), audio=None),
|
515
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
516
|
-
),
|
517
|
-
ModelCard(
|
518
|
-
model="grok-3-beta",
|
519
|
-
pricing=Pricing(text=TokenPrice(prompt=3.00, cached_discount=0.5, completion=15.00), audio=None),
|
520
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
521
|
-
),
|
522
|
-
ModelCard(
|
523
|
-
model="grok-3-mini-beta",
|
524
|
-
pricing=Pricing(text=TokenPrice(prompt=0.30, cached_discount=0.5, completion=0.50), audio=None),
|
525
|
-
capabilities=ModelCapabilities(modalities=["text"], endpoints=["chat_completions"], features=["streaming", "function_calling"]),
|
526
|
-
),
|
527
|
-
]
|
528
|
-
|
529
|
-
# Add Gemini model cards
|
530
|
-
gemini_model_cards = [
|
531
|
-
# ----------------------
|
532
|
-
# gemini-2.5-pro-exp-03-25 family
|
533
|
-
# ----------------------
|
534
|
-
ModelCard(
|
535
|
-
model="gemini-2.5-pro-exp-03-25",
|
536
|
-
pricing=Pricing(text=TokenPrice(prompt=1.25, cached_discount=0.25, completion=10.00), audio=None),
|
537
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
538
|
-
temperature_support=True,
|
539
|
-
),
|
540
|
-
ModelCard(
|
541
|
-
model="gemini-2.5-pro-preview-06-05",
|
542
|
-
pricing=Pricing(text=TokenPrice(prompt=1.25, cached_discount=0.25, completion=10.00), audio=None),
|
543
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
544
|
-
),
|
545
|
-
ModelCard(
|
546
|
-
model="gemini-2.5-pro-preview-05-06",
|
547
|
-
pricing=Pricing(text=TokenPrice(prompt=1.25, cached_discount=0.25, completion=10.00), audio=None),
|
548
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
549
|
-
),
|
550
|
-
ModelCard(
|
551
|
-
model="gemini-2.5-pro-preview-03-25",
|
552
|
-
pricing=Pricing(text=TokenPrice(prompt=1.25, cached_discount=0.25, completion=10.00), audio=None),
|
553
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
554
|
-
temperature_support=True,
|
555
|
-
),
|
556
|
-
ModelCard(
|
557
|
-
model="gemini-2.5-flash-preview-04-17",
|
558
|
-
pricing=Pricing(text=TokenPrice(prompt=0.15, cached_discount=0.25, completion=0.60), audio=None),
|
559
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
560
|
-
temperature_support=True,
|
561
|
-
),
|
562
|
-
ModelCard(
|
563
|
-
model="gemini-2.5-flash-preview-05-20",
|
564
|
-
pricing=Pricing(text=TokenPrice(prompt=0.15, cached_discount=0.25, completion=0.60), audio=None),
|
565
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
566
|
-
temperature_support=True,
|
567
|
-
),
|
568
|
-
# ----------------------
|
569
|
-
# gemini-2.0-flash family
|
570
|
-
# ----------------------
|
571
|
-
ModelCard(
|
572
|
-
model="gemini-2.0-flash",
|
573
|
-
pricing=Pricing(text=TokenPrice(prompt=0.1, cached_discount=0.025 / 0.1, completion=0.40), audio=TokenPrice(prompt=0.7, cached_discount=0.175 / 0.7, completion=1000)),
|
574
|
-
capabilities=ModelCapabilities(modalities=["text", "image"], endpoints=["chat_completions"], features=["streaming", "function_calling", "structured_outputs"]),
|
575
|
-
temperature_support=True,
|
576
|
-
),
|
577
|
-
ModelCard(
|
578
|
-
model="gemini-2.0-flash-lite",
|
579
|
-
pricing=Pricing(text=TokenPrice(prompt=0.075, cached_discount=1.0, completion=0.30), audio=TokenPrice(prompt=0.075, cached_discount=1.0, completion=1000)),
|
580
|
-
capabilities=ModelCapabilities(
|
581
|
-
modalities=["text", "image", "audio"],
|
582
|
-
endpoints=["chat_completions"],
|
583
|
-
features=["streaming", "structured_outputs"],
|
584
|
-
),
|
585
|
-
temperature_support=True,
|
586
|
-
),
|
587
|
-
]
|
588
|
-
|
589
|
-
|
590
|
-
model_cards = openai_model_cards + gemini_model_cards + xai_model_cards
|
591
|
-
xAI_model_cards = [
|
592
|
-
# ----------------------
|
593
|
-
# grok3-family
|
594
|
-
# ----------------------
|
595
|
-
ModelCard(
|
596
|
-
model="grok-3-beta",
|
597
|
-
pricing=Pricing(text=TokenPrice(prompt=3, cached_discount=1.0, completion=15), audio=None),
|
598
|
-
capabilities=ModelCapabilities(
|
599
|
-
modalities=["text"],
|
600
|
-
endpoints=["chat_completions"],
|
601
|
-
features=["streaming", "structured_outputs"],
|
602
|
-
),
|
603
|
-
temperature_support=True,
|
604
|
-
),
|
605
|
-
ModelCard(
|
606
|
-
model="grok-3-mini-beta",
|
607
|
-
pricing=Pricing(text=TokenPrice(prompt=0.3, cached_discount=1.0, completion=0.5), audio=None),
|
608
|
-
capabilities=ModelCapabilities(
|
609
|
-
modalities=["text"],
|
610
|
-
endpoints=["chat_completions"],
|
611
|
-
features=["streaming", "structured_outputs"],
|
612
|
-
),
|
613
|
-
temperature_support=True,
|
614
|
-
),
|
615
|
-
]
|
616
|
-
|
617
|
-
|
618
|
-
model_cards = openai_model_cards + gemini_model_cards + xAI_model_cards
|
619
|
-
|
620
|
-
|
621
|
-
def get_model_card(model: str) -> ModelCard:
|
622
|
-
"""
|
623
|
-
Get the model card for a specific model.
|
624
|
-
|
625
|
-
Args:
|
626
|
-
model: The model name to look up
|
627
|
-
|
628
|
-
Returns:
|
629
|
-
The ModelCard for the specified model
|
630
|
-
|
631
|
-
Raises:
|
632
|
-
ValueError: If no model card is found for the specified model
|
633
|
-
"""
|
634
|
-
# Extract base model name for fine-tuned models like "ft:gpt-4o:retab:4389573"
|
635
|
-
if model.startswith("ft:"):
|
636
|
-
# Split by colon and take the second part (index 1) which contains the base model
|
637
|
-
parts = model.split(":")
|
638
|
-
if len(parts) > 1:
|
639
|
-
model = parts[1]
|
640
|
-
|
641
|
-
for card in model_cards:
|
642
|
-
if card.model == model:
|
643
|
-
return card
|
644
|
-
|
645
|
-
raise ValueError(f"No model card found for model: {model}")
|
166
|
+
permissions: ModelCardPermissions = ModelCardPermissions()
|
167
|
+
|
168
|
+
@computed_field
|
169
|
+
@property
|
170
|
+
def is_finetuned(self) -> bool:
|
171
|
+
if "ft:" in self.model:
|
172
|
+
return True
|
173
|
+
return False
|
@@ -2,20 +2,20 @@ from typing import Any, Optional
|
|
2
2
|
|
3
3
|
from pydantic import BaseModel, EmailStr
|
4
4
|
|
5
|
-
from retab.types.documents.extractions import
|
5
|
+
from retab.types.documents.extractions import RetabParsedChatCompletion
|
6
6
|
|
7
7
|
from ..mime import BaseMIMEData, MIMEData
|
8
8
|
|
9
9
|
|
10
10
|
class WebhookRequest(BaseModel):
|
11
|
-
completion:
|
11
|
+
completion: RetabParsedChatCompletion
|
12
12
|
user: Optional[EmailStr] = None
|
13
13
|
file_payload: MIMEData
|
14
14
|
metadata: Optional[dict[str, Any]] = None
|
15
15
|
|
16
16
|
|
17
17
|
class BaseWebhookRequest(BaseModel):
|
18
|
-
completion:
|
18
|
+
completion: RetabParsedChatCompletion
|
19
19
|
user: Optional[EmailStr] = None
|
20
20
|
file_payload: BaseMIMEData
|
21
21
|
metadata: Optional[dict[str, Any]] = None
|