chore: lower deriver custom instruction cap

This commit is contained in:
adavyas 2026-04-23 15:59:20 -07:00
parent 48052f8fef
commit 630db02cd3
5 changed files with 16 additions and 8 deletions

View File

@ -428,7 +428,7 @@ Examples:
- `DB_CONNECTION_URI` - Database connection string
- `AUTH_JWT_SECRET` - JWT secret key
- `DERIVER_MODEL_CONFIG__TRANSPORT` - Transport for the background deriver
- `DERIVER_MAX_CUSTOM_INSTRUCTIONS_TOKENS` - Explicit prompt budget cap for deriver custom instructions
- `DERIVER_MAX_CUSTOM_INSTRUCTIONS_TOKENS` - Explicit prompt budget cap for deriver custom instructions (maximum supported value: `500`)
- `SUMMARY_MODEL_CONFIG__MODEL` - Summary model override
- `DIALECTIC_LEVELS__low__MODEL_CONFIG__MODEL` - Model for low reasoning level
- `LOG_LEVEL` - Application log level

View File

@ -86,7 +86,7 @@ STALE_SESSION_TIMEOUT_MINUTES = 5
DEDUPLICATE = true
LOG_OBSERVATIONS = false
MAX_INPUT_TOKENS = 23000
MAX_CUSTOM_INSTRUCTIONS_TOKENS = 1024 # Required for non-blank reasoning.custom_instructions; over-limit values fail validation
MAX_CUSTOM_INSTRUCTIONS_TOKENS = 500 # Required for non-blank reasoning.custom_instructions; max supported value is 500
WORKING_REPRESENTATION_MAX_OBSERVATIONS = 100
REPRESENTATION_BATCH_MAX_TOKENS = 1024
FLUSH_ENABLED = false # Bypass batch token threshold, process work immediately

View File

@ -532,7 +532,7 @@ DEFAULT_TTL_SECONDS = 300
[deriver]
ENABLED = true
WORKERS = 1
MAX_CUSTOM_INSTRUCTIONS_TOKENS = 1024
MAX_CUSTOM_INSTRUCTIONS_TOKENS = 500
[deriver.model_config]
transport = "openai"

View File

@ -733,7 +733,7 @@ class DeriverSettings(HonchoSettings):
MAX_INPUT_TOKENS: Annotated[int, Field(default=23000, gt=0, le=23000)] = 23000
MAX_CUSTOM_INSTRUCTIONS_TOKENS: Annotated[
int | None, Field(default=None, gt=0, le=23000)
int | None, Field(default=None, gt=0, le=500)
] = None
# Maximum number of observations to return in working representation

View File

@ -7,6 +7,7 @@ def _make_deriver_settings(
*,
MAX_INPUT_TOKENS: int = 23000,
MAX_CUSTOM_INSTRUCTIONS_TOKENS: int | None = None,
REPRESENTATION_BATCH_MAX_TOKENS: int = 1024,
) -> DeriverSettings:
return DeriverSettings(
MODEL_CONFIG=ConfiguredModelSettings(
@ -15,6 +16,7 @@ def _make_deriver_settings(
),
MAX_INPUT_TOKENS=MAX_INPUT_TOKENS,
MAX_CUSTOM_INSTRUCTIONS_TOKENS=MAX_CUSTOM_INSTRUCTIONS_TOKENS,
REPRESENTATION_BATCH_MAX_TOKENS=REPRESENTATION_BATCH_MAX_TOKENS,
)
@ -29,9 +31,9 @@ def test_effective_custom_instructions_tokens_requires_explicit_limit() -> None:
def test_effective_custom_instructions_tokens_uses_explicit_limit() -> None:
settings = _make_deriver_settings(MAX_CUSTOM_INSTRUCTIONS_TOKENS=2048)
settings = _make_deriver_settings(MAX_CUSTOM_INSTRUCTIONS_TOKENS=500)
assert settings.effective_max_custom_instructions_tokens == 2048
assert settings.effective_max_custom_instructions_tokens == 500
def test_custom_instructions_tokens_cannot_exceed_input_budget() -> None:
@ -40,6 +42,12 @@ def test_custom_instructions_tokens_cannot_exceed_input_budget() -> None:
match=r"MAX_CUSTOM_INSTRUCTIONS_TOKENS.*cannot exceed max deriver input tokens",
):
_make_deriver_settings(
MAX_INPUT_TOKENS=1024,
MAX_CUSTOM_INSTRUCTIONS_TOKENS=2048,
MAX_INPUT_TOKENS=400,
MAX_CUSTOM_INSTRUCTIONS_TOKENS=500,
REPRESENTATION_BATCH_MAX_TOKENS=128,
)
def test_custom_instructions_tokens_cannot_exceed_supported_cap() -> None:
with pytest.raises(ValueError, match="less than or equal to 500"):
_make_deriver_settings(MAX_CUSTOM_INSTRUCTIONS_TOKENS=501)