File size: 1,114 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
33
34
35
36
37
38
from __future__ import annotations

from pathlib import Path

import httpx

from app.config import Settings
from backends.base import OCRResult
from backends.openai_compat import OpenAICompatEmbed, OpenAICompatLLM


class NvidiaLLM(OpenAICompatLLM):
    """vLLM Qwen3.8-27B ADay777 (or other NVIDIA VLM). Thinking off."""

    def __init__(self, settings: Settings, *, client: httpx.Client | None = None) -> None:
        super().__init__(
            settings,
            name="nvidia-vllm",
            accepts_images=settings.llm_accepts_images,
            extra_body={"chat_template_kwargs": {"enable_thinking": False}},
            client=client,
        )


class NvidiaEmbed(OpenAICompatEmbed):
    def __init__(self, settings: Settings, *, client: httpx.Client | None = None) -> None:
        super().__init__(settings, name="nemotron-embed", client=client)


class NvidiaOCR:
    name = "nvidia-ocr"

    def ocr(self, path: Path) -> OCRResult:
        raise NotImplementedError(
            "Nemotron OCR v2 is not in this skill. Use Gemma/Qwen vision extract "
            f"(path={path})."
        )