-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
59 lines (44 loc) · 1.57 KB
/
Copy pathconfig.py
File metadata and controls
59 lines (44 loc) · 1.57 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Allowlist, caps and parse prompt — edit models here, not in adapters."""
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from dotenv import load_dotenv
# Repo root: backend/app/config.py -> ../../
_ROOT = Path(__file__).resolve().parents[2]
load_dotenv(_ROOT / ".env")
HF_TOKEN: str = os.getenv("HF_TOKEN", "")
MAX_PAGES: int = 8
DEFAULT_DPI: int = 150
PAGE_TIMEOUT_S: int = 60
CORS_ORIGINS: list[str] = [
"http://localhost:5173",
"http://127.0.0.1:5173",
]
PARSE_PROMPT_VERSION = "v1"
PARSE_PROMPT = """Parse this document page into Markdown.
Rules:
- Preserve reading order (top-to-bottom, left-to-right for multi-column).
- Represent tables as GitHub-flavored Markdown pipe tables.
- Use # / ## / ### for section headings found in the document.
- Keep numbers as written in the source (do not convert currency).
- Do not invent content that is not visible.
- Output only Markdown, no preamble."""
@dataclass(frozen=True)
class ModelSpec:
id: str
label: str
# Seed allowlist — verified with current HF provider entitlements.
# google/gemma-3-4b-it returns model_not_supported for this account now.
MODELS: list[ModelSpec] = [
ModelSpec(id="google/gemma-3-12b-it", label="Gemma 3 12B IT"),
ModelSpec(id="google/gemma-4-26B-A4B-it", label="Gemma 4 26B A4B IT"),
]
DEFAULT_MODEL_ID: str = MODELS[0].id
def model_ids() -> set[str]:
return {m.id for m in MODELS}
def get_model(model_id: str) -> ModelSpec | None:
for m in MODELS:
if m.id == model_id:
return m
return None