@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/dist/index.d.cts
CHANGED
|
@@ -989,6 +989,112 @@ declare class VisionResource extends BaseResource {
|
|
|
989
989
|
}>;
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
+
type OcrRecognitionLevel = "fast" | "accurate";
|
|
993
|
+
type OcrGranularity = "line" | "word";
|
|
994
|
+
type RedactStyle = "blur" | "box" | "pixelate";
|
|
995
|
+
type RedactPreset = "email" | "phone" | "iban" | "credit_card" | "dni_nie";
|
|
996
|
+
interface OcrRecognizeParams {
|
|
997
|
+
/** base64-encoded image bytes (max ~50MB); PNG/JPEG/HEIC/TIFF/WebP */
|
|
998
|
+
image: string;
|
|
999
|
+
/** default "accurate" */
|
|
1000
|
+
recognitionLevel?: OcrRecognitionLevel;
|
|
1001
|
+
/** BCP-47 codes; omit for automatic language detection */
|
|
1002
|
+
languages?: string[];
|
|
1003
|
+
/** domain words that bias language correction */
|
|
1004
|
+
customWords?: string[];
|
|
1005
|
+
minConfidence?: number;
|
|
1006
|
+
/** "word" adds per-word boxes; default "line" */
|
|
1007
|
+
granularity?: OcrGranularity;
|
|
1008
|
+
tag?: string;
|
|
1009
|
+
service?: string;
|
|
1010
|
+
}
|
|
1011
|
+
interface OcrWord {
|
|
1012
|
+
text: string;
|
|
1013
|
+
confidence: number;
|
|
1014
|
+
bbox: BoundingBox;
|
|
1015
|
+
}
|
|
1016
|
+
interface OcrLine {
|
|
1017
|
+
text: string;
|
|
1018
|
+
confidence: number;
|
|
1019
|
+
bbox: BoundingBox;
|
|
1020
|
+
/** present at word granularity */
|
|
1021
|
+
words?: OcrWord[];
|
|
1022
|
+
}
|
|
1023
|
+
interface OcrResult {
|
|
1024
|
+
/** all lines joined with \n */
|
|
1025
|
+
text: string;
|
|
1026
|
+
lines: OcrLine[];
|
|
1027
|
+
granularity: string;
|
|
1028
|
+
model: string;
|
|
1029
|
+
provider: string;
|
|
1030
|
+
requestId: string;
|
|
1031
|
+
inferenceTimeMs: number;
|
|
1032
|
+
imageSize: {
|
|
1033
|
+
width: number;
|
|
1034
|
+
height: number;
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
interface RedactParams {
|
|
1038
|
+
/** base64-encoded image bytes (max ~50MB) */
|
|
1039
|
+
image: string;
|
|
1040
|
+
/** explicit pixel regions (top-left origin) to redact without OCR */
|
|
1041
|
+
regions?: BoundingBox[];
|
|
1042
|
+
/** regex patterns matched against recognized text */
|
|
1043
|
+
patterns?: string[];
|
|
1044
|
+
/** built-in PII patterns */
|
|
1045
|
+
presets?: RedactPreset[];
|
|
1046
|
+
/** default "word": redact just the matched substring, whole line as fallback */
|
|
1047
|
+
granularity?: OcrGranularity;
|
|
1048
|
+
/** default "blur"; "box" is the safest for hard PII redaction */
|
|
1049
|
+
style?: RedactStyle;
|
|
1050
|
+
blurStrength?: number;
|
|
1051
|
+
/** hex fill for box style, e.g. "#000000" */
|
|
1052
|
+
fillColor?: string;
|
|
1053
|
+
/** extra pixels around each redacted rect (default 4) */
|
|
1054
|
+
padding?: number;
|
|
1055
|
+
recognitionLevel?: OcrRecognitionLevel;
|
|
1056
|
+
languages?: string[];
|
|
1057
|
+
customWords?: string[];
|
|
1058
|
+
minConfidence?: number;
|
|
1059
|
+
tag?: string;
|
|
1060
|
+
service?: string;
|
|
1061
|
+
}
|
|
1062
|
+
interface RedactionDetection {
|
|
1063
|
+
/** matched text (absent for explicit regions) */
|
|
1064
|
+
text?: string;
|
|
1065
|
+
/** preset name, the regex source, or "explicit_region" */
|
|
1066
|
+
pattern: string;
|
|
1067
|
+
bbox: BoundingBox;
|
|
1068
|
+
lineIndex?: number;
|
|
1069
|
+
granularity: string;
|
|
1070
|
+
}
|
|
1071
|
+
interface RedactResult {
|
|
1072
|
+
/** base64 PNG with redactions applied */
|
|
1073
|
+
redactedImage: string;
|
|
1074
|
+
detections: RedactionDetection[];
|
|
1075
|
+
regionsRedacted: number;
|
|
1076
|
+
counts: Record<string, number>;
|
|
1077
|
+
model: string;
|
|
1078
|
+
provider: string;
|
|
1079
|
+
requestId: string;
|
|
1080
|
+
inferenceTimeMs: number;
|
|
1081
|
+
imageSize: {
|
|
1082
|
+
width: number;
|
|
1083
|
+
height: number;
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
interface OcrLanguages {
|
|
1087
|
+
recognitionLevels: Record<string, string[]>;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
declare class OcrResource extends BaseResource {
|
|
1091
|
+
recognize(params: OcrRecognizeParams, poll?: PollOptions): Promise<OcrResult>;
|
|
1092
|
+
recognizeJob(params: OcrRecognizeParams, signal?: AbortSignal): Promise<Job<OcrResult>>;
|
|
1093
|
+
redact(params: RedactParams, poll?: PollOptions): Promise<RedactResult>;
|
|
1094
|
+
redactJob(params: RedactParams, signal?: AbortSignal): Promise<Job<RedactResult>>;
|
|
1095
|
+
languages(signal?: AbortSignal): Promise<OcrLanguages>;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
992
1098
|
interface CanaryCodersAIOptions {
|
|
993
1099
|
/** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
|
|
994
1100
|
apiKey?: string;
|
|
@@ -1016,6 +1122,7 @@ declare class CanaryCodersAI {
|
|
|
1016
1122
|
readonly audio: AudioResource;
|
|
1017
1123
|
readonly embeddings: EmbeddingsResource;
|
|
1018
1124
|
readonly vision: VisionResource;
|
|
1125
|
+
readonly ocr: OcrResource;
|
|
1019
1126
|
readonly conversations: ConversationsResource;
|
|
1020
1127
|
readonly agents: AgentsResource;
|
|
1021
1128
|
readonly realtime: RealtimeResource;
|
|
@@ -1100,4 +1207,4 @@ interface StreamAdapterOptions extends SSEOptions {
|
|
|
1100
1207
|
|
|
1101
1208
|
// @ts-ignore
|
|
1102
1209
|
export = CanaryCodersAI;
|
|
1103
|
-
export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
|
|
1210
|
+
export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, type OcrGranularity, type OcrLanguages, type OcrLine, type OcrRecognitionLevel, type OcrRecognizeParams, type OcrResult, type OcrWord, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type RedactParams, type RedactPreset, type RedactResult, type RedactStyle, type RedactionDetection, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, toBrokeredCredential };
|
package/dist/index.d.ts
CHANGED
|
@@ -989,6 +989,112 @@ declare class VisionResource extends BaseResource {
|
|
|
989
989
|
}>;
|
|
990
990
|
}
|
|
991
991
|
|
|
992
|
+
type OcrRecognitionLevel = "fast" | "accurate";
|
|
993
|
+
type OcrGranularity = "line" | "word";
|
|
994
|
+
type RedactStyle = "blur" | "box" | "pixelate";
|
|
995
|
+
type RedactPreset = "email" | "phone" | "iban" | "credit_card" | "dni_nie";
|
|
996
|
+
interface OcrRecognizeParams {
|
|
997
|
+
/** base64-encoded image bytes (max ~50MB); PNG/JPEG/HEIC/TIFF/WebP */
|
|
998
|
+
image: string;
|
|
999
|
+
/** default "accurate" */
|
|
1000
|
+
recognitionLevel?: OcrRecognitionLevel;
|
|
1001
|
+
/** BCP-47 codes; omit for automatic language detection */
|
|
1002
|
+
languages?: string[];
|
|
1003
|
+
/** domain words that bias language correction */
|
|
1004
|
+
customWords?: string[];
|
|
1005
|
+
minConfidence?: number;
|
|
1006
|
+
/** "word" adds per-word boxes; default "line" */
|
|
1007
|
+
granularity?: OcrGranularity;
|
|
1008
|
+
tag?: string;
|
|
1009
|
+
service?: string;
|
|
1010
|
+
}
|
|
1011
|
+
interface OcrWord {
|
|
1012
|
+
text: string;
|
|
1013
|
+
confidence: number;
|
|
1014
|
+
bbox: BoundingBox;
|
|
1015
|
+
}
|
|
1016
|
+
interface OcrLine {
|
|
1017
|
+
text: string;
|
|
1018
|
+
confidence: number;
|
|
1019
|
+
bbox: BoundingBox;
|
|
1020
|
+
/** present at word granularity */
|
|
1021
|
+
words?: OcrWord[];
|
|
1022
|
+
}
|
|
1023
|
+
interface OcrResult {
|
|
1024
|
+
/** all lines joined with \n */
|
|
1025
|
+
text: string;
|
|
1026
|
+
lines: OcrLine[];
|
|
1027
|
+
granularity: string;
|
|
1028
|
+
model: string;
|
|
1029
|
+
provider: string;
|
|
1030
|
+
requestId: string;
|
|
1031
|
+
inferenceTimeMs: number;
|
|
1032
|
+
imageSize: {
|
|
1033
|
+
width: number;
|
|
1034
|
+
height: number;
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
interface RedactParams {
|
|
1038
|
+
/** base64-encoded image bytes (max ~50MB) */
|
|
1039
|
+
image: string;
|
|
1040
|
+
/** explicit pixel regions (top-left origin) to redact without OCR */
|
|
1041
|
+
regions?: BoundingBox[];
|
|
1042
|
+
/** regex patterns matched against recognized text */
|
|
1043
|
+
patterns?: string[];
|
|
1044
|
+
/** built-in PII patterns */
|
|
1045
|
+
presets?: RedactPreset[];
|
|
1046
|
+
/** default "word": redact just the matched substring, whole line as fallback */
|
|
1047
|
+
granularity?: OcrGranularity;
|
|
1048
|
+
/** default "blur"; "box" is the safest for hard PII redaction */
|
|
1049
|
+
style?: RedactStyle;
|
|
1050
|
+
blurStrength?: number;
|
|
1051
|
+
/** hex fill for box style, e.g. "#000000" */
|
|
1052
|
+
fillColor?: string;
|
|
1053
|
+
/** extra pixels around each redacted rect (default 4) */
|
|
1054
|
+
padding?: number;
|
|
1055
|
+
recognitionLevel?: OcrRecognitionLevel;
|
|
1056
|
+
languages?: string[];
|
|
1057
|
+
customWords?: string[];
|
|
1058
|
+
minConfidence?: number;
|
|
1059
|
+
tag?: string;
|
|
1060
|
+
service?: string;
|
|
1061
|
+
}
|
|
1062
|
+
interface RedactionDetection {
|
|
1063
|
+
/** matched text (absent for explicit regions) */
|
|
1064
|
+
text?: string;
|
|
1065
|
+
/** preset name, the regex source, or "explicit_region" */
|
|
1066
|
+
pattern: string;
|
|
1067
|
+
bbox: BoundingBox;
|
|
1068
|
+
lineIndex?: number;
|
|
1069
|
+
granularity: string;
|
|
1070
|
+
}
|
|
1071
|
+
interface RedactResult {
|
|
1072
|
+
/** base64 PNG with redactions applied */
|
|
1073
|
+
redactedImage: string;
|
|
1074
|
+
detections: RedactionDetection[];
|
|
1075
|
+
regionsRedacted: number;
|
|
1076
|
+
counts: Record<string, number>;
|
|
1077
|
+
model: string;
|
|
1078
|
+
provider: string;
|
|
1079
|
+
requestId: string;
|
|
1080
|
+
inferenceTimeMs: number;
|
|
1081
|
+
imageSize: {
|
|
1082
|
+
width: number;
|
|
1083
|
+
height: number;
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
interface OcrLanguages {
|
|
1087
|
+
recognitionLevels: Record<string, string[]>;
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
declare class OcrResource extends BaseResource {
|
|
1091
|
+
recognize(params: OcrRecognizeParams, poll?: PollOptions): Promise<OcrResult>;
|
|
1092
|
+
recognizeJob(params: OcrRecognizeParams, signal?: AbortSignal): Promise<Job<OcrResult>>;
|
|
1093
|
+
redact(params: RedactParams, poll?: PollOptions): Promise<RedactResult>;
|
|
1094
|
+
redactJob(params: RedactParams, signal?: AbortSignal): Promise<Job<RedactResult>>;
|
|
1095
|
+
languages(signal?: AbortSignal): Promise<OcrLanguages>;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
992
1098
|
interface CanaryCodersAIOptions {
|
|
993
1099
|
/** API key. Defaults to `process.env.CANARY_AI_API_KEY` (legacy `CANARYLLM_API_KEY` still read). */
|
|
994
1100
|
apiKey?: string;
|
|
@@ -1016,6 +1122,7 @@ declare class CanaryCodersAI {
|
|
|
1016
1122
|
readonly audio: AudioResource;
|
|
1017
1123
|
readonly embeddings: EmbeddingsResource;
|
|
1018
1124
|
readonly vision: VisionResource;
|
|
1125
|
+
readonly ocr: OcrResource;
|
|
1019
1126
|
readonly conversations: ConversationsResource;
|
|
1020
1127
|
readonly agents: AgentsResource;
|
|
1021
1128
|
readonly realtime: RealtimeResource;
|
|
@@ -1098,4 +1205,4 @@ interface StreamAdapterOptions extends SSEOptions {
|
|
|
1098
1205
|
includeRaw?: boolean;
|
|
1099
1206
|
}
|
|
1100
1207
|
|
|
1101
|
-
export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryCodersAI as default, toBrokeredCredential };
|
|
1208
|
+
export { APIConnectionError, APIConnectionTimeoutError, APIError, type ApiEnvelope, type AudioOutputFormat, AuthenticationError, type AutoLabelParams, type AutoLabelResult, type AutoTrainParams, BadRequestError, type BoundingBox, BrokeredCredential, CanaryCodersAI, type CanaryCodersAIOptions, CanaryCodersAI as CanaryLLM, type CanaryCodersAIOptions as CanaryLLMOptions, type ChatProvider, type ChatStreamEvent, type ChatStreamOptions, type Citation, CompatTarget, type CompleteParams, type CompletionResult, ConflictError, type ContentPart, type ConversationQuestion, type ConversationSession, type ConversationSessionRecord, type ConversationTemplate, type ConversationTemplateParams, type ConversationTemplateType, type ConversationTemplateUpdate, type ConversationTool, type ConversationVoiceSettings, type CreateConversationSessionParams, CreateRealtimeSessionParams, type DetectParams, type Detection, type DialogueInput, type DialogueParams, type DialogueResult, type DocumentContent, type EmbeddingParams, type EmbeddingResult, type FaceDetectParams, type FaceDetectionResult, FinalizeRealtimeParams, type GeneratedImage, type GeneratedVideo, type ImageContent, type ImageGenerateParams, type ImageGenerationResult, type ImageRecognitionResult, InternalServerError, Job, type JobSnapshot, type JobStatus, type JobStreamOptions, type KeyInfo, type KeyValidation, type Message, type MessageContent, type MessageRole, type ModelCapability, type ModelInfo, type MusicParams, type MusicResult, NotFoundError, type OcrGranularity, type OcrLanguages, type OcrLine, type OcrRecognitionLevel, type OcrRecognizeParams, type OcrResult, type OcrWord, PermissionError, type PollOptions, type PortalPeriod, type ProviderType, RateLimitError, RealtimeSession, RealtimeSessionRecord, type RedactParams, type RedactPreset, type RedactResult, type RedactStyle, type RedactionDetection, type ResponseFormat, type STTResult, type SignedUrlParams, type SignedUrlResult, type SoundEffectParams, type SoundEffectResult, type SpeechParams, type StreamAdapterOptions, type StreamChunk, type StreamProtocol, type TTSResult, type TaskKind, type TextContent, type ThinkingMode, type TokenUsage, type ToolCall, type ToolCallDelta, type ToolChoice, type ToolDefinition, type TrainParams, type TrainingJob, type TranscribeParams, type TranscriptWord, UnprocessableEntityError, type UsageSummary, type VideoContent, type VideoGenerateParams, type VideoGenerationResult, type VideoUploadOptions, type VideoUploadResult, type VisionModel, type VoiceInfo, type VoiceSettings, type WebDetectParams, type WebDetectionResult, type WebEntity, type WebSearchOptions, type ZeroShotDetectParams, CanaryCodersAI as default, toBrokeredCredential };
|
package/dist/index.js
CHANGED
|
@@ -1584,6 +1584,27 @@ var VisionResource = class extends BaseResource {
|
|
|
1584
1584
|
}
|
|
1585
1585
|
};
|
|
1586
1586
|
|
|
1587
|
+
// src/resources/ocr.ts
|
|
1588
|
+
var OcrResource = class extends BaseResource {
|
|
1589
|
+
recognize(params, poll) {
|
|
1590
|
+
return this.runQueued("/api/ocr/recognize", params, "vision", poll);
|
|
1591
|
+
}
|
|
1592
|
+
recognizeJob(params, signal) {
|
|
1593
|
+
return this.submitQueued("/api/ocr/recognize", params, "vision", signal);
|
|
1594
|
+
}
|
|
1595
|
+
redact(params, poll) {
|
|
1596
|
+
return this.runQueued("/api/ocr/redact", params, "vision", poll);
|
|
1597
|
+
}
|
|
1598
|
+
redactJob(params, signal) {
|
|
1599
|
+
return this.submitQueued("/api/ocr/redact", params, "vision", signal);
|
|
1600
|
+
}
|
|
1601
|
+
async languages(signal) {
|
|
1602
|
+
return this.transport.json("GET", "/api/ocr/languages", {
|
|
1603
|
+
signal
|
|
1604
|
+
});
|
|
1605
|
+
}
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1587
1608
|
// src/client.ts
|
|
1588
1609
|
var DEFAULT_BASE_URL = "https://api.ai.canarycoders.es";
|
|
1589
1610
|
function readEnv(key) {
|
|
@@ -1598,6 +1619,7 @@ var CanaryCodersAI = class {
|
|
|
1598
1619
|
audio;
|
|
1599
1620
|
embeddings;
|
|
1600
1621
|
vision;
|
|
1622
|
+
ocr;
|
|
1601
1623
|
conversations;
|
|
1602
1624
|
agents;
|
|
1603
1625
|
realtime;
|
|
@@ -1630,6 +1652,7 @@ var CanaryCodersAI = class {
|
|
|
1630
1652
|
this.audio = new AudioResource(this.transport, poll);
|
|
1631
1653
|
this.embeddings = new EmbeddingsResource(this.transport, poll);
|
|
1632
1654
|
this.vision = new VisionResource(this.transport, poll);
|
|
1655
|
+
this.ocr = new OcrResource(this.transport, poll);
|
|
1633
1656
|
this.conversations = new ConversationsResource(this.transport, poll);
|
|
1634
1657
|
this.agents = new AgentsResource(this.transport, poll);
|
|
1635
1658
|
this.realtime = new RealtimeResource(this.transport, poll);
|