streamlit-pinecone


Namestreamlit-pinecone JSON
Version 1.0.0 PyPI version JSON
download
home_page
SummaryA Streamlit extension for connecting to Pinecone indexes.
upload_time2023-12-08 05:34:00
maintainer
docs_urlNone
author
requires_python>=3.9
licenseMIT License Copyright (c) 2023 eliotjlee Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords streamlit pinecone data connection vector database streamlit component
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## Streamlit Pinecone Connection

This repo includes the `PineconeConnection` class, an `st.connection` wrapper for integrating the Pinecone API into Streamlit applications. It facilitates the use of Pinecone's powerful indexing and querying capabilities directly within Streamlit, making it ideal for building sophisticated search and data retrieval applications.

### Features

- **Instantiate Pinecone Index**: Seamlessly connect to a Pinecone index.
- **Rich Query Capabilities**: Perform queries with embeddings, retrieve top_k similar items.
- **Index Insights**: Gather statistics about the Pinecone index's contents.
- **Comprehensive Vector Operations**: Includes methods for deleting, updating, fetching, and upserting vectors in a namespace.
- **Caching for Performance**: Results from various methods are cached to enhance the performance of your Streamlit app.

### Installation

Install the package using pip:

```
pip install streamlit-pinecone
```

### Usage

Import and initialize the connection in your Streamlit app:

```python
from streamlit_pinecone import PineconeConnection

# Initialize the connection
conn = PineconeConnection(api_key='your_api_key', environment='your_environment', index_name='your_index_name')

# Use the connection
results = conn.query([...])
```

### Example

