pinecone-plugin-records


Namepinecone-plugin-records JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://www.pinecone.io
SummaryRecords plugin for Pinecone SDK
upload_time2024-12-20 18:28:25
maintainerNone
docs_urlNone
authorPinecone Systems, Inc.
requires_python<4.0,>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Records API plugin for Pinecone python SDK

## Installation

The plugin is distributed separately from the core python SDK.

```
# Install the base python SDK, version 5.4.0 or higher
pip install pinecone

# And also the plugin functionality
pip install pinecone-plugin-records
```

## Usage

This plugin extends the functionality of the `pinecone` SDK to allow creating indexes for specific embedding models, and upserting and searching records in these indexes. These operations are added to the existing `Pinecone` and `Index` classes.

Models currently supported:

- [multilingual-e5-large](https://arxiv.org/pdf/2402.05672)

## Create an index for an embedding model, upsert records, and search

The following example highlights how to use the `Pinecone` class to create a new index for an embedding model, and then uses `Index` to upsert and search some records.

```python
from pinecone import Pinecone

pc = Pinecone(api_key="<<PINECONE_API_KEY>>")

# Create an index for your embedding model
index_model = pc.create_index_for_model(
    name="my-model-index",
    cloud="aws",
    region="us-east-1",
    embed={
        "model":"multilingual-e5-large",
        "field_map": {"text": "my_text_field"}
    }
)

# establish an index connection
index = pc.Index(host=index_model.host)

# upsert records
index.upsert_records(
    "my-namespace",
    [
        {
            "_id": "test1",
            "my_text_field": "Apple is a popular fruit known for its sweetness and crisp texture.",
        },
        {
            "_id": "test2",
            "my_text_field": "The tech company Apple is known for its innovative products like the iPhone.",
        },
        {
            "_id": "test3",
            "my_text_field": "Many people enjoy eating apples as a healthy snack.",
        },
        {
            "_id": "test4",
            "my_text_field": "Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.",
        },
        {
            "_id": "test5",
            "my_text_field": "An apple a day keeps the doctor away, as the saying goes.",
        },
        {
            "_id": "test6",
            "my_text_field": "Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership.",
        },
    ],
)

# search for similar records
response = index.search_records(
    namespace="test-namespace",
    query={
        "inputs":{
            "text": "Apple corporation",
        },
        "top_k":3,
    },
    rerank={
        "model": "bge-reranker-v2-m3",
        "rank_fields": ["my_text_field"],
        "top_n": 3,
    },
)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.pinecone.io",
    "name": "pinecone-plugin-records",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Pinecone Systems, Inc.",
    "author_email": "support@pinecone.io",
    "download_url": "https://files.pythonhosted.org/packages/1b/6a/bec42a441974127a2d83400af4071657c20da681a221af7c9aebf032323f/pinecone_plugin_records-1.1.0.tar.gz",
    "platform": null,
    "description": "# Records API plugin for Pinecone python SDK\n\n## Installation\n\nThe plugin is distributed separately from the core python SDK.\n\n```\n# Install the base python SDK, version 5.4.0 or higher\npip install pinecone\n\n# And also the plugin functionality\npip install pinecone-plugin-records\n```\n\n## Usage\n\nThis plugin extends the functionality of the `pinecone` SDK to allow creating indexes for specific embedding models, and upserting and searching records in these indexes. These operations are added to the existing `Pinecone` and `Index` classes.\n\nModels currently supported:\n\n- [multilingual-e5-large](https://arxiv.org/pdf/2402.05672)\n\n## Create an index for an embedding model, upsert records, and search\n\nThe following example highlights how to use the `Pinecone` class to create a new index for an embedding model, and then uses `Index` to upsert and search some records.\n\n```python\nfrom pinecone import Pinecone\n\npc = Pinecone(api_key=\"<<PINECONE_API_KEY>>\")\n\n# Create an index for your embedding model\nindex_model = pc.create_index_for_model(\n    name=\"my-model-index\",\n    cloud=\"aws\",\n    region=\"us-east-1\",\n    embed={\n        \"model\":\"multilingual-e5-large\",\n        \"field_map\": {\"text\": \"my_text_field\"}\n    }\n)\n\n# establish an index connection\nindex = pc.Index(host=index_model.host)\n\n# upsert records\nindex.upsert_records(\n    \"my-namespace\",\n    [\n        {\n            \"_id\": \"test1\",\n            \"my_text_field\": \"Apple is a popular fruit known for its sweetness and crisp texture.\",\n        },\n        {\n            \"_id\": \"test2\",\n            \"my_text_field\": \"The tech company Apple is known for its innovative products like the iPhone.\",\n        },\n        {\n            \"_id\": \"test3\",\n            \"my_text_field\": \"Many people enjoy eating apples as a healthy snack.\",\n        },\n        {\n            \"_id\": \"test4\",\n            \"my_text_field\": \"Apple Inc. has revolutionized the tech industry with its sleek designs and user-friendly interfaces.\",\n        },\n        {\n            \"_id\": \"test5\",\n            \"my_text_field\": \"An apple a day keeps the doctor away, as the saying goes.\",\n        },\n        {\n            \"_id\": \"test6\",\n            \"my_text_field\": \"Apple Computer Company was founded on April 1, 1976, by Steve Jobs, Steve Wozniak, and Ronald Wayne as a partnership.\",\n        },\n    ],\n)\n\n# search for similar records\nresponse = index.search_records(\n    namespace=\"test-namespace\",\n    query={\n        \"inputs\":{\n            \"text\": \"Apple corporation\",\n        },\n        \"top_k\":3,\n    },\n    rerank={\n        \"model\": \"bge-reranker-v2-m3\",\n        \"rank_fields\": [\"my_text_field\"],\n        \"top_n\": 3,\n    },\n)\n```\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Records plugin for Pinecone SDK",
    "version": "1.1.0",
    "project_urls": {
        "Documentation": "https://pinecone.io/docs",
        "Homepage": "https://www.pinecone.io"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f366c39d955d6a089deb9380f5f9a7e15a6a1f7c7e68b0600c310e05c0556257",
                "md5": "997d70541d9f0a99cb93c5e721060b57",
                "sha256": "2107aea4767454c98ef32e42ec5e573a14522c3842c27f95e5bffb860df40230"
            },
            "downloads": -1,
            "filename": "pinecone_plugin_records-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "997d70541d9f0a99cb93c5e721060b57",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 267431,
            "upload_time": "2024-12-20T18:28:23",
            "upload_time_iso_8601": "2024-12-20T18:28:23.345481Z",
            "url": "https://files.pythonhosted.org/packages/f3/66/c39d955d6a089deb9380f5f9a7e15a6a1f7c7e68b0600c310e05c0556257/pinecone_plugin_records-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b6abec42a441974127a2d83400af4071657c20da681a221af7c9aebf032323f",
                "md5": "f21f34d974bd089c566387e8f2423974",
                "sha256": "48452cd2eac54679b1c4571a0b2555f11607ade49f6a5fd6b4b9ed19215b999b"
            },
            "downloads": -1,
            "filename": "pinecone_plugin_records-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f21f34d974bd089c566387e8f2423974",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 108907,
            "upload_time": "2024-12-20T18:28:25",
            "upload_time_iso_8601": "2024-12-20T18:28:25.994332Z",
            "url": "https://files.pythonhosted.org/packages/1b/6a/bec42a441974127a2d83400af4071657c20da681a221af7c9aebf032323f/pinecone_plugin_records-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-20 18:28:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pinecone-plugin-records"
}
        
Elapsed time: 1.79579s