judgevet.domain.provider_profiles
Status: draft.
judgevet.domain.provider_profiles
Check a request against the documented limits of one compatible server.
A provider profile records the question limits a server documents. The Jev
API has no 26-option maximum, so a profile is opt-in. A caller passes one to
the hosted adapter or the fakes. check_profile refuses a breach before any
request. The refusal names the question key and the profile, never the
criteria text or the option labels.
Attributes:
| Name | Type | Description |
|---|---|---|
OLLAMA_PROFILE |
ProviderProfile
|
Ollama's |
Examples:
from judgevet.domain.provider_errors import ProviderRequestError
from judgevet.domain.provider_profiles import OLLAMA_PROFILE, check_profile
from judgevet.domain.questions import Choice
check_profile({"queue": Choice(criteria={"a": "A", "b": "B"})}, OLLAMA_PROFILE)
try:
check_profile({"queue": Choice(criteria={"a": "A"})}, OLLAMA_PROFILE)
except ProviderRequestError as exc:
assert "'ollama'" in str(exc)
else:
raise AssertionError("a one-option Choice must raise")
See Also
- judgevet.domain.questions: The Choice and Score questions it checks
- judgevet.domain.provider_errors.ProviderRequestError: The refusal
- judgevet.domain.choice_options: The key truncation it follows
OLLAMA_PROFILE = ProviderProfile(name='ollama', choice_options=(2, 26), score_levels=(2, 26), text_criteria_only=True, source_url='https://docs.ollama.com/api/systemone', verified_version='v0.35.1')
module-attribute
Ollama's decision-model limits: 2 to 26 options and levels, text only.
ProviderProfile
dataclass
The documented question limits of one compatible server.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
The profile name the refusal message carries. |
choice_options |
tuple[int, int]
|
Inclusive minimum and maximum number of Choice options. |
score_levels |
tuple[int, int]
|
Inclusive minimum and maximum number of Score levels. |
text_criteria_only |
bool
|
True when every Choice or Score description must be text. A Choice label with no description passes. |
source_url |
str
|
The page that documents the limits. |
verified_version |
str
|
The server version a call verified. |
Examples:
profile = ProviderProfile("demo", (2, 4), (2, 4), False, "https://x", "v1")
assert profile.choice_options == (2, 4)
check_profile(questions, profile)
Refuse a Choice or Score question that breaks the profile's limits.
Typed and raw questions are checked. Noul questions, instructions and raw questions without countable criteria go unchecked. A None profile checks nothing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
questions
|
Mapping[str, Any]
|
Question names mapped to typed or raw questions. |
required |
profile
|
ProviderProfile | None
|
The server profile, or None for no check. |
required |
Raises:
| Type | Description |
|---|---|
ProviderRequestError
|
If a Choice option count or a Score level count is outside the profile's range, or a description is not text under a text-only profile. The message names the question key, truncated to 80 characters, and the profile name only. |