File size: 860 Bytes
ae97c5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Configuration for a local Clairic model instance."""

from __future__ import annotations

from dataclasses import dataclass

DEFAULT_MAX_LENGTH = 65_273
MAX_PASS_TOKENS = 65_536


@dataclass(frozen=True, slots=True)
class RuntimeSettings:
    model_path: str
    model_id: str = "clairic-flash"
    max_length: int = DEFAULT_MAX_LENGTH
    max_concurrency: int = 1
    version: str = "1"
    model_aliases: tuple[str, ...] = ()

    def __post_init__(self) -> None:
        if (
            type(self.max_length) is not int
            or not 0 < self.max_length <= DEFAULT_MAX_LENGTH
        ):
            raise ValueError(
                f"max_length must be an integer from 1 to {DEFAULT_MAX_LENGTH}"
            )
        if type(self.max_concurrency) is not int or self.max_concurrency != 1:
            raise ValueError("max_concurrency must be 1")