how-to-do-offline-recommendations-with-sqlite-and-gemini
How to do Offline Recommendations with SQLite and Gemini
When working with a CMS (like PocketBase) it is common to add some sort of recommendatios for related content. For example you can have a list of blog posts, and show related posts either by random selection or recently viewed.
I first learned about this technique from Aaron Francis on his YouTube channel:
Text Embeddings
Text embeddings are a way to convert a chunk of text into a an array of numbers. Having a mathematical representation means we can easily store them in a database and run common functions to calculate the distances between vectors that we have stored.
You will need an API Key from AI Studio to generate the descriptions and embeddings.
In order to create the embedding we need to first generate chunk small enough to fit in the embedding window size. For example we can use an LLM like Gemini to generate a description for a blog post and then vectorize the description which we can store in the database.
We only need to generate a new embedding and description when the content changes which limits the billing costs to the frequency of the content changes.
Storing the Vectors
More from rodydavis/skills
flutter-control-and-screenshot
Guide on how to control a Flutter app using flutter_driver via MCP and capture screenshots.
197how-to-build-a-native-cross-platform-project-with-flutter
Learn how to import `dart:html` and `dart:io` in the same Flutter project to create cross-platform plugins that work seamlessly on mobile and web.
59install-flutter-from-git
Install Flutter SDK via git clone and configure for all platforms
56how-to-build-a-webrtc-signal-server-with-pocketbase
Learn how to build a simple WebRTC video call application using PocketBase as a signaling server, enabling peer-to-peer communication with SQLite on the server and realtime updates via Server Sent Events.
55how-to-do-full-text-search-with-sqlite
Learn how to supercharge your SQLite databases with full-text search capabilities using the built-in fts5 extension, enabling efficient and powerful querying with the `MATCH` keyword.
55flutter-fastlane-one-click-beta
Deploy your Flutter app to the App Store and Google Play with ease using this step-by-step guide covering installation, project setup, Fastlane integration, and automated deployments with Automator.
55