mirror of
https://github.com/Hopiu/llm.git
synced 2026-04-23 14:34:46 +00:00
Fix broken example in docs (#223)
This commit is contained in:
parent
2cc9b6087f
commit
a44e23876e
1 changed files with 5 additions and 5 deletions
|
|
@ -135,14 +135,14 @@ The `entry` object returned is an object with the following properties:
|
|||
|
||||
This defaults to returning the 10 most similar items. You can change this by passing a different `number=` argument:
|
||||
```python
|
||||
for id, score in collection.similar("hound", number=5):
|
||||
print(id, score)
|
||||
for entry in collection.similar("hound", number=5):
|
||||
print(entry.id, entry.score)
|
||||
```
|
||||
The `similar_by_id()` method takes the ID of another item in the collection and returns the most similar items to that one, based on the embedding that has already been stored for it:
|
||||
|
||||
```python
|
||||
for id, score in collection.similar_by_id("cat"):
|
||||
print(id, score)
|
||||
for entry in collection.similar_by_id("cat"):
|
||||
print(entry.id, entry.score)
|
||||
```
|
||||
The item itself is excluded from the results.
|
||||
|
||||
|
|
@ -183,4 +183,4 @@ CREATE TABLE "embeddings" (
|
|||
PRIMARY KEY ([collection_id], [id])
|
||||
)
|
||||
```
|
||||
<!-- [[[end]]] -->
|
||||
<!-- [[[end]]] -->
|
||||
|
|
|
|||
Loading…
Reference in a new issue