vecs


Namevecs JSON
Version 0.4.5 PyPI version JSON
download
home_pagehttps://github.com/supabase/vecs
Summarypgvector client
upload_time2024-12-13 20:53:50
maintainerNone
docs_urlNone
authorOliver Rice
requires_pythonNone
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # vecs

<p>
    <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.7+-blue.svg" alt="Python version" height="18"></a>
    <a href="https://github.com/supabase/vecs/actions">
        <img src="https://github.com/supabase/vecs/workflows/tests/badge.svg" alt="test status" height="18">
    </a>
    <a href="https://github.com/supabase/vecs/actions">
        <img src="https://github.com/supabase/vecs/workflows/pre-commit/badge.svg" alt="Pre-commit Status" height="18">
    </a>
</p>

<p>
    <a href="https://badge.fury.io/py/vecs"><img src="https://badge.fury.io/py/vecs.svg" alt="PyPI version" height="18"></a>
    <a href="https://github.com/supabase/vecs/blob/master/LICENSE"><img src="https://img.shields.io/pypi/l/markdown-subtemplate.svg" alt="License" height="18"></a>
    <a href="https://pypi.org/project/vecs/"><img src="https://img.shields.io/pypi/dm/vecs.svg" alt="Download count" height="18"></a>
</p>

---

**Documentation**: <a href="https://supabase.github.io/vecs/latest/" target="_blank">https://supabase.github.io/vecs/latest/</a>

**Source Code**: <a href="https://github.com/supabase/vecs" target="_blank">https://github.com/supabase/vecs</a>

---

