Files
odysseus/src/model_profiles.py
T
pewdiepie-archdaemonandClaude Opus 5.5 364229f2dc feat(harness): authority, turn contract, tools, clean_agent_preview
Chat/agent harness work: request-authority model, turn contract, tool
policy/parsing/execution, clean_agent_preview streaming/thinking, ask_user
persistence, session probes, and scheduler.

Source: vendor/photocraft (ad1cff44) harness files, 3-way merged onto
upstream/dev (a8c147b2). Harness core files were independently developed
in both lineages; resolution policy documented in pr_work/C_conflicts.md
(vendor kept where ahead, upstream kept where vendor is behind; full delta
preserved in pr_work/C_upstream_delta.patch).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 13:41:53 +00:00

63 lines
2.1 KiB
Python

"""Stable runtime profiles for models with Odysseus-specific contracts."""
from pathlib import PurePosixPath
import re
AJAX_C375_MODEL_ID = "ajax_c375"
TRIAL55_BASE_MODEL_ID = "odysseus-qwen3.5-heretic-trial55-base"
GENERIC_TOOL_SCHEMA_PROFILE = "generic"
ODYSSEUS_COMPACT_TOOL_SCHEMA_PROFILE = "odysseus_compact"
_ODYSSEUS_TOOL_PROFILE_TOKEN = re.compile(
r"(?:^|[^a-z0-9])(?:odysseus|ajax)(?:[^a-z0-9]|$)",
re.IGNORECASE,
)
def model_id_leaf(value: object) -> str:
"""Normalize a model id while preserving provider/path aliases."""
normalized = str(value or "").strip().lower().rstrip("/")
return PurePosixPath(normalized).name
def is_odysseus_tool_profile_model(value: object) -> bool:
"""Return whether a model name opts into the Odysseus tool runtime."""
return bool(_ODYSSEUS_TOOL_PROFILE_TOKEN.search(model_id_leaf(value)))
def tool_schema_profile(value: object) -> str:
"""Select the sole schema contract for a model before turn routing."""
if is_odysseus_tool_profile_model(value):
return ODYSSEUS_COMPACT_TOOL_SCHEMA_PROFILE
return GENERIC_TOOL_SCHEMA_PROFILE
def is_odysseus_merged_tools_model(value: object) -> bool:
"""Compatibility alias for the Odysseus tool runtime profile."""
return is_odysseus_tool_profile_model(value)
def uses_odysseus_progressive_thinking(value: object) -> bool:
"""Models whose native Qwen thinking is selected from the turn surface."""
return is_odysseus_tool_profile_model(value)
def supports_user_thinking_toggle(value: object) -> bool:
"""Whether the chat UI may expose an explicit thinking on/off switch."""
leaf = model_id_leaf(value)
if not leaf or uses_odysseus_progressive_thinking(leaf):
return False
if leaf.startswith(("gpt", "o1", "o3", "o4")):
return False
return any(pattern in leaf for pattern in (
"kimi-k2.5", "kimi-k2.6", "kimi-k3",
"qwen3", "qwq", "deepseek-r1", "deepseek-reasoner",
"minimax", "m2-reap", "gemma", "stepfun", "step-3", "step3",
"magistral", "mistral-small", "mistral-medium",
))