mirror of
https://github.com/Hopiu/llm.git
synced 2026-05-03 19:34:44 +00:00
Add note about similarity function in "similar" command's doc (#774)
* note about similarity function in similar command doc * Link to Wikipedia definition --------- Co-authored-by: Simon Willison <swillison@gmail.com>
This commit is contained in:
parent
849c65fe9d
commit
eda1f4f588
3 changed files with 5 additions and 5 deletions
|
|
@ -325,7 +325,7 @@ llm embed-multi photos \
|
|||
(embeddings-cli-similar)=
|
||||
## llm similar
|
||||
|
||||
The `llm similar` command searches a collection of embeddings for the items that are most similar to a given or item ID.
|
||||
The `llm similar` command searches a collection of embeddings for the items that are most similar to a given or item ID, based on [cosine similarity](https://en.wikipedia.org/wiki/Cosine_similarity).
|
||||
|
||||
This currently uses a slow brute-force approach which does not scale well to large collections. See [issue 216](https://github.com/simonw/llm/issues/216) for plans to add a more scalable approach via vector indexes provided by plugins.
|
||||
|
||||
|
|
@ -419,4 +419,4 @@ llm collections delete collection-name
|
|||
Pass `-d` to specify a different database file:
|
||||
```bash
|
||||
llm collections delete collection-name -d my-embeddings.db
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ Commands:
|
|||
models Manage available models
|
||||
openai Commands for working directly with the OpenAI API
|
||||
plugins List installed plugins
|
||||
similar Return top N similar IDs from a collection
|
||||
similar Return top N similar IDs from a collection using cosine...
|
||||
templates Manage stored prompt templates
|
||||
uninstall Uninstall Python packages from the LLM environment
|
||||
```
|
||||
|
|
@ -591,7 +591,7 @@ Options:
|
|||
```
|
||||
Usage: llm similar [OPTIONS] COLLECTION [ID]
|
||||
|
||||
Return top N similar IDs from a collection
|
||||
Return top N similar IDs from a collection using cosine similarity.
|
||||
|
||||
Example usage:
|
||||
|
||||
|
|
|
|||
|
|
@ -1820,7 +1820,7 @@ def embed_multi(
|
|||
)
|
||||
def similar(collection, id, input, content, binary, number, database):
|
||||
"""
|
||||
Return top N similar IDs from a collection
|
||||
Return top N similar IDs from a collection using cosine similarity.
|
||||
|
||||
Example usage:
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue