Skip to content

Commit

Permalink
Added example for averaging vectors with Django [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ankane committed Sep 15, 2023
1 parent fb571b5 commit b421a54
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ Get items within a certain distance
Item.objects.alias(distance=L2Distance('embedding', [3, 1, 2])).filter(distance__lt=5)
```

Average vectors

```python
from django.db.models import Avg

Item.objects.aggregate(Avg('embedding'))
```

Also supports `Sum`

Add an approximate index

```python
Expand Down

0 comments on commit b421a54

Please sign in to comment.