[codex] Add LLM capability snapshot dispatch#955
Draft
mimeding wants to merge 1 commit into
Draft
Conversation
9791311 to
270e20f
Compare
This was referenced Apr 27, 2026
798fc7f to
6d294ba
Compare
ce1cac4 to
c8e6dec
Compare
Business rationale: model routing and prompt/tool decisions are part of the Osaurus harness, and users need them to stay consistent across local, Foundation, and remote providers without each call site guessing differently. Coding rationale: the snapshot centralizes provider, runtime, modality, reasoning, tool, and context traits in one value type; ChatEngine and ModelService consume that contract instead of ad hoc checks, while tests pin both service dispatch and provider mapping including Azure OpenAI. Co-authored-by: Michael Meding <mmeding@Michaels-Mac-Studio.local>
c8e6dec to
09fff95
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Business rationale
Model routing, prompt budgeting, tool availability, and provider request behavior are part of the Osaurus harness: users benefit when a model's real capabilities are explicit instead of inferred by scattered string checks. This snapshot gives local MLX, Apple Foundation Models, OpenAI-compatible providers, Azure OpenAI, Anthropic, Gemini, Codex, and Osaurus providers one inspectable contract for runtime kind, modalities, reasoning, tool use, streaming, and context behavior.
Coding rationale
The capability value lives in configuration models so it can be shared by routing, request construction, UI gating, and tests without pulling service state into view code.
ChatEngineresolves the snapshot after the effective service/model pair is known, which avoids guessing before fallback routing has settled.ModelServicereceives the snapshot throughGenerationParameters, keeping later adapter pruning and diagnostics on the same path for streaming and non-streaming calls. Tests cover provider mapping, model-profile hints, Azure OpenAI compatibility, and dispatch propagation so future provider additions have a clear contract to extend.What changed
LLMCapabilitySnapshot, provider/runtime enums, modality flags, and resolver logic.ChatEnginedispatch intoGenerationParameters.Validation
swift build --package-path Packages/OsaurusCoreswift build --package-path Packages/OsaurusCore -c releaseswift test --package-path Packages/OsaurusCore— 1447 tests in 193 suites passed.xcrun swift-format lint --strict Packages/OsaurusCore/Models/Configuration/LLMCapabilitySnapshot.swift Packages/OsaurusCore/Services/Chat/ChatEngine.swift Packages/OsaurusCore/Services/Inference/ModelService.swift Packages/OsaurusCore/Tests/Chat/ChatEngineTests.swift Packages/OsaurusCore/Tests/Model/LLMCapabilitySnapshotTests.swiftswiftlint lint --strict Packages/OsaurusCore/Models/Configuration/LLMCapabilitySnapshot.swift Packages/OsaurusCore/Services/Chat/ChatEngine.swift Packages/OsaurusCore/Services/Inference/ModelService.swift Packages/OsaurusCore/Tests/Chat/ChatEngineTests.swift Packages/OsaurusCore/Tests/Model/LLMCapabilitySnapshotTests.swiftgit diff --checkNon-scope
Residual risks