StanfordBDHG / HealthGPT

Query your Apple Health data with natural language 💬 🩺
MIT License
1.65k stars 150 forks source link

Adds support for on-device LLMs with SpeziLLMLocal #39

Closed vishnuravi closed 1 month ago

vishnuravi commented 3 months ago

Adds support for on-device LLMs with SpeziLLMLocal

:recycle: Current situation & Problem

Currently, the app can only use OpenAI models such as GPT-4. However, users may prefer to run an LLM on-device for increased privacy. This is now supported via the SpeziLLMLocal target of the SpeziLLM module and can be enabled in HealthGPT.

:gear: Release Notes

:books: Documentation

Updated documentation

:white_check_mark: Testing

Code of Conduct & Contributing Guidelines

By submitting creating this pull request, you agree to follow our Code of Conduct and Contributing Guidelines:

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 92.66055% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 92.96%. Comparing base (10b725e) to head (97e0d3d).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39/graphs/tree.svg?width=650&height=150&src=pr&token=5BEldGX6G1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG)](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG) ```diff @@ Coverage Diff @@ ## main #39 +/- ## ========================================== - Coverage 93.03% 92.96% -0.07% ========================================== Files 24 27 +3 Lines 832 922 +90 ========================================== + Hits 774 857 +83 - Misses 58 65 +7 ``` | [Files](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG) | Coverage Δ | | |---|---|---| | [HealthGPT/HealthGPT/HealthDataInterpreter.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FHealthGPT%2FHealthDataInterpreter.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL0hlYWx0aEdQVC9IZWFsdGhEYXRhSW50ZXJwcmV0ZXIuc3dpZnQ=) | `100.00% <100.00%> (ø)` | | | [HealthGPT/HealthGPTAppDelegate.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FHealthGPTAppDelegate.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL0hlYWx0aEdQVEFwcERlbGVnYXRlLnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [HealthGPT/Onboarding/LLMSource.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FOnboarding%2FLLMSource.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL09uYm9hcmRpbmcvTExNU291cmNlLnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [HealthGPT/Onboarding/LLMSourceSelection.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FOnboarding%2FLLMSourceSelection.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL09uYm9hcmRpbmcvTExNU291cmNlU2VsZWN0aW9uLnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [HealthGPT/Onboarding/OpenAIAPIKey.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FOnboarding%2FOpenAIAPIKey.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL09uYm9hcmRpbmcvT3BlbkFJQVBJS2V5LnN3aWZ0) | `100.00% <100.00%> (ø)` | | | [HealthGPTUITests/OnboardingUITests.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPTUITests%2FOnboardingUITests.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUVUlUZXN0cy9PbmJvYXJkaW5nVUlUZXN0cy5zd2lmdA==) | `100.00% <100.00%> (ø)` | | | [HealthGPT/HealthGPT/SettingsView.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FHealthGPT%2FSettingsView.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL0hlYWx0aEdQVC9TZXR0aW5nc1ZpZXcuc3dpZnQ=) | `90.81% <83.34%> (+0.45%)` | :arrow_up: | | [HealthGPT/Onboarding/OnboardingFlow.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FOnboarding%2FOnboardingFlow.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL09uYm9hcmRpbmcvT25ib2FyZGluZ0Zsb3cuc3dpZnQ=) | `82.61% <87.50%> (+0.26%)` | :arrow_up: | | [HealthGPT/Onboarding/LLMLocalDownload.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FOnboarding%2FLLMLocalDownload.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL09uYm9hcmRpbmcvTExNTG9jYWxEb3dubG9hZC5zd2lmdA==) | `77.78% <77.78%> (ø)` | | | [HealthGPT/HealthGPT/HealthGPTView.swift](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?src=pr&el=tree&filepath=HealthGPT%2FHealthGPT%2FHealthGPTView.swift&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG#diff-SGVhbHRoR1BUL0hlYWx0aEdQVC9IZWFsdGhHUFRWaWV3LnN3aWZ0) | `93.62% <71.43%> (-3.97%)` | :arrow_down: | ------ [Continue to review full report in Codecov by Sentry](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG). > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG) > `Δ = absolute (impact)`, `ø = not affected`, `? = missing data` > Powered by [Codecov](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?dropdown=coverage&src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG). Last update [10b725e...97e0d3d](https://app.codecov.io/gh/StanfordBDHG/HealthGPT/pull/39?dropdown=coverage&src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=StanfordBDHG).
vishnuravi commented 1 month ago

The screenshot below shows HealthGPT functioning properly with Llama3 8B.