PineconeUtils is a Python module designed to handle and process data for embedding and indexing using Pinecone, Cohere, and OpenAI services. This utility module makes it easy to load, chunk, prepare, and upsert data into a Pinecone index, making it ideal for applications involving text embedding and retrieval augmented systems(RAG)
Project description
PineconeUtils
PineconeUtils is a Python module designed to handle and process data for embedding and indexing using Pinecone, Cohere, and OpenAI services. This utility module makes it easy to load, chunk, prepare, and upsert data into a Pinecone index, making it ideal for applications involving text embedding and retrieval systems(RAG).
Features
- Load text data from
.txt
,.docx
, and.pdf
files. - Chunk text data for processing.
- Prepare embeddings using either Cohere or OpenAI models.
- Upsert prepared data into a Pinecone index.
Installation
To install PineconeUtils, you can use pip:
pip install pineconeutils
Usage
Here's a quick example of how to use PineconeUtils:
Setup
First, ensure you have the necessary API keys and setup information:
pinecone_api_key = "your_pinecone_api_key"
cohere_api_key = "your_cohere_api_key"
openai_api_key = "your_openai_api_key"
index_name = "your_index_name"
namespace_id = "your_namespace_id"
Load Data
Load data from a supported file format:
from pineconeutils import PineconeUtils
# Create instance of PineconeUtils
pinecone = PineconeUtils(pinecone_api_key=cohere_api_key, openai_api_key=openai_api_key, index_name=index_name, namespace_id=namespace_id)
path = "path_to_your_file.docx"
data = pinecone.load_data(path)
print("Loaded Data:", data)
Process Data
Chunk and prepare data for embedding:
chunks = pinecone.chunk_data(data, chunk_size=100, chunk_overlap=10)
print("Data Chunks:", chunks)
prepared_data = pinecone.prepare_data(chunks, model="text-embedding-ada-002", service="openai")
Upsert Data
Upsert data into Pinecone index:
successful = pinecone.upsert_data(prepared_data)
print("Data upsertion was", "successful" if successful else "unsuccessful")
Development
To contribute to the development of PineconeUtils, you can clone the repository and submit pull requests.
Support
If you encounter any issues or have questions, please file an issue on the GitHub repository.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for pineconeutils-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b99223f9c4e1990953783ecd6a8e544c7d6eb1a5cb7a0b008d2372729ffca41 |
|
MD5 | 9b39c4d48ca8a86ed3c4e80d200bc617 |
|
BLAKE2b-256 | 6ed05419b5e75a6432336dbe7c77abb6235d9f9d3a882255903f7b774729566b |