PineconeVectorStore
π Usage of PineconeVectorStore
PineconeVectorStoreThe advantage of using Pinecone is that it offers a serverless package where you only pay for what you use. You don't need your own AWS, Google Cloud or Azure for this. This model is highly cost-effective as it eliminates overcapacity and unnecessary expenses.
Serverless Landingpage: https://www.pinecone.io/product/
Serverless pricing: https://www.pinecone.io/pricing/
To start using Pinecone in your projects, you need to integrate the pinecone-php repository. Install this repository using Composer by executing the following command:
composer require probots-io/pinecone-phpAdding Vector addVector
// Vector Class
use EasyAI\Embeddings\Vector;
// Pinecone Vector Store
use EasyAI\VectorStores\Pinecone\PineconeVectorStore;
// OpenAI Embedding
use EasyAI\Embeddings\EmbeddingGenerator\OpenAI\OpenAI3LargeEmbeddingGenerator; // In this example I am using the OpenAI3LargeEmbeddingGenerator
// Text to embed
$text = "I need support for Shopware 6";
// Embedding
$embeddingGenerator = new OpenAI3LargeEmbeddingGenerator();
$embedding = $embeddingGenerator->embedText($text);
// Create new vector object
$vector = new Vector();
//$vector->id = "id_84723"; // Additional: If not set hash will be used for id
//$vector->namespace = "MyNamespace"; // Additional: If not set, pinecone Default namespace
$vector->content = $text; // Add text for meta info in pinecone
$vector->embedding = $embedding; // Add vector array to vector class
// Save vector in Pinecone
$vectorStore = new PineconeVectorStore();
$vectorStore->addVector($vector); // voidDeleting Vector deleteVector
Search Vector similaritySearch
Last updated
Was this helpful?