File size: 778 Bytes
2edb151
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from __future__ import annotations

from pathlib import Path

from backends.base import InputType, OCRResult


class _Stub:
    name = "apple"

    def health(self) -> bool:
        return False


class AppleLLM(_Stub):
    accepts_images = True

    def complete_json(self, *, system: str, user: str, image_jpeg: bytes | None = None) -> str:
        raise NotImplementedError("Apple Vision / Foundation Models backend is Phase 2.")


class AppleEmbed(_Stub):
    dim = 0

    def embed(self, texts: list[str], *, input_type: InputType) -> list[list[float]]:
        raise NotImplementedError("Apple embed backend is Phase 2.")


class AppleOCR(_Stub):
    def ocr(self, path: Path) -> OCRResult:
        raise NotImplementedError(f"Apple Vision OCR is Phase 2 (path={path}).")