SiriLLama
SiriLLama copied to clipboard
Use locally running LLMs directly from Siri π¦π£
Siri LLama
Siri LLama is apple shortcut that access locally running LLMs through Siri or the shortcut UI on any apple device connected to the same network of your host machine. It uses Langchain π¦π and supports open source models from both Ollama π¦ or Fireworks AI π
Getting Started
Requirements
Ollama Installationπ¦
-
Install Ollama for your machine, you have to run
ollama servein the terminal to start the server -
pull the models you want to use, for example
ollama run llama3 # chat model
ollama run llava # multimodal
- Install Langchain and Flask
pip install --upgrade --quiet langchain langchain-community
pip install flask
- in
config.pysetOLLAMA_CHATandOLLAMA_VISUAL_CHATto the models you pulled from Ollama
Fireworks AI Installationπ
1.Install Langchain and Flask
pip install --upgrade --quiet langchain langchain-fireworks
pip install flask
-
get your Fireworks API Key and put it in
fireworks_models.py -
in
config.pysetFIREWORKS_CHATandvchat_modelto the models you want to use from Fireworks AI. and set your andFIREWORKS_API_KEY
Config
in confing.py set MEMORY_SIZE (How many previous messages to remember) and ANSWER_SIZE_WORDS (How many words to generate in the answer)
Running SiriLlama π£π¦
-
Download or clone the repo
-
set the provider (Ollama / Fireworks) in
app.py -
Run the flask app using
>>> python3 app.py
-
On your Apple device, Download the shortcut from here Note that you must run the shortcut through Siri to "talk" to it, otherwise it will prompt you to type text.
-
Run the shortcut through Siri or the shortcut UI, in first time you run the shortcut you will be asked to enter your IP address and the port number showing in terminal
>>> python app.py
...
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5000
* Running on http://192.168.1.134:5000
Press CTRL+C to quit
In the example above, the IP address is 192.168.1.134 and the port is 5000 (default port is specified by Flask, change the line in main.py if needed)
Common Issues π
- Even we access the flask app (not Ollama server directly), Some windows users who have Ollama installed using
WSLhave to make sure ollama servere is exposed to the network, Check this issue for more details - When running the shortcut for the first time from Siri, it should ask for permission to send data to the Flask server. If it doesn't work (especially on iOS 17.4), first try running the shortcut + sending a message from the iOS Shortcuts app to trigger the permissions dialog, then try running it through Siri again.
Other LLM Provider π€π€
Supposedly SiriLLama should work with any LLMs that including OpenAI, Claude, etc. but make sure first you installed the corresponding Langchain packages and set the models in config.py