{"id":18729253,"url":"https://github.com/postgresml/postgresml-django","last_synced_at":"2025-07-24T13:34:01.758Z","repository":{"id":254192661,"uuid":"845764333","full_name":"postgresml/postgresml-django","owner":"postgresml","description":"postgresml-django is a Python module that integrates PostgresML with Django ORM, enabling automatic in-database embedding of Django models.","archived":false,"fork":false,"pushed_at":"2024-08-21T22:48:05.000Z","size":4,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-19T05:41:52.096Z","etag":null,"topics":["django","embeddings","llm","postgresql"],"latest_commit_sha":null,"homepage":"https://postgresml.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postgresml.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-21T22:14:33.000Z","updated_at":"2025-05-22T20:41:39.000Z","dependencies_parsed_at":"2024-08-22T00:34:09.002Z","dependency_job_id":null,"html_url":"https://github.com/postgresml/postgresml-django","commit_stats":null,"previous_names":["postgresml/postgresml-django"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/postgresml/postgresml-django","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgresml%2Fpostgresml-django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgresml%2Fpostgresml-django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgresml%2Fpostgresml-django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgresml%2Fpostgresml-django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgresml","download_url":"https://codeload.github.com/postgresml/postgresml-django/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgresml%2Fpostgresml-django/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266850867,"owners_count":23995158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-24T02:00:09.469Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","embeddings","llm","postgresql"],"created_at":"2024-11-07T14:26:20.013Z","updated_at":"2025-07-24T13:34:01.676Z","avatar_url":"https://github.com/postgresml.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postgresml-django\n\npostgresml-django is a Python module that integrates PostgresML with Django ORM, enabling automatic in-database embedding of Django models. It simplifies the process of creating and searching vector embeddings for your text data.\n\n## Introduction\n\nThis module provides a seamless way to:\n- Automatically generate in-databse embeddings for specified fields in your Django models\n- Perform vector similarity searches in-database\n\n## Installation\n\n1. Ensure you have [pgml](https://github.com/postgresml/postgresml) installed and configured in your database. The easiest way to do that is to sign up for a free serverless database at [postgresml.org](https://postgresml.org). You can also host it your self.\n\n2. Install the package using pip:\n\n   ```\n   pip install postgresml-django\n   ```\n\nYou are ready to go!\n\n## Usage Examples\n\n### Example 1: Using intfloat/e5-small-v2\n\nThis example demonstrates using the `intfloat/e5-small-v2` transformer, which has an embedding size of 384.\n\n```python\nfrom django.db import models\nfrom postgresml_django import VectorField, Embed\n\nclass Document(Embed):\n    text = models.TextField()\n    text_embedding = VectorField(\n        field_to_embed=\"text\",\n        dimensions=384,\n        transformer=\"intfloat/e5-small-v2\"\n    )\n\n# Searching\nresults = Document.vector_search(\"text_embedding\", \"some query to search against\")\n```\n\n### Example 2: Using mixedbread-ai/mxbai-embed-large-v1\n\nThis example shows how to use the `mixedbread-ai/mxbai-embed-large-v1` transformer, which has an embedding size of 1024 and requires specific parameters for recall.\n\n```python\nfrom django.db import models\nfrom postgresml_django import VectorField, Embed\n\nclass Article(Embed):\n    content = models.TextField()\n    content_embedding = VectorField(\n        field_to_embed=\"content\",\n        dimensions=1024,\n        transformer=\"mixedbread-ai/mxbai-embed-large-v1\",\n        transformer_recall_parameters={\n            \"prompt\": \"Represent this sentence for searching relevant passages: \"\n        }\n    )\n\n# Searching\nresults = Article.vector_search(\"content_embedding\", \"some query to search against\")\n```\n\nNote the differences between the two examples:\n1. The `dimensions` parameter is set to 384 for `intfloat/e5-small-v2` and 1024 for `mixedbread-ai/mxbai-embed-large-v1`.\n2. The `mixedbread-ai/mxbai-embed-large-v1` transformer requires additional parameters for recall, which are specified in the `transformer_recall_parameters` argument.\n\nBoth examples will automatically generate embeddings when instances are saved and allow for vector similarity searches using the `vector_search` method.\n\n## Contributing\n\nWe welcome contributions to postgresml-django! Whether it's bug reports, feature requests, documentation improvements, or code contributions, your input is valuable to us. Feel free to open issues or submit pull requests on our GitHub repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgresml%2Fpostgresml-django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgresml%2Fpostgresml-django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgresml%2Fpostgresml-django/lists"}