From 66a751c4146d74dfa7208d130690853ea442e816 Mon Sep 17 00:00:00 2001 From: Florents Tselai Date: Fri, 28 Jun 2024 09:22:57 +0300 Subject: [PATCH] gpt4all and embedding example (#19) --- README.md | 70 ++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 5a07632..5fe3d9c 100644 --- a/README.md +++ b/README.md @@ -9,33 +9,41 @@ **tsellm** is the easiest way to access LLMs through your SQLite database. - ```shell pip install tsellm ``` -You can then use LLMs in your SQL queries. -You can supply your queries through a simple CLI. +Behind the scenes, **tsellm** is based on the beautiful [llm](https://llm.datasette.io) library, +so you can use any of its plugins: + +For example, to access `gpt4all` models + ```shell -tsellm my.sqlite3 "select prompt(p, 'orca-2-7b') from my_table" +llm install llm-gpt4all +# Then pick any gpt4all (it will be downloaded automatically the first time you use any model +tsellm :memory: "select prompt('What is the capital of Greece?', 'orca-mini-3b-gguf2-q4_0')" +tsellm :memory: "select prompt('What is the capital of Greece?', 'orca-2-7b')" ``` -You can also enter an interactive REPL shell and try things out. +## Embeddings ```shell -tsellm my.sqlite3 +llm install llm-sentence-transformers +llm sentence-transformers register all-MiniLM-L12-v2 +tsellm :memory: "select embed('Hello', 'sentence-transformers/all-MiniLM-L12-v2')" ``` -![til](./tsellm-demo.gif) - ## Examples -Let's create a simple SQLite database with some data. +Things get more interesting if you +combine models in your standard SQLite queries. + +First, create a db with some data ```bash sqlite3 prompts.db <