Skip to content

Commit 7b93d7c

Browse files
authored
Add Mistral OCR support and imrpove img2txt API (#1957)
Introduces Mistral OCR integration in backend and updates the `AIInterfaceService` and `MistralAIService` to support new OCR options and response normalization. Updates metering cost map for OCR and annotation usage. Refactors `DriverService` to support interface-specific service aliases. Expands the puter.js `AI.img2txt` API to support flexible options and provider selection, including Mistral OCR.
1 parent fdc8582 commit 7b93d7c

File tree

8 files changed

+372
-64
lines changed

8 files changed

+372
-64
lines changed

package-lock.json

Lines changed: 1 addition & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/backend/src/modules/puterai/AIChatService.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ class AIChatService extends BaseService {
122122
const svc_driver = this.services.get('driver');
123123
for ( const provider of this.providers ) {
124124
svc_driver.register_service_alias('ai-chat',
125-
provider.service_name);
125+
provider.service_name,
126+
{ iface: 'puter-chat-completion' });
126127
}
127128
}
128129

src/backend/src/modules/puterai/AIInterfaceService.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,35 @@ class AIInterfaceService extends BaseService {
4747
source: {
4848
type: 'file',
4949
},
50+
model: {
51+
type: 'string',
52+
optional: true,
53+
},
54+
pages: {
55+
type: 'json',
56+
subtype: 'array',
57+
optional: true,
58+
},
59+
includeImageBase64: {
60+
type: 'flag',
61+
optional: true,
62+
},
63+
imageLimit: {
64+
type: 'number',
65+
optional: true,
66+
},
67+
imageMinSize: {
68+
type: 'number',
69+
optional: true,
70+
},
71+
bboxAnnotationFormat: {
72+
type: 'json',
73+
optional: true,
74+
},
75+
documentAnnotationFormat: {
76+
type: 'json',
77+
optional: true,
78+
},
5079
},
5180
result: {
5281
type: {

0 commit comments

Comments
 (0)