Jina AI launches open-source 8k text embedding
I just shipped a new llm-embed-jina plugin for my LLM tool which provides access to these new Jina models: <a href="https://github.com/simonw/llm-embed-jina">https://github.com/simonw/llm-embed-jina</a><p>Here's how to try it out.<p>First, install LLM. Use pip or pipx or brew:<p><pre><code>    brew install llm
</code></pre>
Next install the new plugin:<p><pre><code>    llm install llm-embed-jina
</code></pre>
You can confirm the new models are now available to LLM by running:<p><pre><code>    llm embed-models
</code></pre>
You should see a list that includes "jina-embeddings-v2-small-en" and "jina-embeddings-v2-base-en"<p>To embed a string using the small model, run this:<p><pre><code>    llm embed -m jina-embeddings-v2-small-en -c 'Hello world'
</code></pre>
That will output a JSON array of 512 floating point numbers (see my explainer here for what those are: <a href="https://simonwillison.net/2023/Oct/23/embeddings/#what-are-embeddings" rel="nofollow noreferrer">https://simonwillison.net/2023/Oct/23/embeddings/#what-are-e...</a>)<p>Embeddings are only really interesting if you store them and use them for comparisons.<p>Here's how to use the "llm embed-multi" command to create embeddings for the 30 most recent issues in my LLM GitHub repository:<p><pre><code>    curl 'https://api.github.com/repos/simonw/llm/issues?state=all&filter=all' \
    | jq '[.[] | {id: .id, title: .title}]' \
    | llm embed-multi -m jina-embeddings-v2-small-en jina-llm-issues - \
    --store
</code></pre>
This creates a collection called "jina-llm-issues" in a default SQLite database on your machine (the path to that can be found using "llm collections path").<p>To search for issues in that collection with titles most similar to the term "bug":<p><pre><code>    llm similar jina-llm-issues -c 'bug'
</code></pre>
Or for issues most similar to another existing issue by ID:<p><pre><code>    llm similar jina-llm-issues 1922688957
</code></pre>
Full documentation on what you can do with LLM and embeddings here: <a href="https://llm.datasette.io/en/stable/embeddings/index.html" rel="nofollow noreferrer">https://llm.datasette.io/en/stable/embeddings/index.html</a><p>Alternative recipe - this creates embeddings for every single README.md in the current directory and its subdirectories. Run this somewhere with a node_modules folder and you should get a whole lot of interesting stuff:<p><pre><code>    llm embed-multi jina-readmes \
      -m jina-embeddings-v2-small-en \
      --files . '**/README.md' --store
</code></pre>
Then search them like this:<p><pre><code>    llm similar jina-readmes -c 'backup tools'</code></pre>