@canarycoders/ai 0.6.0 → 0.7.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/README.md +15 -1
- package/dist/index.cjs +23 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +108 -1
- package/dist/index.d.ts +108 -1
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ TypeScript SDK for the [CanaryCoders AI](https://ai.canarycoders.es) gateway. Ru
|
|
|
4
4
|
|
|
5
5
|
**Docs:** https://docs.ai.canarycoders.es
|
|
6
6
|
|
|
7
|
-
One client covers chat, image/video/audio generation, embeddings, vision, conversational agents, realtime sessions, and usage data. The queue polling, SSE streaming, retries, and error typing are handled for you, so most calls are a single `await`.
|
|
7
|
+
One client covers chat, image/video/audio generation, embeddings, vision, OCR/PII-redaction, conversational agents, realtime sessions, and usage data. The queue polling, SSE streaming, retries, and error typing are handled for you, so most calls are a single `await`.
|
|
8
8
|
|
|
9
9
|
## Install
|
|
10
10
|
|
|
@@ -77,6 +77,20 @@ const song = await client.audio.music({ prompt: "calm lo-fi", durationMs: 20000
|
|
|
77
77
|
const { detections } = await client.vision.detect({ image });
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
+
## OCR and PII redaction (local)
|
|
81
|
+
|
|
82
|
+
Text recognition with bounding boxes and PII redaction, processed fully on CanaryLLM's own EU infrastructure (Apple Vision). Images and extracted text are never stored.
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const { text, lines } = await client.ocr.recognize({ image, granularity: "word" });
|
|
86
|
+
|
|
87
|
+
const { redactedImage, counts } = await client.ocr.redact({
|
|
88
|
+
image,
|
|
89
|
+
presets: ["email", "phone", "iban"],
|
|
90
|
+
style: "blur", // "box" is the safest for hard PII redaction
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
80
94
|
## Embeddings
|
|
81
95
|
|
|
82
96
|
Embed text into vectors with a local model (LM Studio), for customer-side RAG. The gateway processes the text transiently and stores nothing — you keep the vectors and documents in your own store (e.g. pgvector, sqlite-vec).
|
package/dist/index.cjs
CHANGED
|
@@ -1588,6 +1588,27 @@ var VisionResource = class extends BaseResource {
|
|
|
1588
1588
|
}
|
|
1589
1589
|
};
|
|
1590
1590
|
|
|
1591
|
+
// src/resources/ocr.ts
|
|
1592
|
+
var OcrResource = class extends BaseResource {
|
|
1593
|
+
recognize(params, poll) {
|
|
1594
|
+
return this.runQueued("/api/ocr/recognize", params, "vision", poll);
|
|
1595
|
+
}
|
|
1596
|
+
recognizeJob(params, signal) {
|
|
1597
|
+
return this.submitQueued("/api/ocr/recognize", params, "vision", signal);
|
|
1598
|
+
}
|
|
1599
|
+
redact(params, poll) {
|
|
1600
|
+
return this.runQueued("/api/ocr/redact", params, "vision", poll);
|
|
1601
|
+
}
|
|
1602
|
+
redactJob(params, signal) {
|
|
1603
|
+
return this.submitQueued("/api/ocr/redact", params, "vision", signal);
|
|
1604
|
+
}
|
|
1605
|
+
async languages(signal) {
|
|
1606
|
+
return this.transport.json("GET", "/api/ocr/languages", {
|
|
1607
|
+
signal
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1591
1612
|
// src/client.ts
|
|
1592
1613
|
var DEFAULT_BASE_URL = "https://api.ai.canarycoders.es";
|
|
1593
1614
|
function readEnv(key) {
|
|
@@ -1602,6 +1623,7 @@ var CanaryCodersAI = class {
|
|
|
1602
1623
|
audio;
|
|
1603
1624
|
embeddings;
|
|
1604
1625
|
vision;
|
|
1626
|
+
ocr;
|
|
1605
1627
|
conversations;
|
|
1606
1628
|
agents;
|
|
1607
1629
|
realtime;
|
|
@@ -1634,6 +1656,7 @@ var CanaryCodersAI = class {
|
|
|
1634
1656
|
this.audio = new AudioResource(this.transport, poll);
|
|
1635
1657
|
this.embeddings = new EmbeddingsResource(this.transport, poll);
|
|
1636
1658
|
this.vision = new VisionResource(this.transport, poll);
|
|
1659
|
+
this.ocr = new OcrResource(this.transport, poll);
|
|
1637
1660
|
this.conversations = new ConversationsResource(this.transport, poll);
|
|
1638
1661
|
this.agents = new AgentsResource(this.transport, poll);
|
|
1639
1662
|
this.realtime = new RealtimeResource(this.transport, poll);
|