1.0.5 • Published 9 months ago
@hitmiss/pinecone v1.0.5
@hitmiss/pinecone - Semantic Caching with Pinecone
Overview
@hitmiss/pinecone is a TypeScript-based caching system that leverages Pinecone and vector embeddings to store and retrieve data based on semantic similarity. Instead of traditional key-value storage, it allows querying data using meaning-based searches.
Features
✅ Stores values as vector embeddings for efficient similarity-based retrieval.
✅ Uses Pinecone for scalable, high-performance vector storage.
✅ Supports semantic queries, retrieving the most relevant stored data.
✅ Adjustable minimum similarity threshold for refined search results.
Installation
Ensure you have Node.js installed, then install the required dependencies:
pnpm add @pinecone-database/pinecone dotenvSetup
Create a .env file and add your Pinecone API key:
PINECONE_API_KEY=your_pinecone_api_key_hereUsage
1. Import and Initialize
import SemanticCache from '@hitmiss/pinecone';
const cache = new SemanticCache();2. Store Data
await cache.set("greeting", "Hello, how are you?");3. Retrieve Data
const result = await cache.get("hello", 0.75);
console.log(result); // Returns the most relevant stored valueError Handling
- Throws an error if Pinecone API key is missing.
- Returns
nullif no relevant data is found.
License
This project is licensed under the MIT License.