`vecs` is a python client for managing and querying vector stores in PostgreSQL with the [pgvector extension](https://github.com/pgvector/pgvector). This guide will help you get started with using vecs.

If you don't have a Postgres database with the pgvector ready, see [hosting](https://supabase.github.io/vecs/hosting/) for easy options.

## Installation

Requires:

- Python 3.7+

You can install vecs using pip:

```sh
pip install vecs
```

## Usage

Visit the [quickstart guide](https://supabase.github.io/vecs/latest/api) for more complete info.

```python
import vecs

DB_CONNECTION = "postgresql://<user>:<password>@<host>:<port>/<db_name>"

# create vector store client
vx = vecs.create_client(DB_CONNECTION)

# create a collection of vectors with 3 dimensions
docs = vx.get_or_create_collection(name="docs", dimension=3)

# add records to the *docs* collection
docs.upsert(
    records=[
        (
         "vec0",           # the vector's identifier
         [0.1, 0.2, 0.3],  # the vector. list or np.array
         {"year": 1973}    # associated  metadata
        ),
        (
         "vec1",
         [0.7, 0.8, 0.9],
         {"year": 2012}
        )
    ]
)

# index the collection for fast search performance
docs.create_index()

# query the collection filtering metadata for "year" = 2012
docs.query(
    data=[0.4,0.5,0.6],              # required
    limit=1,                         # number of records to return
    filters={"year": {"$eq": 2012}}, # metadata filters
)

# Returns: ["vec1"]
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/supabase/vecs",
    "name": "vecs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Oliver Rice",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/0c/87/9fb55aff1e18278c2a0d93ba48432e060086702e258e7e13068a31376548/vecs-0.4.5.tar.gz",
    "platform": null,
    "description": "# vecs\n\n<p>\n    <a href=\"https://www.python.org/downloads/\"><img src=\"https://img.shields.io/badge/python-3.7+-blue.svg\" alt=\"Python version\" height=\"18\"></a>\n    <a href=\"https://github.com/supabase/vecs/actions\">\n        <img src=\"https://github.com/supabase/vecs/workflows/tests/badge.svg\" alt=\"test status\" height=\"18\">\n    </a>\n    <a href=\"https://github.com/supabase/vecs/actions\">\n        <img src=\"https://github.com/supabase/vecs/workflows/pre-commit/badge.svg\" alt=\"Pre-commit Status\" height=\"18\">\n    </a>\n</p>\n\n<p>\n    <a href=\"https://badge.fury.io/py/vecs\"><img src=\"https://badge.fury.io/py/vecs.svg\" alt=\"PyPI version\" height=\"18\"></a>\n    <a href=\"https://github.com/supabase/vecs/blob/master/LICENSE\"><img src=\"https://img.shields.io/pypi/l/markdown-subtemplate.svg\" alt=\"License\" height=\"18\"></a>\n    <a href=\"https://pypi.org/project/vecs/\"><img src=\"https://img.shields.io/pypi/dm/vecs.svg\" alt=\"Download count\" height=\"18\"></a>\n</p>\n\n---\n\n**Documentation**: <a href=\"https://supabase.github.io/vecs/latest/\" target=\"_blank\">https://supabase.github.io/vecs/latest/</a>\n\n**Source Code**: <a href=\"https://github.com/supabase/vecs\" target=\"_blank\">https://github.com/supabase/vecs</a>\n\n---\n\n`vecs` is a python client for managing and querying vector stores in PostgreSQL with the [pgvector extension](https://github.com/pgvector/pgvector). This guide will help you get started with using vecs.\n\nIf you don't have a Postgres database with the pgvector ready, see [hosting](https://supabase.github.io/vecs/hosting/) for easy options.\n\n## Installation\n\nRequires:\n\n- Python 3.7+\n\nYou can install vecs using pip:\n\n```sh\npip install vecs\n```\n\n## Usage\n\nVisit the [quickstart guide](https://supabase.github.io/vecs/latest/api) for more complete info.\n\n```python\nimport vecs\n\nDB_CONNECTION = \"postgresql://<user>:<password>@<host>:<port>/<db_name>\"\n\n# create vector store client\nvx = vecs.create_client(DB_CONNECTION)\n\n# create a collection of vectors with 3 dimensions\ndocs = vx.get_or_create_collection(name=\"docs\", dimension=3)\n\n# add records to the *docs* collection\ndocs.upsert(\n    records=[\n        (\n         \"vec0\",           # the vector's identifier\n         [0.1, 0.2, 0.3],  # the vector. list or np.array\n         {\"year\": 1973}    # associated  metadata\n        ),\n        (\n         \"vec1\",\n         [0.7, 0.8, 0.9],\n         {\"year\": 2012}\n        )\n    ]\n)\n\n# index the collection for fast search performance\ndocs.create_index()\n\n# query the collection filtering metadata for \"year\" = 2012\ndocs.query(\n    data=[0.4,0.5,0.6],              # required\n    limit=1,                         # number of records to return\n    filters={\"year\": {\"$eq\": 2012}}, # metadata filters\n)\n\n# Returns: [\"vec1\"]\n```\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "pgvector client",
    "version": "0.4.5",
    "project_urls": {
        "Homepage": "https://github.com/supabase/vecs"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0c879fb55aff1e18278c2a0d93ba48432e060086702e258e7e13068a31376548",
                "md5": "9be8aec0c999a63515f547d3df48ec73",
                "sha256": "7cd3ab65cf88f5869d49f70ae7385e844c4915700da1f2299c938afa56148cb6"
            },
            "downloads": -1,
            "filename": "vecs-0.4.5.tar.gz",
            "has_sig": false,
            "md5_digest": "9be8aec0c999a63515f547d3df48ec73",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 22036,
            "upload_time": "2024-12-13T20:53:50",
            "upload_time_iso_8601": "2024-12-13T20:53:50.983412Z",
            "url": "https://files.pythonhosted.org/packages/0c/87/9fb55aff1e18278c2a0d93ba48432e060086702e258e7e13068a31376548/vecs-0.4.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-13 20:53:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "supabase",
    "github_project": "vecs",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "vecs"
}
        
Elapsed time: 0.54512s