llama-index-vector-stores-azurecosmosnosql


Namellama-index-vector-stores-azurecosmosnosql JSON
Version 1.0.0 PyPI version JSON
download
home_pageNone
Summaryllama-index vector_stores azurecosmosnosql integration
upload_time2024-09-09 18:07:27
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.8.1
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Azure Cosmos DB for NoSQL Vector Store

This integration makes possible to use [Azure Cosmos DB for NoSQL](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/)
as a vector store in LlamaIndex.

## Quick start

Install the integration with:

```sh
pip install llama-index-vector-stores-azurecosmosnosql
```

Create the CosmosDB client:

```python
URI = "AZURE_COSMOSDB_URI"
KEY = "AZURE_COSMOSDB_KEY"
client = CosmosClient(URI, credential=KEY)
```

Specify the vector store properties:

```python
indexing_policy = {
    "indexingMode": "consistent",
    "includedPaths": [{"path": "/*"}],
    "excludedPaths": [{"path": '/"_etag"/?'}],
    "vectorIndexes": [{"path": "/embedding", "type": "quantizedFlat"}],
}

vector_embedding_policy = {
    "vectorEmbeddings": [
        {
            "path": "/embedding",
            "dataType": "float32",
            "distanceFunction": "cosine",
            "dimensions": 3072,
        }
    ]
}
```

Create the vector store:

```python
store = AzureCosmosDBNoSqlVectorSearch(
    cosmos_client=client,
    vector_embedding_policy=vector_embedding_policy,
    indexing_policy=indexing_policy,
    cosmos_container_properties={"partition_key": PartitionKey(path="/id")},
    cosmos_database_properties={},
    create_container=True,
)
```

Finally, create the index from a list containing documents:

```python
storage_context = StorageContext.from_defaults(vector_store=store)

index = VectorStoreIndex.from_documents(
    documents, storage_context=storage_context
)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-vector-stores-azurecosmosnosql",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8.1",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/7c/ab/428575966f623cab649771c77f360e833bc6293c0285a4cf5fb9e1dbdf62/llama_index_vector_stores_azurecosmosnosql-1.0.0.tar.gz",
    "platform": null,
    "description": "# Azure Cosmos DB for NoSQL Vector Store\n\nThis integration makes possible to use [Azure Cosmos DB for NoSQL](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/)\nas a vector store in LlamaIndex.\n\n## Quick start\n\nInstall the integration with:\n\n```sh\npip install llama-index-vector-stores-azurecosmosnosql\n```\n\nCreate the CosmosDB client:\n\n```python\nURI = \"AZURE_COSMOSDB_URI\"\nKEY = \"AZURE_COSMOSDB_KEY\"\nclient = CosmosClient(URI, credential=KEY)\n```\n\nSpecify the vector store properties:\n\n```python\nindexing_policy = {\n    \"indexingMode\": \"consistent\",\n    \"includedPaths\": [{\"path\": \"/*\"}],\n    \"excludedPaths\": [{\"path\": '/\"_etag\"/?'}],\n    \"vectorIndexes\": [{\"path\": \"/embedding\", \"type\": \"quantizedFlat\"}],\n}\n\nvector_embedding_policy = {\n    \"vectorEmbeddings\": [\n        {\n            \"path\": \"/embedding\",\n            \"dataType\": \"float32\",\n            \"distanceFunction\": \"cosine\",\n            \"dimensions\": 3072,\n        }\n    ]\n}\n```\n\nCreate the vector store:\n\n```python\nstore = AzureCosmosDBNoSqlVectorSearch(\n    cosmos_client=client,\n    vector_embedding_policy=vector_embedding_policy,\n    indexing_policy=indexing_policy,\n    cosmos_container_properties={\"partition_key\": PartitionKey(path=\"/id\")},\n    cosmos_database_properties={},\n    create_container=True,\n)\n```\n\nFinally, create the index from a list containing documents:\n\n```python\nstorage_context = StorageContext.from_defaults(vector_store=store)\n\nindex = VectorStoreIndex.from_documents(\n    documents, storage_context=storage_context\n)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index vector_stores azurecosmosnosql integration",
    "version": "1.0.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "074002ad1688ca9ea27ddad62b4c5b1cd63a919384a460c8a463078100b96810",
                "md5": "cfac3b407165a90dbd681eed1f1252b9",
                "sha256": "d223f1d2cdaa24767db77f9ef48c8a11eb98d65300718ac44aa84ba3ff125d0e"
            },
            "downloads": -1,
            "filename": "llama_index_vector_stores_azurecosmosnosql-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cfac3b407165a90dbd681eed1f1252b9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8.1",
            "size": 4708,
            "upload_time": "2024-09-09T18:07:26",
            "upload_time_iso_8601": "2024-09-09T18:07:26.472573Z",
            "url": "https://files.pythonhosted.org/packages/07/40/02ad1688ca9ea27ddad62b4c5b1cd63a919384a460c8a463078100b96810/llama_index_vector_stores_azurecosmosnosql-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7cab428575966f623cab649771c77f360e833bc6293c0285a4cf5fb9e1dbdf62",
                "md5": "4a7fcb999f1ae785a195d70adf247953",
                "sha256": "054474ee3012baac81efc8256ecda4260b3497e81c8ec4f91eeaf31087814c18"
            },
            "downloads": -1,
            "filename": "llama_index_vector_stores_azurecosmosnosql-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4a7fcb999f1ae785a195d70adf247953",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8.1",
            "size": 4243,
            "upload_time": "2024-09-09T18:07:27",
            "upload_time_iso_8601": "2024-09-09T18:07:27.433033Z",
            "url": "https://files.pythonhosted.org/packages/7c/ab/428575966f623cab649771c77f360e833bc6293c0285a4cf5fb9e1dbdf62/llama_index_vector_stores_azurecosmosnosql-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 18:07:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-vector-stores-azurecosmosnosql"
}
        
Elapsed time: 1.00699s