File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed
Sources/AnyLanguageModel/Models Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -692,6 +692,7 @@ import Foundation
692692 )
693693 }
694694
695+ /// Builds structured-generation defaults while honoring explicit overrides.
695696 private func resolvedStructuredOptions( from options: GenerationOptions ) -> ResolvedGenerationOptions {
696697 var base = legacyDefaults
697698 if let temp = options. temperature {
@@ -880,6 +881,7 @@ import Foundation
880881 return generatedText
881882 }
882883
884+ /// Builds a JSONSchema-informed prompt for structured output.
883885 private func schemaPrompt( for schema: GenerationSchema ) -> String {
884886 let encoder = JSONEncoder ( )
885887 encoder. outputFormatting = [ . prettyPrinted, . sortedKeys]
Original file line number Diff line number Diff line change @@ -389,6 +389,7 @@ import Foundation
389389 )
390390 }
391391
392+ /// Builds MLX parameters tuned for structured generation.
392393 private func toStructuredGenerateParameters( _ options: GenerationOptions ) -> MLXLMCommon . GenerateParameters {
393394 MLXLMCommon . GenerateParameters (
394395 maxTokens: options. maximumResponseTokens,
@@ -664,6 +665,7 @@ import Foundation
664665 return textParts. joined ( separator: " \n " )
665666 }
666667
668+ /// Builds a JSONSchema-informed prompt for structured output.
667669 private func schemaPrompt( for schema: GenerationSchema ) -> String {
668670 let encoder = JSONEncoder ( )
669671 encoder. outputFormatting = [ . prettyPrinted, . sortedKeys]
@@ -736,6 +738,7 @@ import Foundation
736738 return json
737739 }
738740
741+ /// Merges system prompts and schema instructions into a user message.
739742 private func normalizeChatForStructuredGeneration(
740743 _ chat: [ MLXLMCommon . Chat . Message ] ,
741744 schemaPrompt: String ?
You can’t perform that action at this time.
0 commit comments