Sh4yy / personal-ai
- четверг, 9 мая 2024 г. в 00:00:05
This is a personal AI assistant that works with Apple Shortcuts removing the need for a dedicated hardware device.
The assistant is run on Cloudflare Workers and can work with any LLM model. The code snippet here uses llama 3 as an example with a custom function calling for fetching weather data.
Clone the repository:
Install dependencies:
npm install to install the necessary dependencies.Authenticate with Cloudflare:
npx wrangler login to log in to your Cloudflare account.Create KV namespaces:
npx wrangler kv:namespace create chats to create a KV namespace. Note down the ID.npx wrangler kv:namespace create chats --preview to create a preview KV namespace. Note down the ID.Configure the project:
wrangler.toml with the namespace IDs:kv_namespaces = [
{ binding = "personal_ai_chats", id = "<id>", preview_id = "<preview_id>"}
]Set up API keys:
Run npx wrangler secret put GROQ_API_KEY to set the GROQ API key.
Run npx wrangler secret put OPENWEATHERMAP_API_KEY to set the OpenWeather API key.
Note: You can get these keys by signing up on GroqCloud and OpenWeather respectively.
To deploy the worker, run npx wrangler deploy.
Install the shortcut:
Configure the shortcut:
URL field with your worker's URL.https://personal-ai.<your-username>.workers.dev.