Skip to content

Index

diapason.core

Core module — registries, types, configuration, and event bus.

AgentRegistry

Bases: RegistryBase[Type['BaseAgent']]

Registry for agent implementations.

Conversation dataclass

Ordered list of messages with an optional sliding-window cap.

add(message)

Append a message, trimming oldest if max_messages is set.

window(n)

Return the last n messages.

EngineRegistry

Bases: RegistryBase[Type['InferenceEngine']]

Registry for inference engine backends.

MemoryRegistry

Bases: RegistryBase[Type['MemoryBackend']]

Registry for memory / retrieval backends.

Message dataclass

A single chat message (OpenAI-compatible structure).

text property

Return message content as text, treating None as empty.

ModelRegistry

Bases: RegistryBase[Any]

Registry for ModelSpec objects.

ModelSpec dataclass

Metadata describing a language model.

Quantization

Bases: str, Enum

Model quantization formats.

Role

Bases: str, Enum

Chat message roles (OpenAI-compatible).

TelemetryRecord dataclass

Single telemetry observation recorded after an inference call.

ToolCall dataclass

A single tool invocation request embedded in an assistant message.

ToolRegistry

Bases: RegistryBase[Any]

Registry for tool specifications.

ToolResult dataclass

Result returned by a tool invocation.

get_python_executable()

Return the best python interpreter name on PATH.

Prefers python3 (Linux/macOS convention); falls back to python (Windows / some minimal Linux distros that ship only python). Returns the literal string "python3" when neither is found, so callers still get a usable command that will fail with a clear "command not found" rather than an empty string.

The result is a command name or absolute path that callers can hand to :mod:subprocess directly when shell=False, and must be shell-quoted (:func:shlex.quote) before being interpolated into a shell=True command string — paths on Windows often contain spaces.

open_browser(url)

Open url in the user's default browser, with a Windows fast-path.

:func:webbrowser.open is the cross-platform default, but on Windows it sometimes blocks or fails inside a console host. cmd /c start "" "URL" is the canonical Windows incantation that hands the URL to the OS shell and returns immediately. We try that first on Windows and fall back to :func:webbrowser.open if the subprocess spawn fails.