Skip to content

Commit b421a54

Browse files
committed
Added example for averaging vectors with Django [skip ci]
1 parent fb571b5 commit b421a54

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ Get items within a certain distance
8585
Item.objects.alias(distance=L2Distance('embedding', [3, 1, 2])).filter(distance__lt=5)
8686
```
8787

88+
Average vectors
89+
90+
```python
91+
from django.db.models import Avg
92+
93+
Item.objects.aggregate(Avg('embedding'))
94+
```
95+
96+
Also supports `Sum`
97+
8898
Add an approximate index
8999

90100
```python

0 commit comments

Comments
 (0)