![Movie Matcher Demo](https://i.imgur.com/JMEepUP.jpg)

For a live demo, check out [Movie Matcher](movie-matcher.streamlit.app)!

You can find the source code under `\demo\` directory.



## Documentation

### PineconeConnection Class

The `PineconeConnection` class provides methods to interact with Pinecone indexes within a Streamlit app.

---

#### `index()`
**Returns**: `pinecone.Index`  
**Description**: Returns the Pinecone index instance.

---

#### `query(embeddings, top_k=10, ttl=3600, **kwargs)`
**Parameters**:
  - `embeddings`: List of embeddings for the query.
  - `top_k` (int, optional): Number of top similar items to return. Default is 10.
  - `ttl` (int, optional): Time-to-live for cache in seconds. Default is 3600.  
**Returns**: Dictionary of query results.  
**Description**: Queries the Pinecone index with provided embeddings.

---

#### `describe_index_stats(ttl=3600, **kwargs)`
**Parameters**:
  - `ttl` (int, optional): Time-to-live for cache in seconds. Default is 3600.  
**Returns**: String describing index statistics.  
**Description**: Provides statistics about the Pinecone index's contents.

---

#### `delete(ids, delete_all=None, namespace=None, filter=None, ttl=3600, **kwargs)`
**Parameters**:
  - `ids` (list): List of IDs to delete.
  - `delete_all` (bool, optional): Flag to delete all vectors.
  - `namespace` (str, optional): Namespace from which to delete.
  - `filter` (dict, optional): Filter criteria for deletion.
  - `ttl` (int, optional): Time-to-live for cache in seconds.  
**Returns**: Dictionary of deletion results.  
**Description**: Deletes vectors by ID from a namespace.

---

#### `update(id, values=None, sparse_values=None, set_metadata=None, namespace=None, ttl=3600, **kwargs)`
**Parameters**:
  - `id` (str): ID of the vector to update.
  - `values`, `sparse_values`, `set_metadata`: Data for update.
  - `namespace` (str, optional): Namespace to update.
  - `ttl` (int, optional): Time-to-live for cache in seconds.  
**Returns**: Dictionary of update results.  
**Description**: Updates a vector in a namespace.

---

#### `fetch(ids, ttl=3600, namespace=None, **kwargs)`
**Parameters**:
  - `ids` (list): List of IDs to fetch.
  - `ttl` (int, optional): Time-to-live for cache in seconds.
  - `namespace` (str, optional): Namespace to fetch from.  
**Returns**: Dictionary of fetched vectors.  
**Description**: Fetches vectors by ID from a namespace.

---

#### `upsert(vectors, ttl=3600, namespace=None, **kwargs)`
**Parameters**:
  - `vectors` (list): List of vectors to upsert.
  - `ttl` (int, optional): Time-to-live for cache in seconds.
  - `namespace` (str, optional): Namespace to upsert into.  
**Returns**: Dictionary of upsert results.  
**Description**: Writes vectors into a namespace.

### License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

For more information, visit the [GitHub repository](https://github.com/yourusername/your-repo).

### Contact

Eliot Lee - eliotlee2026@u.northwestern.edu

### Acknowledgments

Special thanks to the Streamlit team and the Streamlit Developer Relations team for their support and for featuring this project in the Streamlit components gallery.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "streamlit-pinecone",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "streamlit,pinecone,data connection,vector database,streamlit component",
    "author": "",
    "author_email": "Eliot Lee <eliotlee2026@u.northwestern.edu>",
    "download_url": "https://files.pythonhosted.org/packages/b3/ef/86827d4a5a17ee4656b2707c29245b9caeec50a37a3b3cf97f14f93ac3e2/streamlit-pinecone-1.0.0.tar.gz",
    "platform": null,
    "description": "## Streamlit Pinecone Connection\n\nThis repo includes the `PineconeConnection` class, an `st.connection` wrapper for integrating the Pinecone API into Streamlit applications. It facilitates the use of Pinecone's powerful indexing and querying capabilities directly within Streamlit, making it ideal for building sophisticated search and data retrieval applications.\n\n### Features\n\n- **Instantiate Pinecone Index**: Seamlessly connect to a Pinecone index.\n- **Rich Query Capabilities**: Perform queries with embeddings, retrieve top_k similar items.\n- **Index Insights**: Gather statistics about the Pinecone index's contents.\n- **Comprehensive Vector Operations**: Includes methods for deleting, updating, fetching, and upserting vectors in a namespace.\n- **Caching for Performance**: Results from various methods are cached to enhance the performance of your Streamlit app.\n\n### Installation\n\nInstall the package using pip:\n\n```\npip install streamlit-pinecone\n```\n\n### Usage\n\nImport and initialize the connection in your Streamlit app:\n\n```python\nfrom streamlit_pinecone import PineconeConnection\n\n# Initialize the connection\nconn = PineconeConnection(api_key='your_api_key', environment='your_environment', index_name='your_index_name')\n\n# Use the connection\nresults = conn.query([...])\n```\n\n### Example\n\n![Movie Matcher Demo](https://i.imgur.com/JMEepUP.jpg)\n\nFor a live demo, check out [Movie Matcher](movie-matcher.streamlit.app)!\n\nYou can find the source code under `\\demo\\` directory.\n\n\n\n## Documentation\n\n### PineconeConnection Class\n\nThe `PineconeConnection` class provides methods to interact with Pinecone indexes within a Streamlit app.\n\n---\n\n#### `index()`\n**Returns**: `pinecone.Index`  \n**Description**: Returns the Pinecone index instance.\n\n---\n\n#### `query(embeddings, top_k=10, ttl=3600, **kwargs)`\n**Parameters**:\n  - `embeddings`: List of embeddings for the query.\n  - `top_k` (int, optional): Number of top similar items to return. Default is 10.\n  - `ttl` (int, optional): Time-to-live for cache in seconds. Default is 3600.  \n**Returns**: Dictionary of query results.  \n**Description**: Queries the Pinecone index with provided embeddings.\n\n---\n\n#### `describe_index_stats(ttl=3600, **kwargs)`\n**Parameters**:\n  - `ttl` (int, optional): Time-to-live for cache in seconds. Default is 3600.  \n**Returns**: String describing index statistics.  \n**Description**: Provides statistics about the Pinecone index's contents.\n\n---\n\n#### `delete(ids, delete_all=None, namespace=None, filter=None, ttl=3600, **kwargs)`\n**Parameters**:\n  - `ids` (list): List of IDs to delete.\n  - `delete_all` (bool, optional): Flag to delete all vectors.\n  - `namespace` (str, optional): Namespace from which to delete.\n  - `filter` (dict, optional): Filter criteria for deletion.\n  - `ttl` (int, optional): Time-to-live for cache in seconds.  \n**Returns**: Dictionary of deletion results.  \n**Description**: Deletes vectors by ID from a namespace.\n\n---\n\n#### `update(id, values=None, sparse_values=None, set_metadata=None, namespace=None, ttl=3600, **kwargs)`\n**Parameters**:\n  - `id` (str): ID of the vector to update.\n  - `values`, `sparse_values`, `set_metadata`: Data for update.\n  - `namespace` (str, optional): Namespace to update.\n  - `ttl` (int, optional): Time-to-live for cache in seconds.  \n**Returns**: Dictionary of update results.  \n**Description**: Updates a vector in a namespace.\n\n---\n\n#### `fetch(ids, ttl=3600, namespace=None, **kwargs)`\n**Parameters**:\n  - `ids` (list): List of IDs to fetch.\n  - `ttl` (int, optional): Time-to-live for cache in seconds.\n  - `namespace` (str, optional): Namespace to fetch from.  \n**Returns**: Dictionary of fetched vectors.  \n**Description**: Fetches vectors by ID from a namespace.\n\n---\n\n#### `upsert(vectors, ttl=3600, namespace=None, **kwargs)`\n**Parameters**:\n  - `vectors` (list): List of vectors to upsert.\n  - `ttl` (int, optional): Time-to-live for cache in seconds.\n  - `namespace` (str, optional): Namespace to upsert into.  \n**Returns**: Dictionary of upsert results.  \n**Description**: Writes vectors into a namespace.\n\n### License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\nFor more information, visit the [GitHub repository](https://github.com/yourusername/your-repo).\n\n### Contact\n\nEliot Lee - eliotlee2026@u.northwestern.edu\n\n### Acknowledgments\n\nSpecial thanks to the Streamlit team and the Streamlit Developer Relations team for their support and for featuring this project in the Streamlit components gallery.\n\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 eliotjlee  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A Streamlit extension for connecting to Pinecone indexes.",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/eliotjlee/streamlit-pinecone"
    },
    "split_keywords": [
        "streamlit",
        "pinecone",
        "data connection",
        "vector database",
        "streamlit component"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0643e24e39035566e44d0c3bb19a43aac94899358c270c53fe383108317496a0",
                "md5": "8525cc5fedfb9d23bd0847abbc1f6197",
                "sha256": "d235843ea13c2cdd877309d8c7b7b9883dbfcff6d1e4b4624401814402a00717"
            },
            "downloads": -1,
            "filename": "streamlit_pinecone-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8525cc5fedfb9d23bd0847abbc1f6197",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6490,
            "upload_time": "2023-12-08T05:33:59",
            "upload_time_iso_8601": "2023-12-08T05:33:59.007372Z",
            "url": "https://files.pythonhosted.org/packages/06/43/e24e39035566e44d0c3bb19a43aac94899358c270c53fe383108317496a0/streamlit_pinecone-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b3ef86827d4a5a17ee4656b2707c29245b9caeec50a37a3b3cf97f14f93ac3e2",
                "md5": "178169274afae7d2d471af46c6b66d09",
                "sha256": "b28d0e0a32136c356068a751aa42756550c0a73e50d31804a123adbc35a3ddcb"
            },
            "downloads": -1,
            "filename": "streamlit-pinecone-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "178169274afae7d2d471af46c6b66d09",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 6291,
            "upload_time": "2023-12-08T05:34:00",
            "upload_time_iso_8601": "2023-12-08T05:34:00.992382Z",
            "url": "https://files.pythonhosted.org/packages/b3/ef/86827d4a5a17ee4656b2707c29245b9caeec50a37a3b3cf97f14f93ac3e2/streamlit-pinecone-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-08 05:34:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eliotjlee",
    "github_project": "streamlit-pinecone",
    "github_not_found": true,
    "lcname": "streamlit-pinecone"
}
        
Elapsed time: 0.14791s