Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Dependencies #41

Merged
merged 6 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
14 changes: 7 additions & 7 deletions HealthGPT.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1012,39 +1012,39 @@
repositoryURL = "https://github.com/StanfordSpezi/Spezi.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.2.0;
minimumVersion = 1.8.0;
};
};
27859C022A34F16A00397C85 /* XCRemoteSwiftPackageReference "SpeziHealthKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziHealthKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.5.0;
minimumVersion = 0.6.0;
};
};
27859C052A34F17800397C85 /* XCRemoteSwiftPackageReference "SpeziOnboarding" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziOnboarding.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.1.0;
minimumVersion = 1.2.2;
};
};
27859C0E2A34F1A900397C85 /* XCRemoteSwiftPackageReference "SpeziStorage" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziStorage.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.2;
minimumVersion = 1.2.1;
};
};
27859C1E2A34F2BF00397C85 /* XCRemoteSwiftPackageReference "XCTestExtensions" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordBDHG/XCTestExtensions.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.4.7;
minimumVersion = 1.1.0;
};
};
27859C232A34F2D000397C85 /* XCRemoteSwiftPackageReference "XCTHealthKit" */ = {
Expand All @@ -1060,15 +1060,15 @@
repositoryURL = "https://github.com/StanfordBDHG/XCTRuntimeAssertions.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.1;
minimumVersion = 1.1.3;
};
};
63439A4C2BA6069E008BDBFD /* XCRemoteSwiftPackageReference "SpeziLLM" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/StanfordSpezi/SpeziLLM";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.8.1;
minimumVersion = 0.9.0;
};
};
/* End XCRemoteSwiftPackageReference section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,75 +2,102 @@
"originHash" : "763dd6c3fb283cd30c2edd3e18fad0c0f9ef9fb226c4b08bdd490e0a7de07181",
"pins" : [
{
"identity" : "llama.cpp",
"identity" : "gzipswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/llama.cpp",
"location" : "https://github.com/1024jp/GzipSwift",
"state" : {
"revision" : "6839853a321778906e210a33ee2c6aec52f34c97",
"version" : "0.3.3"
"revision" : "731037f6cc2be2ec01562f6597c1d0aa3fe6fd05",
"version" : "6.0.1"
}
},
{
"identity" : "jinja",
"kind" : "remoteSourceControl",
"location" : "https://github.com/maiqingqiang/Jinja",
"state" : {
"revision" : "6dbe4c449469fb586d0f7339f900f0dd4d78b167",
"version" : "1.0.6"
}
},
{
"identity" : "mlx-swift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ml-explore/mlx-swift",
"state" : {
"revision" : "70dbb62128a5a1471a5ab80363430adb33470cab",
"version" : "0.21.2"
}
},
{
"identity" : "mlx-swift-examples",
"kind" : "remoteSourceControl",
"location" : "https://github.com/ml-explore/mlx-swift-examples",
"state" : {
"revision" : "7baf9bc2d7a2b68b4bfcae308e448ec68b8ef049",
"version" : "1.18.1"
}
},
{
"identity" : "openai",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/OpenAI",
"state" : {
"revision" : "29316babb446c34bb07bf528d96de7eb41e7b03c",
"version" : "0.2.8"
"revision" : "1ad95dd531d7c854a3f98f588b0eb68fa83e8a8c",
"version" : "0.2.9"
}
},
{
"identity" : "spezi",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/Spezi.git",
"state" : {
"revision" : "c43e4fa3d3938a847de2b677091a34ddaea5bc76",
"version" : "1.2.3"
"revision" : "4513a697572e8e1faea1e0ee52e6fad4b8d3dd8d",
"version" : "1.8.0"
}
},
{
"identity" : "spezichat",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziChat",
"state" : {
"revision" : "aaa10d71431b78ece8bf29f95c0050632714984d",
"version" : "0.2.0"
"revision" : "940ffbec504849968305d9f956344a4f35b6cd48",
"version" : "0.2.1"
}
},
{
"identity" : "spezifoundation",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziFoundation",
"state" : {
"revision" : "01af5b91a54f30ddd121258e81aff2ddc2a99ff9",
"version" : "1.0.4"
"revision" : "5b4ad1b343154b52a68c33a6bfe02d9cb07cb9dc",
"version" : "2.0.0"
}
},
{
"identity" : "spezihealthkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziHealthKit.git",
"state" : {
"revision" : "1e9cb5a6036ac7f4ff37ea1c3ed4898103339ad1",
"version" : "0.5.3"
"revision" : "fbdec78fcb2f90d6338f1968e21dd11fbee65070",
"version" : "0.6.0"
}
},
{
"identity" : "spezillm",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziLLM",
"state" : {
"revision" : "94f14f6a1d0fb4c7bb54efa6b6241f18dfc5004d",
"version" : "0.8.2"
"revision" : "fd9f1cacb19199576656db4c4dd0c81923b3597a",
"version" : "0.9.0"
}
},
{
"identity" : "spezionboarding",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziOnboarding.git",
"state" : {
"revision" : "4971a82e94996ce0c3d8ecf64fdeec874a1f20d6",
"version" : "1.1.1"
"revision" : "a3d7bc15e6803b2205eb8dca010a48b1a40215be",
"version" : "1.2.2"
}
},
{
Expand All @@ -87,8 +114,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordSpezi/SpeziStorage.git",
"state" : {
"revision" : "b958df9b31f24800388a7bfc28f457ce7b82556c",
"version" : "1.0.2"
"revision" : "0f4a54430e51f82d29da63a7ce5f61bad7dfb9cd",
"version" : "1.2.1"
}
},
{
Expand All @@ -100,22 +127,58 @@
"version" : "1.3.1"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "41982a3656a71c768319979febd796c6fd111d5c",
"version" : "1.5.0"
}
},
{
"identity" : "swift-atomics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-atomics.git",
"state" : {
"revision" : "cd142fd2f64be2100422d658e7411e39489da985",
"version" : "1.2.0"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections.git",
"state" : {
"revision" : "94cf62b3ba8d4bed62680a282d4c25f9c63c2efb",
"version" : "1.1.0"
"revision" : "671108c96644956dddcd89dd59c203dcdb36cec7",
"version" : "1.1.4"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-numerics",
"state" : {
"revision" : "0a5bc04095a675662cf24757cc0640aa2204253b",
"version" : "1.0.2"
}
},
{
"identity" : "swift-transformers",
"kind" : "remoteSourceControl",
"location" : "https://github.com/huggingface/swift-transformers",
"state" : {
"revision" : "d42fdae473c49ea216671da8caae58e102d28709",
"version" : "0.1.14"
}
},
{
"identity" : "xctestextensions",
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTestExtensions.git",
"state" : {
"revision" : "1fe9b8e76aeb7a132af37bfa0892160c9b662dcc",
"version" : "0.4.10"
"revision" : "5379d70249cae926927105bfb6686770f03ee5b9",
"version" : "1.1.0"
}
},
{
Expand All @@ -132,8 +195,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/StanfordBDHG/XCTRuntimeAssertions.git",
"state" : {
"revision" : "51da3403f128b120705571ce61e0fe190f8889e6",
"version" : "1.0.1"
"revision" : "f560ec8410af032dd485ca9386e8c2b5d3e1a1f8",
"version" : "1.1.3"
}
}
],
Expand Down
9 changes: 6 additions & 3 deletions HealthGPT/HealthGPT/HealthDataInterpreter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

@Observable
class HealthDataInterpreter: DefaultInitializable, Module, EnvironmentAccessible {
@ObservationIgnored @Dependency private var llmRunner: LLMRunner
@ObservationIgnored @Dependency private var healthDataFetcher: HealthDataFetcher
@ObservationIgnored @Dependency(LLMRunner.self) private var llmRunner
@ObservationIgnored @Dependency(HealthDataFetcher.self) private var healthDataFetcher

var llm: (any LLMSession)?
@ObservationIgnored private var systemPrompt = ""
Expand All @@ -32,10 +32,13 @@
///
/// - Parameter schema: the LLMSchema to use
@MainActor
func prepareLLM(with schema: any LLMSchema) async {
func prepareLLM(with schema: any LLMSchema) async throws {
let llm = llmRunner(with: schema)
systemPrompt = await generateSystemPrompt()
llm.context.append(systemMessage: systemPrompt)
if let localLLM = llm as? LLMLocalSession {
try await localLLM.setup()

Check warning on line 40 in HealthGPT/HealthGPT/HealthDataInterpreter.swift

View check run for this annotation

Codecov / codecov/patch

HealthGPT/HealthGPT/HealthDataInterpreter.swift#L40

Added line #L40 was not covered by tests
}
self.llm = llm
}

Expand Down
20 changes: 11 additions & 9 deletions HealthGPT/HealthGPT/HealthGPTView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@
Text(errorMessage)
}
.task {
if FeatureFlags.mockMode {
await healthDataInterpreter.prepareLLM(with: LLMMockSchema())
} else if FeatureFlags.localLLM || llmSource == .local {
await healthDataInterpreter.prepareLLM(with: LLMLocalSchema(
modelPath: .cachesDirectory.appending(path: "llm.gguf"),
formatChat: LLMLocalSchema.PromptFormattingDefaults.llama3
))
} else {
await healthDataInterpreter.prepareLLM(with: LLMOpenAISchema(parameters: .init(modelType: openAIModel)))
do {
if FeatureFlags.mockMode {
try await healthDataInterpreter.prepareLLM(with: LLMMockSchema())
} else if FeatureFlags.localLLM || llmSource == .local {
try await healthDataInterpreter.prepareLLM(with: LLMLocalSchema(model: .llama3_8B_4bit))
} else {
try await healthDataInterpreter.prepareLLM(with: LLMOpenAISchema(parameters: .init(modelType: openAIModel)))

Check warning on line 77 in HealthGPT/HealthGPT/HealthGPTView.swift

View check run for this annotation

Codecov / codecov/patch

HealthGPT/HealthGPT/HealthGPTView.swift#L75-L77

Added lines #L75 - L77 were not covered by tests
}
} catch {
showErrorAlert = true
errorMessage = "Error querying LLM: \(error.localizedDescription)"

Check warning on line 81 in HealthGPT/HealthGPT/HealthGPTView.swift

View check run for this annotation

Codecov / codecov/patch

HealthGPT/HealthGPT/HealthGPTView.swift#L80-L81

Added lines #L80 - L81 were not covered by tests
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions HealthGPT/HealthGPT/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@
case .openAIModelSelection:
LLMOpenAIModelOnboardingStep(
actionText: "OPEN_AI_MODEL_SAVE_ACTION",
models: [.gpt3_5Turbo, .gpt4, .gpt4_turbo_preview]
models: [.gpt3_5Turbo, .gpt4, .gpt4_o]
) { model in
Task {
openAIModel = model
await healthDataInterpreter.prepareLLM(with: LLMOpenAISchema(parameters: .init(modelType: model)))
try? await healthDataInterpreter.prepareLLM(with: LLMOpenAISchema(parameters: .init(modelType: model)))

Check warning on line 109 in HealthGPT/HealthGPT/SettingsView.swift

View check run for this annotation

Codecov / codecov/patch

HealthGPT/HealthGPT/SettingsView.swift#L109

Added line #L109 was not covered by tests
path.removeLast()
}
}
Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/Helper/CodableArray+RawRepresentable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation


extension Array: RawRepresentable where Element: Codable {
extension Array: @retroactive RawRepresentable where Element: Codable {
public var rawValue: String {
guard let data = try? JSONEncoder().encode(self),
let rawValue = String(data: data, encoding: .utf8) else {
Expand Down
5 changes: 2 additions & 3 deletions HealthGPT/Onboarding/LLMLocalDownload.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ struct LLMLocalDownload: View {

var body: some View {
LLMLocalDownloadView(
downloadDescription: "LLAMA3_DOWNLOAD_DESCRIPTION",
llmDownloadUrl: LLMLocalDownloadManager.LLMUrlDefaults.llama3InstructModelUrl,
llmStorageUrl: .cachesDirectory.appending(path: "llm.gguf")
model: .llama3_8B_4bit,
downloadDescription: "LLAMA3_DOWNLOAD_DESCRIPTION"
) {
onboardingNavigationPath.nextStep()
}
Expand Down
2 changes: 1 addition & 1 deletion HealthGPT/Onboarding/OpenAIModelSelection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct OpenAIModelSelection: View {
var body: some View {
LLMOpenAIModelOnboardingStep(
actionText: "OPEN_AI_MODEL_SAVE_ACTION",
models: [.gpt3_5Turbo, .gpt4, .gpt4_turbo_preview]
models: [.gpt3_5Turbo, .gpt4, .gpt4_o]
) { model in
openAIModel = model
onboardingNavigationPath.nextStep()
Expand Down
2 changes: 2 additions & 0 deletions HealthGPT/Supporting Files/HealthGPT.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<array/>
<key>com.apple.developer.healthkit.background-delivery</key>
<true/>
<key>com.apple.developer.kernel.increased-memory-limit</key>
<true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion HealthGPTUITests/HealthGPTViewUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ final class HealthGPTViewUITests: XCTestCase {

XCTAssert(app.buttons["Record Message"].waitForExistence(timeout: 2))

try app.textViews["Message Input Textfield"].enter(value: "New Message!", dismissKeyboard: false)
try app.textFields["Message Input Textfield"].enter(value: "New Message!")

XCTAssert(app.buttons["Send Message"].waitForExistence(timeout: 2))
app.buttons["Send Message"].tap()
Expand Down
Loading