Closed
Description
Disclaimer: This is a feature request.
Feature description
This make not make sense, since this is super simple, but I'm running pgvector over Django, and my team uses factories to create sample entries to a model on unit tests.
The problem is that there is no faker for embedding on pgvector-python, so this is my feature request. Django works fine with factory
and Faker (through factory), so this is what I am planning to use.
What I do now
For now, I am using Faker to generate the vector, so my model class looks like this:
from django.db import models
from pgvector.django import VectorField
class MyModel(Model):
content = models.CharField()
embedding = VectorField(dimensions=3)
And my factory class looks like this:
class MyModelFactory(factory.django.DjangoModelFactory):
content = factory.Faker("text")
embedding = factory.Faker("pylist", nb_elements=512, variable_nb_elements=False, value_types=[float])
class Meta:
model = MyModel
How I wish to do
What I wish to have is, instead of invoking Faker directly, to have a factory field:
from pgvector.django.factories import VectorFaker
class MyModelFactory(factory.django.DjangoModelFactory):
embedding = VectorFaker(dimensions=3)
Conclusion
This is a syntax sugar, but I believe this is great for writing factories more natively.
Metadata
Metadata
Assignees
Labels
No labels