ovos-chromadb-embeddings-plugin


Nameovos-chromadb-embeddings-plugin JSON
Version 0.0.0 PyPI version JSON
download
home_pagehttps://github.com/TigreGotico/ovos-chromadb-embeddings-plugin
SummaryA chromadb embeddings plugin for OVOS
upload_time2024-10-25 22:14:28
maintainerNone
docs_urlNone
authorjarbasai
requires_pythonNone
licenseMIT
keywords ovos openvoiceos plugin chromadb recognition
VCS
bugtrack_url
requirements ovos-plugin-manager numpy chromadb
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ChromaEmbeddingsDB Plugin

## Overview

The `ChromaEmbeddingsDB` plugin integrates with the [ChromaDB](https://www.trychroma.com/) database to provide a robust solution for managing and querying embeddings. This plugin extends the abstract `EmbeddingsDB` class, allowing you to store, retrieve, and query embeddings efficiently using ChromaDB’s capabilities.

This plugin is meant to be used by other specialized plugins such as:
- https://github.com/TigreGotico/ovos-face-embeddings-plugin
- https://github.com/TigreGotico/ovos-voice-embeddings-plugin
- https://github.com/TigreGotico/ovos-gguf-embeddings-plugin

## Features

- **Add Embeddings**: Store embeddings with associated keys.
- **Retrieve Embeddings**: Fetch embeddings by their keys.
- **Delete Embeddings**: Remove embeddings by their keys.
- **Query Embeddings**: Find the closest embeddings to a given query, with support for cosine distance.

## Example

Here is a full example demonstrating the basic usage of `ChromaEmbeddingsDB`.

```python
import numpy as np
from chroma_embeddings_db import ChromaEmbeddingsDB

# Initialize the database
db = ChromaEmbeddingsDB(path="path_to_chromadb_storage")

# Add embeddings
embedding1 = np.array([0.1, 0.2, 0.3])
embedding2 = np.array([0.4, 0.5, 0.6])
db.add_embeddings("user1", embedding1)
db.add_embeddings("user2", embedding2)

# Retrieve and print embeddings
print(db.get_embedding("user1"))
print(db.get_embedding("user2"))

# Query embeddings
query_embedding = np.array([0.2, 0.3, 0.4])
results = db.query(query_embedding, top_k=2)
print(results)

# Delete an embedding
db.delete_embedding("user1")
```

> Ensure that the path provided to the `ChromaEmbeddingsDB` constructor is accessible and writable.


## Acknowledgements

- [ChromaDB](https://www.trychroma.com/) for providing the database backend.
- [NumPy](https://numpy.org) for numerical operations.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/TigreGotico/ovos-chromadb-embeddings-plugin",
    "name": "ovos-chromadb-embeddings-plugin",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "OVOS openvoiceos plugin chromadb recognition",
    "author": "jarbasai",
    "author_email": "jarbasai@mailfence.com",
    "download_url": "https://files.pythonhosted.org/packages/45/1e/0fdaa673c39a5c8835ba4b74bf1a7dae53b7ccae9bff3bcff4584256aff4/ovos-chromadb-embeddings-plugin-0.0.0.tar.gz",
    "platform": null,
    "description": "# ChromaEmbeddingsDB Plugin\n\n## Overview\n\nThe `ChromaEmbeddingsDB` plugin integrates with the [ChromaDB](https://www.trychroma.com/) database to provide a robust solution for managing and querying embeddings. This plugin extends the abstract `EmbeddingsDB` class, allowing you to store, retrieve, and query embeddings efficiently using ChromaDB\u2019s capabilities.\n\nThis plugin is meant to be used by other specialized plugins such as:\n- https://github.com/TigreGotico/ovos-face-embeddings-plugin\n- https://github.com/TigreGotico/ovos-voice-embeddings-plugin\n- https://github.com/TigreGotico/ovos-gguf-embeddings-plugin\n\n## Features\n\n- **Add Embeddings**: Store embeddings with associated keys.\n- **Retrieve Embeddings**: Fetch embeddings by their keys.\n- **Delete Embeddings**: Remove embeddings by their keys.\n- **Query Embeddings**: Find the closest embeddings to a given query, with support for cosine distance.\n\n## Example\n\nHere is a full example demonstrating the basic usage of `ChromaEmbeddingsDB`.\n\n```python\nimport numpy as np\nfrom chroma_embeddings_db import ChromaEmbeddingsDB\n\n# Initialize the database\ndb = ChromaEmbeddingsDB(path=\"path_to_chromadb_storage\")\n\n# Add embeddings\nembedding1 = np.array([0.1, 0.2, 0.3])\nembedding2 = np.array([0.4, 0.5, 0.6])\ndb.add_embeddings(\"user1\", embedding1)\ndb.add_embeddings(\"user2\", embedding2)\n\n# Retrieve and print embeddings\nprint(db.get_embedding(\"user1\"))\nprint(db.get_embedding(\"user2\"))\n\n# Query embeddings\nquery_embedding = np.array([0.2, 0.3, 0.4])\nresults = db.query(query_embedding, top_k=2)\nprint(results)\n\n# Delete an embedding\ndb.delete_embedding(\"user1\")\n```\n\n> Ensure that the path provided to the `ChromaEmbeddingsDB` constructor is accessible and writable.\n\n\n## Acknowledgements\n\n- [ChromaDB](https://www.trychroma.com/) for providing the database backend.\n- [NumPy](https://numpy.org) for numerical operations.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A chromadb embeddings plugin for OVOS",
    "version": "0.0.0",
    "project_urls": {
        "Homepage": "https://github.com/TigreGotico/ovos-chromadb-embeddings-plugin"
    },
    "split_keywords": [
        "ovos",
        "openvoiceos",
        "plugin",
        "chromadb",
        "recognition"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a5bc2836b0962f174ed98a757c54844a3d81b69e8f7993b5dba2ea670af1f1f",
                "md5": "88daaec54320b1a139e957fd56a219b1",
                "sha256": "210ed1ec21674db02de954390ad0fe6c1512e88abfd6fbb9e248e3cb92ca32b4"
            },
            "downloads": -1,
            "filename": "ovos_chromadb_embeddings_plugin-0.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "88daaec54320b1a139e957fd56a219b1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4448,
            "upload_time": "2024-10-25T22:14:27",
            "upload_time_iso_8601": "2024-10-25T22:14:27.453164Z",
            "url": "https://files.pythonhosted.org/packages/3a/5b/c2836b0962f174ed98a757c54844a3d81b69e8f7993b5dba2ea670af1f1f/ovos_chromadb_embeddings_plugin-0.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "451e0fdaa673c39a5c8835ba4b74bf1a7dae53b7ccae9bff3bcff4584256aff4",
                "md5": "2a0b97c7d855ffce226aa5ea27490a36",
                "sha256": "1fbc58a17071e9d62751751189b3310932ccf3c271fc1773ccf098aeba837cb9"
            },
            "downloads": -1,
            "filename": "ovos-chromadb-embeddings-plugin-0.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "2a0b97c7d855ffce226aa5ea27490a36",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4059,
            "upload_time": "2024-10-25T22:14:28",
            "upload_time_iso_8601": "2024-10-25T22:14:28.936046Z",
            "url": "https://files.pythonhosted.org/packages/45/1e/0fdaa673c39a5c8835ba4b74bf1a7dae53b7ccae9bff3bcff4584256aff4/ovos-chromadb-embeddings-plugin-0.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-25 22:14:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "TigreGotico",
    "github_project": "ovos-chromadb-embeddings-plugin",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "ovos-plugin-manager",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "chromadb",
            "specs": []
        }
    ],
    "lcname": "ovos-chromadb-embeddings-plugin"
}
        
Elapsed time: 0.65197s