Overview
As part of optimizing the recommendations app’s performance, we need to implement a Django model that will serve as a cache for embeddings generated by the model(s). Embeddings are computational-intensive and time-consuming to generate, so caching them significantly improves response times and reduces redundant computation. This task involves designing and implementing the model, and ensuring proper cache management.
Description and outcomes
- Create the
Embeddings model in /contentcuration/contentcuration/models.py in the contentcuration app.
- Define the fields (
content_id, embedding) with their corresponding data types(UUID, VectorField).
- Generate the migration to create the Embeddings model.
- Include the addition of the
pgvector extension to the migration.
- Apply the migration to update the database schema and create the
Embeddings table.
- Write unit tests to verify the correctness of the
Embeddings model's creation and migration
- Verify that the migration includes the expected changes.
Accessibility requirements
Not applicable
Acceptance criteria
- The
Embeddings model is implemented with two fields: content_id(UUID), and embedding(VectorField).
- A migration is generated to create the
Embeddings model.
- The
pgvector extension is added to the migration.
- The migration is applied successfully, resulting in the creation of the
Embeddings table and pgvector extension.
- Unit tests to validate the correct implementation of the
Embeddings model and migration.
- Documentation is updated to provide information about the
Embeddings model.
Resources
Embeddings
pgvector
pgvector-python
Overview
As part of optimizing the recommendations app’s performance, we need to implement a Django model that will serve as a cache for embeddings generated by the model(s). Embeddings are computational-intensive and time-consuming to generate, so caching them significantly improves response times and reduces redundant computation. This task involves designing and implementing the model, and ensuring proper cache management.
Description and outcomes
Embeddingsmodel in/contentcuration/contentcuration/models.pyin thecontentcurationapp.content_id,embedding) with their corresponding data types(UUID,VectorField).pgvectorextension to the migration.Embeddingstable.Embeddingsmodel's creation and migrationAccessibility requirements
Not applicable
Acceptance criteria
Embeddingsmodel is implemented with two fields:content_id(UUID), andembedding(VectorField).Embeddingsmodel.pgvectorextension is added to the migration.Embeddingstable andpgvectorextension.Embeddingsmodel and migration.Embeddingsmodel.Resources
Embeddings
pgvector
pgvector-python