Skip to content

Component: Smrt.Chat.Host

Canonical source: SmrtApps/src/Smrt.Chat.Host/README.md (mirrored below)


Smrt.Chat.Host

Overview & Responsibilities

  • Provides the C# “host” layer for chat completion execution (vendor-specific executors and routing).
  • Bridges Smrt.Chat.Core abstractions to concrete vendor implementations (OpenAI-compatible, Anthropic, Google Gemini, Google Vertex AI).
  • Integrates with Smrt.CloudProviders / Smrt.CloudProviders.Contracts for provider selection and configuration.
  • Uses Smrt.Logging for unified, structured logging.

Public Surface / Entry Points

  • Primary entry points are the executor types listed under Key Types below.
  • This project does not define a standalone CLI or UI entry point.

Dependencies & Integrations

  • Smrt.Chat.Core – shared chat domain contracts and orchestration.
  • Smrt.CloudProviders / Smrt.CloudProviders.Contracts – provider routing and contract types.
  • Smrt.Logging – structured logging and diagnostics.

Key Types

  • ChatCompletionExecutorMux – mux/router for selecting the appropriate executor.
  • OpenAiCompatibleChatCompletionExecutor – executor for OpenAI-compatible APIs.
  • AnthropicMessagesChatCompletionExecutor – executor for Anthropic Messages APIs.
  • GoogleGeminiApiChatCompletionExecutor / GoogleVertexAiChatCompletionExecutor – executors for Google models.

Build

  • Use the repo build scripts/tasks; this folder also includes:
  • Build-Smrt.Chat.Host.ps1
  • Clean-Smrt.Chat.Host.ps1

Configuration, Operational Data, and Paths

  • This library provides a shared, non-secret defaults store used by shells (HubWindow, Settings Host) to persist chat routing preferences.
  • ChatQuickSettingsStore persists under the chat config slug (Roaming) via Smrt.Config canonical paths.
  • File name follows the Operational Data Policy pattern (expected: chat-config.json).
  • Consuming host apps must still resolve any other config/state/log paths via Smrt.Config and the Operational Data Policy.
  • Operational data policy: README.Files/System/Policies/SmrtHub-Operational-Data-Policy-v1.0.README.md

Settings keys (canonical source)

Provider executors read non-secret settings from ServiceDescriptor.NonSecretSettings.

Canonical key names and parsing rules are defined in:

  • SmrtApps/src/Smrt.Chat.Host/ChatHostServiceSettings.cs

Provider executor settings (non-secret)

Provider executors read these settings from ServiceDescriptor.NonSecretSettings (per vendor/profile/service). This list mirrors ChatHostServiceSettings.

  • max-output-tokens (int, default 512): Maximum completion/output tokens requested.
  • Legacy alias: max-tokens (int) is also accepted.
  • max-user-message-chars (int, optional): If set, large user messages are chunked into multiple user messages before sending.
  • max-request-bytes (int, optional): If set, throws when the JSON payload exceeds this size.
  • request-timeout-ms (int, default 90000): Per-attempt HTTP request timeout.
  • max-retries (int, default 2): Number of retries for transient failures.
  • retry-base-delay-ms (int, default 250): Base backoff delay.
  • retry-max-delay-ms (int, default 5000): Upper bound for backoff delay.

Observability and Diagnostics

  • Uses Smrt.Logging conventions for structured logs.
  • Providers/executors should emit privacy-safe diagnostics consistent with the platform logging and telemetry policies.

Testing & Validation

  • This project’s behavior is validated via Smrt.Chat.Host.Tests, Smrt.Chat.Core.Tests, and any higher-level integration tests.
  • After changes, run the repo test runner scripts under Tools/Run-Tests/.

Support Bundle

  • Support bundles are collected by host components; this library does not add standalone bundle artifacts.
  • SmrtApps/src/Smrt.Chat.Core/README.md
  • SmrtApps/src/Smrt.Chat.Core.Tests/README.md
  • SmrtApps/src/Smrt.CloudProviders/README.md
  • SmrtApps/src/Smrt.CloudProviders.Contracts/README.md
  • README.Files/Subsystems/Logging/README.md
  • README.Files/Reference-Guides/SmrtHub.Logging.README.md