Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 20 additions & 1 deletion Sources/ModelConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ public struct ModelConfiguration {
"canopylabs/orpheus-arabic-saudi",
"canopylabs/orpheus-v1-english",
"meta-llama/llama-prompt-guard-2-22m",
"meta-llama/llama-prompt-guard-2-86m"
"meta-llama/llama-prompt-guard-2-86m",
"MiniMax-M3",
"MiniMax-M2.7"
]

public static let transcriptionModels = [
Expand Down Expand Up @@ -143,6 +145,23 @@ public struct ModelConfiguration {
includeReasoning: nil,
shouldStripThinkTags: false
)
} else if cleanModel == "minimax-m3" {
// MiniMax-M3 emits an adaptive thinking block; strip reasoning tags so the
// cleaned transcript never contains the model's chain of thought.
return ModelConfig(
maxCompletionTokens: nil,
reasoningEffort: nil,
includeReasoning: nil,
shouldStripThinkTags: true
)
} else if cleanModel == "minimax-m2.7" {
// MiniMax-M2.7 always emits reasoning; strip its think tags from the output.
return ModelConfig(
maxCompletionTokens: nil,
reasoningEffort: nil,
includeReasoning: nil,
shouldStripThinkTags: true
)
} else if cleanModel == "whisper-large-v3" {
return ModelConfig(
maxCompletionTokens: nil,
Expand Down
21 changes: 21 additions & 0 deletions Tests/AppContextServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ struct AppContextServiceTests {
testNonStrippingModelPreservesExistingBehavior()
testDeprecatedGroqModelsAreNotPredefined()
testQwenCleanupDisablesReasoning()
testMiniMaxModelsArePredefinedAndStripThinkTags()
print("AppContextServiceTests passed")
}

Expand Down Expand Up @@ -74,6 +75,26 @@ struct AppContextServiceTests {
expect(config.includeReasoning == false, "Qwen cleanup should exclude reasoning output")
}

private static func testMiniMaxModelsArePredefinedAndStripThinkTags() {
expect(ModelConfiguration.llmModels.contains("MiniMax-M3"), "MiniMax-M3 is missing from the picker")
expect(ModelConfiguration.llmModels.contains("MiniMax-M2.7"), "MiniMax-M2.7 is missing from the picker")

for model in ["MiniMax-M3", "MiniMax-M2.7"] {
let config = ModelConfiguration.config(for: model)
expect(config.shouldStripThinkTags, "MiniMax model should strip think tags: \(model)")
}

let reasoningOutput = """
<think>
Hidden reasoning should never reach the transcript.
</think>
Cleaned transcript text.
"""
let summary = AppContextService.activitySummary(from: reasoningOutput, model: "MiniMax-M3")
expect(summary?.contains("Hidden reasoning") == false, "MiniMax reasoning leaked into summary")
expect(summary?.contains("Cleaned transcript text.") == true, "MiniMax summary dropped the transcript text")
}

Comment on lines +78 to +97

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Cover both MiniMax models in the cleanup assertions.

The loop checks shouldStripThinkTags for both models, but AppContextService.activitySummary runs only for MiniMax-M3. A MiniMax-M2.7 cleanup regression could pass the test. Also assert that reasoningEffort and includeReasoning are nil for both models, because those fields are part of the new configuration contract.

Proposed test adjustment
+        let reasoningOutput = """
+        <think>
+        Hidden reasoning should never reach the transcript.
+        </think>
+        Cleaned transcript text.
+        """
+
         for model in ["MiniMax-M3", "MiniMax-M2.7"] {
             let config = ModelConfiguration.config(for: model)
             expect(config.shouldStripThinkTags, "MiniMax model should strip think tags: \(model)")
-        }
-
-        let reasoningOutput = """
-        <think>
-        Hidden reasoning should never reach the transcript.
-        </think>
-        Cleaned transcript text.
-        """
-        let summary = AppContextService.activitySummary(from: reasoningOutput, model: "MiniMax-M3")
-        expect(summary?.contains("Hidden reasoning") == false, "MiniMax reasoning leaked into summary")
-        expect(summary?.contains("Cleaned transcript text.") == true, "MiniMax summary dropped the transcript text")
+            expect(config.reasoningEffort == nil, "MiniMax model should not set reasoning effort: \(model)")
+            expect(config.includeReasoning == nil, "MiniMax model should not include reasoning: \(model)")
+
+            let summary = AppContextService.activitySummary(from: reasoningOutput, model: model)
+            expect(summary?.contains("Hidden reasoning") == false, "MiniMax reasoning leaked into summary: \(model)")
+            expect(summary?.contains("Cleaned transcript text.") == true, "MiniMax summary dropped transcript text: \(model)")
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
private static func testMiniMaxModelsArePredefinedAndStripThinkTags() {
expect(ModelConfiguration.llmModels.contains("MiniMax-M3"), "MiniMax-M3 is missing from the picker")
expect(ModelConfiguration.llmModels.contains("MiniMax-M2.7"), "MiniMax-M2.7 is missing from the picker")
for model in ["MiniMax-M3", "MiniMax-M2.7"] {
let config = ModelConfiguration.config(for: model)
expect(config.shouldStripThinkTags, "MiniMax model should strip think tags: \(model)")
}
let reasoningOutput = """
<think>
Hidden reasoning should never reach the transcript.
</think>
Cleaned transcript text.
"""
let summary = AppContextService.activitySummary(from: reasoningOutput, model: "MiniMax-M3")
expect(summary?.contains("Hidden reasoning") == false, "MiniMax reasoning leaked into summary")
expect(summary?.contains("Cleaned transcript text.") == true, "MiniMax summary dropped the transcript text")
}
private static func testMiniMaxModelsArePredefinedAndStripThinkTags() {
expect(ModelConfiguration.llmModels.contains("MiniMax-M3"), "MiniMax-M3 is missing from the picker")
expect(ModelConfiguration.llmModels.contains("MiniMax-M2.7"), "MiniMax-M2.7 is missing from the picker")
let reasoningOutput = """
<think>
Hidden reasoning should never reach the transcript.
</think>
Cleaned transcript text.
"""
for model in ["MiniMax-M3", "MiniMax-M2.7"] {
let config = ModelConfiguration.config(for: model)
expect(config.shouldStripThinkTags, "MiniMax model should strip think tags: \(model)")
expect(config.reasoningEffort == nil, "MiniMax model should not set reasoning effort: \(model)")
expect(config.includeReasoning == nil, "MiniMax model should not include reasoning: \(model)")
let summary = AppContextService.activitySummary(from: reasoningOutput, model: model)
expect(summary?.contains("Hidden reasoning") == false, "MiniMax reasoning leaked into summary: \(model)")
expect(summary?.contains("Cleaned transcript text.") == true, "MiniMax summary dropped transcript text: \(model)")
}
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/AppContextServiceTests.swift` around lines 78 - 97, Update
testMiniMaxModelsArePredefinedAndStripThinkTags to run
AppContextService.activitySummary for each MiniMax model, asserting hidden
reasoning is removed and cleaned transcript text remains for both MiniMax-M3 and
MiniMax-M2.7. Within the same model loop, also assert each configuration’s
reasoningEffort and includeReasoning are nil.

private static func expectEqual(_ actual: String?, _ expected: String, file: StaticString = #file, line: UInt = #line) {
expect(actual == expected, "Expected \(expected.debugDescription), got \((actual ?? "nil").debugDescription)", file: file, line: line)
}
Expand Down