Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
77a007d
feat: per-model inference parameters with extended thinking support
philmerrell May 1, 2026
19472e5
test: stub getInferenceParamOverrides on ChatRequestService model mock
philmerrell May 1, 2026
15b202a
fix: sanitize user-controlled model_id before logging
philmerrell May 1, 2026
fff7fa5
fix: preserve reasoningContent through session persistence for thinki…
philmerrell May 1, 2026
446232d
Potential fix for pull request finding 'CodeQL / Log Injection'
philmerrell May 2, 2026
14fa858
adjust tests for nightly success.
Apr 30, 2026
366ec7a
chore(deps)(deps): bump the angular group across 1 directory with 10 …
dependabot[bot] May 1, 2026
043a6af
chore(deps)(deps-dev): bump @types/node (#147)
dependabot[bot] May 1, 2026
5d495a8
feat(documents): add XLSX-specific chunker for improved tabular data …
DerrickF May 1, 2026
fa5b897
feat(embeddings): implement batch processing for S3 Vector storage
DerrickF May 1, 2026
8ca8d2e
ci(rag-ingestion): add shared embeddings to workflow path filters
DerrickF May 1, 2026
5f36ff3
feat(documents): improve XLSX header detection to skip title/banner rows
DerrickF May 1, 2026
186bad5
fix(chat): align resume cache key with original turn so paused agent …
philmerrell May 2, 2026
538ab18
fix(costs): coerce cost_delta to a finite Decimal in summary writers …
philmerrell May 2, 2026
2972f57
refactor(inference-params): drop lastTemperature, gate unknown overri…
philmerrell May 2, 2026
66bdfc3
Merge branch 'develop' into feature/per-model-inference-params
philmerrell May 2, 2026
369666a
refactor(models): remove unused isReasoningModel field
philmerrell May 2, 2026
27062ce
Potential fix for pull request finding 'CodeQL / Log Injection'
philmerrell May 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 42 additions & 4 deletions backend/scripts/seed_bootstrap_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,38 @@ def seed_default_quota_assignment(
return result


# Sensible inference-param defaults for general-purpose Claude chat models.
# Temperature 0.7 mirrors the previous always-on default and gives admins a
# starting point they can tighten per-model. Bounds match Anthropic's accepted
# range. max_tokens is supported but left at no-default — the model's own cap
# applies unless an admin explicitly sets one.
CLAUDE_CHAT_SUPPORTED_PARAMS: dict[str, Any] = {
"params": {
"temperature": {
"supported": True,
"min": Decimal("0"),
"max": Decimal("1"),
"default": Decimal("0.7"),
"locked": False,
},
"top_p": {
"supported": True,
"min": Decimal("0"),
"max": Decimal("1"),
"default": None,
"locked": False,
},
"max_tokens": {
"supported": True,
"min": Decimal("1"),
"max": None,
"default": None,
"locked": False,
},
}
}


# Default Bedrock models to seed
DEFAULT_MODELS: list[dict[str, Any]] = [
{
Expand All @@ -190,9 +222,9 @@ def seed_default_quota_assignment(
"outputPricePerMillionTokens": Decimal("5.00"),
"cacheWritePricePerMillionTokens": Decimal("1.25"),
"cacheReadPricePerMillionTokens": Decimal("0.10"),
"isReasoningModel": False,
"supportsCaching": True,
"isDefault": True,
"supportedParams": CLAUDE_CHAT_SUPPORTED_PARAMS,
},
{
"modelId": "global.anthropic.claude-sonnet-4-6",
Expand All @@ -207,9 +239,9 @@ def seed_default_quota_assignment(
"outputPricePerMillionTokens": Decimal("15.00"),
"cacheWritePricePerMillionTokens": Decimal("3.75"),
"cacheReadPricePerMillionTokens": Decimal("0.30"),
"isReasoningModel": False,
"supportsCaching": True,
"isDefault": False,
"supportedParams": CLAUDE_CHAT_SUPPORTED_PARAMS,
},
{
"modelId": "amazon.nova-2-sonic-v1:0",
Expand All @@ -224,9 +256,11 @@ def seed_default_quota_assignment(
"outputPricePerMillionTokens": Decimal("12.00"),
"cacheWritePricePerMillionTokens": Decimal("0"),
"cacheReadPricePerMillionTokens": Decimal("0"),
"isReasoningModel": False,
"supportsCaching": False,
"isDefault": False,
# Voice/bidi model: param shape differs from chat models. Leave
# supportedParams unset so the runtime passes through to whatever
# the BidiAgent path negotiates.
},
]

Expand Down Expand Up @@ -289,13 +323,17 @@ def seed_default_models(
"outputPricePerMillionTokens": model_def["outputPricePerMillionTokens"],
"cacheWritePricePerMillionTokens": model_def["cacheWritePricePerMillionTokens"],
"cacheReadPricePerMillionTokens": model_def["cacheReadPricePerMillionTokens"],
"isReasoningModel": model_def["isReasoningModel"],
"supportsCaching": model_def["supportsCaching"],
"isDefault": model_def["isDefault"],
"createdAt": now,
"updatedAt": now,
}

# Optional: per-model inference parameter capabilities. Stored as a
# nested map; absence means "passthrough" at runtime.
if "supportedParams" in model_def and model_def["supportedParams"] is not None:
item["supportedParams"] = model_def["supportedParams"]

try:
table.put_item(Item=item)
msg = f"Model '{model_def['modelName']}' ({model_id}) created"
Expand Down
26 changes: 20 additions & 6 deletions backend/src/agents/main_agent/base_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(
caching_enabled: Optional[bool] = None,
provider: Optional[str] = None,
max_tokens: Optional[int] = None,
inference_params: Optional[Dict[str, Any]] = None,
skip_persistence: bool = False,
):
"""
Expand All @@ -68,11 +69,14 @@ def __init__(
auth_token: Raw OIDC token for forwarding to external MCP tools (optional)
enabled_tools: List of tool IDs to enable. If None, all tools are enabled.
model_id: Model ID to use (format depends on provider)
temperature: Model temperature (0.0 - 1.0)
temperature: Legacy. Folded into ``inference_params['temperature']`` if set.
system_prompt: System prompt text
caching_enabled: Whether to enable prompt caching (Bedrock only)
provider: LLM provider ("bedrock", "openai", or "gemini")
max_tokens: Maximum tokens to generate (optional)
max_tokens: Legacy. Folded into ``inference_params['max_tokens']`` if set.
inference_params: Canonical-name -> value map for inference params
(temperature, top_p, top_k, max_tokens, thinking, ...). Wins over
the legacy ``temperature``/``max_tokens`` kwargs when both are set.
skip_persistence: If True, don't persist messages (for preview sessions)
"""
# Basic state
Expand All @@ -82,9 +86,20 @@ def __init__(
self.enabled_tools = enabled_tools
self.agent = None

# Initialize model configuration
# Merge legacy temperature/max_tokens into the canonical dict. Explicit
# ``inference_params`` values win over the positional kwargs so callers
# migrating to the new shape get predictable precedence.
resolved_params: Dict[str, Any] = dict(inference_params or {})
if temperature is not None:
resolved_params.setdefault("temperature", temperature)
if max_tokens is not None:
resolved_params.setdefault("max_tokens", max_tokens)

self.model_config = ModelConfig.from_params(
model_id=model_id, temperature=temperature, caching_enabled=caching_enabled, provider=provider, max_tokens=max_tokens
model_id=model_id,
caching_enabled=caching_enabled,
provider=provider,
inference_params=resolved_params,
)

# Frozen snapshot of agent-construction params, used when the turn
Expand All @@ -95,9 +110,8 @@ def __init__(
"enabled_tools": enabled_tools,
"model_id": model_id,
"provider": provider,
"temperature": temperature,
"caching_enabled": caching_enabled,
"max_tokens": max_tokens,
"inference_params": dict(resolved_params),
}

# Load retry configuration from environment variables
Expand Down
1 change: 0 additions & 1 deletion backend/src/agents/main_agent/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ class Defaults:

# --- Model ---
MODEL_ID = "us.anthropic.claude-haiku-4-5-20251001-v1:0"
TEMPERATURE = 0.7
CACHING_ENABLED = True

# --- AWS ---
Expand Down
Loading
Loading