PineconeUtils
v0.0.4
Pineconeutils是一个Python模块,旨在处理和处理使用Pinecone,Cohere和OpenAI服务嵌入和索引的数据。该实用程序模块使其易于加载,块,准备和UPSERT数据到Pinecone索引中,非常适合涉及涉及文本嵌入和检索系统(RAG)的应用程序。
.txt , .docx和.pdf文件加载文本数据。要安装Pineconeutils,您可以使用PIP:
pip install pineconeutils这是如何使用Pineconeutils的一个快速示例:
首先,确保您拥有必要的API键和设置信息:
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 "从受支持的文件格式加载数据:
from pineconeutils import PineconeUtils
# Create instance of PineconeUtils
pinecone = PineconeUtils(pinecone_api_key=pinecone_api_key, openai_api_key=openai_api_key,cohere_api_key =cohere_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)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 " )chunks = pinecone.chunk_data(data, chunk_size=100, chunk_overlap=10)
print( " Data Chunks: " , chunks)
prepared_data = pinecone.prepare_data(chunks, model= " embed-english-v3.0 " , service= " cohere " ,input_type= " search_document " )有关镶嵌嵌入的更多信息:膜嵌入
successful = pinecone.upsert_data(prepared_data)
print( " Data upsertion was " , " successful " if successful else " unsuccessful " )为了为Pineconeutil的开发做出贡献,您可以克隆存储库并提交拉动请求。
如果您遇到任何问题或有疑问,请在GitHub存储库上提出问题。
该项目是根据MIT许可证获得许可的 - 有关详细信息,请参见许可证文件。