diff --git a/Examples/ChatWithFilesExample/ChatWithFilesExample.xcodeproj/project.pbxproj b/Examples/ChatWithFilesExample/ChatWithFilesExample.xcodeproj/project.pbxproj index 9988c5d..e050181 100644 --- a/Examples/ChatWithFilesExample/ChatWithFilesExample.xcodeproj/project.pbxproj +++ b/Examples/ChatWithFilesExample/ChatWithFilesExample.xcodeproj/project.pbxproj @@ -472,7 +472,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.zachnagengast.SimilaritySearchKit.ChatWithFilesExample; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -515,7 +515,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 16.0; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 13.0; + MACOSX_DEPLOYMENT_TARGET = 14.0; MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = com.zachnagengast.SimilaritySearchKit.ChatWithFilesExample; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/Examples/ChatWithFilesExample/ChatWithFilesExample/ChatWithFilesExampleSwiftUIView.swift b/Examples/ChatWithFilesExample/ChatWithFilesExample/ChatWithFilesExampleSwiftUIView.swift index b41694d..a5a4901 100644 --- a/Examples/ChatWithFilesExample/ChatWithFilesExample/ChatWithFilesExampleSwiftUIView.swift +++ b/Examples/ChatWithFilesExample/ChatWithFilesExample/ChatWithFilesExampleSwiftUIView.swift @@ -272,11 +272,7 @@ struct ChatWithFilesExampleSwiftUIView: View { embeddingModel = MultiQAMiniLMEmbeddings() currentTokenizer = BertTokenizer() case .native: - #if canImport(NaturalLanguage.NLContextualEmbedding) embeddingModel = NativeContextualEmbeddings() - #else - embeddingModel = NativeEmbeddings() - #endif currentTokenizer = NativeTokenizer() } diff --git a/Sources/SimilaritySearchKit/Core/Embeddings/Models/NativeContextualEmbeddings.swift b/Sources/SimilaritySearchKit/Core/Embeddings/Models/NativeContextualEmbeddings.swift index e6cdab8..92f01b9 100644 --- a/Sources/SimilaritySearchKit/Core/Embeddings/Models/NativeContextualEmbeddings.swift +++ b/Sources/SimilaritySearchKit/Core/Embeddings/Models/NativeContextualEmbeddings.swift @@ -38,9 +38,16 @@ public class NativeContextualEmbeddings: EmbeddingsProtocol { // Common model initialization logic private static func initializeModel(_ nativeModel: NLContextualEmbedding) { if !nativeModel.hasAvailableAssets { - nativeModel.requestAssets { _, _ in } + nativeModel.requestAssets { result, error in + guard result == .available else { + return + } + + try? nativeModel.load() + } + } else { + try? nativeModel.load() } - try! nativeModel.load() } // MARK: - Dense Embeddings