HealthGPT icon indicating copy to clipboard operation
HealthGPT copied to clipboard

Adds support for on-device LLMs with SpeziLLMLocal

Open vishnuravi opened this issue 10 months ago • 1 comments

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

  • Adds a step in onboarding for downloading and storing the Llama2 7B model
  • Adds an --llmLocal feature flag for toggling local execution
  • Adds an onboarding step allowing the user to choose between OpenAI or local execution
  • Updates the HealthDataInterpreter to use the local LLM if the flag is set

:books: Documentation

Updated documentation

:white_check_mark: Testing

  • Adds UI tests for local LLM configuration during onboarding

Code of Conduct & Contributing Guidelines

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

vishnuravi avatar Apr 04 '24 10:04 vishnuravi

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

@@            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 Coverage Δ
HealthGPT/HealthGPT/HealthDataInterpreter.swift 100.00% <100.00%> (ø)
HealthGPT/HealthGPTAppDelegate.swift 100.00% <100.00%> (ø)
HealthGPT/Onboarding/LLMSource.swift 100.00% <100.00%> (ø)
HealthGPT/Onboarding/LLMSourceSelection.swift 100.00% <100.00%> (ø)
HealthGPT/Onboarding/OpenAIAPIKey.swift 100.00% <100.00%> (ø)
HealthGPTUITests/OnboardingUITests.swift 100.00% <100.00%> (ø)
HealthGPT/HealthGPT/SettingsView.swift 90.81% <83.34%> (+0.45%) :arrow_up:
HealthGPT/Onboarding/OnboardingFlow.swift 82.61% <87.50%> (+0.26%) :arrow_up:
HealthGPT/Onboarding/LLMLocalDownload.swift 77.78% <77.78%> (ø)
HealthGPT/HealthGPT/HealthGPTView.swift 93.62% <71.43%> (-3.97%) :arrow_down:

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 10b725e...97e0d3d. Read the comment docs.

codecov[bot] avatar Apr 04 '24 12:04 codecov[bot]

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

vishnuravi avatar May 13 '24 17:05 vishnuravi