Skip to content

Commit

Permalink
Local LLM Execution Capabilities (#35)
Browse files Browse the repository at this point in the history
# *Local LLM Execution Capabilities*

## ♻️ Current situation & Problem
As of now, the Spezi ecosystem (via `SpeziML`) provides an OpenAI
integration for easy LLM execution. However, using a remote, opaque
service like OpenAI comes with a multitude of challenges, especially in
the health domain. The challenges include privacy, trust, security but
also financial considerations.


## ⚙️ Release Notes 
- Renaming the SPM package (and the entire repo) from `SpeziML` to
`SpeziLLM` to better reflect the current functionality of the package.
- Complete restructuring of the package to support local and remote LLM
execution. Introduced four separate targets `SpeziLLM` (providing base
LLM infrastructure), `SpeziLLMLocal` (providing local execution
capabilities), `SpeziLLMLocalDownload` (providing download and local
storage functionality), as well as `SpeziLLMOpenAI` (providing a OpenAI
GPT integration). All of these targets are subject to change in the
upcoming releases.

## 📚 Documentation
Documentation has been provided via inline DocC comments and code
examples.


## ✅ Testing
Wrote appropriate UI Tests which utilize an LLM mock.


## 📝 Code of Conduct & Contributing Guidelines 

By submitting creating this pull request, you agree to follow our [Code
of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md):
- [x] I agree to follow the [Code of
Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md)
and [Contributing
Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md).

---------

Co-authored-by: Paul Schmiedmayer <PSchmiedmayer@users.noreply.github.com>
  • Loading branch information
philippzagar and PSchmiedmayer authored Dec 4, 2023
1 parent 786dbba commit 3dd6610
Show file tree
Hide file tree
Showing 111 changed files with 4,212 additions and 1,189 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
name: Build and Test Swift Package
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
with:
artifactname: SpeziML-Package.xcresult
artifactname: SpeziLLM-Package.xcresult
runsonlabels: '["macOS", "self-hosted"]'
scheme: SpeziML-Package
scheme: SpeziLLM-Package
buildandtestuitests:
name: Build and Test UI Tests
uses: StanfordSpezi/.github/.github/workflows/xcodebuild-or-fastlane.yml@v2
Expand All @@ -36,4 +36,4 @@ jobs:
needs: [buildandtest, buildandtestuitests]
uses: StanfordSpezi/.github/.github/workflows/create-and-upload-coverage-report.yml@v2
with:
coveragereports: SpeziML-Package.xcresult TestApp.xcresult
coveragereports: SpeziLLM-Package.xcresult TestApp.xcresult
7 changes: 4 additions & 3 deletions .spi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ builder:
configs:
- platform: ios
documentation_targets:
- SpeziOpenAI
- SpeziSpeechRecognizer
- SpeziSpeechSynthesizer
- SpeziLLM
- SpeziLLMLocal
- SpeziLLMLocalDownload
- SpeziLLMOpenAI
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ authors:
- family-names: "Ravi"
given-names: "Vishnu"
orcid: "https://orcid.org/0000-0003-0359-1275"
title: "SpeziML"
title: "SpeziLLM"
doi: 10.5281/zenodo.7538165
url: "https://github.com/StanfordSpezi/SpeziML"
url: "https://github.com/StanfordSpezi/SpeziLLM"
4 changes: 3 additions & 1 deletion CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
-->

SpeziML contributors
SpeziLLM contributors
====================

* [Paul Schmiedmayer](https://github.com/PSchmiedmayer)
* [Vishnu Ravi](https://github.com/vishnuravi)
* [Philipp Zagar](https://github.com/philippzagar)
* [Adrit Rao](https://github.com/AdritRao)
56 changes: 41 additions & 15 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,70 @@ import PackageDescription


let package = Package(
name: "SpeziML",
name: "SpeziLLM",
defaultLocalization: "en",
platforms: [
.iOS(.v17)
],
products: [
.library(name: "SpeziOpenAI", targets: ["SpeziOpenAI"]),
.library(name: "SpeziSpeechRecognizer", targets: ["SpeziSpeechRecognizer"]),
.library(name: "SpeziSpeechSynthesizer", targets: ["SpeziSpeechSynthesizer"])
.library(name: "SpeziLLM", targets: ["SpeziLLM"]),
.library(name: "SpeziLLMLocal", targets: ["SpeziLLMLocal"]),
.library(name: "SpeziLLMLocalDownload", targets: ["SpeziLLMLocalDownload"]),
.library(name: "SpeziLLMOpenAI", targets: ["SpeziLLMOpenAI"])
],
dependencies: [
.package(url: "https://github.com/MacPaw/OpenAI", .upToNextMinor(from: "0.2.4")),
.package(url: "https://github.com/StanfordBDHG/llama.cpp", .upToNextMinor(from: "0.1.6")),
.package(url: "https://github.com/StanfordSpezi/Spezi", .upToNextMinor(from: "0.8.0")),
.package(url: "https://github.com/StanfordSpezi/SpeziStorage", .upToNextMinor(from: "0.5.0")),
.package(url: "https://github.com/StanfordSpezi/SpeziOnboarding", .upToNextMinor(from: "0.7.0"))
.package(url: "https://github.com/StanfordSpezi/SpeziOnboarding", .upToNextMinor(from: "0.7.0")),
.package(url: "https://github.com/StanfordSpezi/SpeziSpeech", .upToNextMinor(from: "0.1.1")),
.package(url: "https://github.com/StanfordSpezi/SpeziChat", .upToNextMinor(from: "0.1.1")),
.package(url: "https://github.com/StanfordSpezi/SpeziViews", .upToNextMinor(from: "0.6.3"))
],
targets: [
.target(
name: "SpeziOpenAI",
name: "SpeziLLM",
dependencies: [
.target(name: "SpeziSpeechRecognizer"),
.product(name: "OpenAI", package: "OpenAI"),
.product(name: "Spezi", package: "Spezi"),
.product(name: "SpeziLocalStorage", package: "SpeziStorage"),
.product(name: "SpeziSecureStorage", package: "SpeziStorage"),
.product(name: "SpeziOnboarding", package: "SpeziOnboarding")
.product(name: "SpeziChat", package: "SpeziChat"),
.product(name: "SpeziViews", package: "SpeziViews")
]
),
.target(
name: "SpeziSpeechRecognizer"
name: "SpeziLLMLocal",
dependencies: [
.target(name: "SpeziLLM"),
.product(name: "llama", package: "llama.cpp"),
.product(name: "Spezi", package: "Spezi")
],
swiftSettings: [
.interoperabilityMode(.Cxx)
]
),
.target(
name: "SpeziSpeechSynthesizer"
name: "SpeziLLMLocalDownload",
dependencies: [
.product(name: "SpeziOnboarding", package: "SpeziOnboarding"),
.product(name: "SpeziViews", package: "SpeziViews")
]
),
.target(
name: "SpeziLLMOpenAI",
dependencies: [
.product(name: "OpenAI", package: "OpenAI"),
.product(name: "Spezi", package: "Spezi"),
.product(name: "SpeziChat", package: "SpeziChat"),
.product(name: "SpeziLocalStorage", package: "SpeziStorage"),
.product(name: "SpeziSecureStorage", package: "SpeziStorage"),
.product(name: "SpeziSpeechRecognizer", package: "SpeziSpeech"),
.product(name: "SpeziOnboarding", package: "SpeziOnboarding")
]
),
.testTarget(
name: "SpeziOpenAITests",
name: "SpeziLLMTests",
dependencies: [
.target(name: "SpeziOpenAI")
.target(name: "SpeziLLMOpenAI")
]
)
]
Expand Down
Loading

0 comments on commit 3dd6610

Please sign in to comment.