{"_id":"@upstash/semantic-cache","_rev":"20-c61caa60bb8898aac0bb31d937b6faa7","name":"@upstash/semantic-cache","dist-tags":{"canary":"1.0.5-canary","latest":"1.0.5"},"versions":{"1.0.1":{"name":"@upstash/semantic-cache","version":"1.0.1","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.1","maintainers":[{"name":"hezarfen","email":"ogzhan11@gmail.com"},{"name":"chronark","email":"dev@chronark.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"upstashnpm","email":"enes@upstash.com"},{"name":"ademilter-upstash","email":"adem@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"18d574185b99d45df1e7174421d3a8eaf52d4e5f","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.1.tgz","fileCount":7,"integrity":"sha512-xLTUl8gig3vBCXWYR+di9CkmQIN9EWbKfAmmRP+eVIsPMJgcUUASGMK/tJ0AgUUJFlSTBpYErbIy3r1E5wDCjQ==","signatures":[{"sig":"MEYCIQDOI1bvPuUghjceaqHr2vYcrg5bvkoHkftHpxMZpjOohgIhAL+XxmeMHsGDRfLHL1/YV+m8txw749cUY8vpH5IhgzXq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12175},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"65114935561ad76dd2b645a8e342dde49c359eae","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"hezarfen","email":"ogzhan11@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.5.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@upstash/vector":"^1.0.7"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"latest","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.1_1714055014890_0.14724133511267778","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@upstash/semantic-cache","version":"1.0.2","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.2","maintainers":[{"name":"hezarfen","email":"ogzhan11@gmail.com"},{"name":"chronark","email":"dev@chronark.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"upstashnpm","email":"enes@upstash.com"},{"name":"ademilter-upstash","email":"adem@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"26998e973995369f89dd8e40bb74be6a98450417","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.2.tgz","fileCount":7,"integrity":"sha512-G/WuZ5VdDTGJlP1idLxyAIB7mO0WxCbn7spznDAx/OBeVb7sCIrAOknDpNaanlSQ+AwE9sb4cfVqp3ftvmcl2Q==","signatures":[{"sig":"MEUCIQDoCwT6oCxPrtQE/GqAADeiVmGMpAo+f4AXr/RMkCV+IgIgJdCzXrWyEPZn549gCMg02QVDT6zVFaDJcayXhcnbZjo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":11999},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"084ef9e6120b6efadc4ae18b2c38f317c72ead78","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"hezarfen","email":"ogzhan11@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.5.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"18.20.2","dependencies":{"@upstash/vector":"^1.0.7"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"latest","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.2_1714487245602_0.2929473836766614","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"@upstash/semantic-cache","version":"1.0.3","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.3","maintainers":[{"name":"hezarfen","email":"ogzhan11@gmail.com"},{"name":"chronark","email":"dev@chronark.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"upstashnpm","email":"enes@upstash.com"},{"name":"ademilter-upstash","email":"adem@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"e7243c7f3dcccb822ba4c2291d423dd2ef3656ac","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.3.tgz","fileCount":7,"integrity":"sha512-cxRDDlNmO1EgKdf8pOkCxJLQj3quZxJCycG/K0u41IQoYJsSILEEu+9Rct8XINEJI4Ft6dR6njt+eKMf5lr15w==","signatures":[{"sig":"MEYCIQCnhUytkbebfugUYtIX/BgFtR2D0jVz4XLvX3CLIEpVsQIhANEhQsuoYpSkWgdQGT76WxkHxh47XL5bMsy7xp5oU8wb","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":12162},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"084ef9e6120b6efadc4ae18b2c38f317c72ead78","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"hezarfen","email":"ogzhan11@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.5.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"20.12.2","dependencies":{"@upstash/vector":"^1.0.7"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"latest","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.3_1714488590599_0.39984935162449764","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"@upstash/semantic-cache","version":"1.0.4","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.4","maintainers":[{"name":"fahreddin.ozcan","email":"fahreddin@upstash.com"},{"name":"hezarfen","email":"ogzhan11@gmail.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"upstashnpm","email":"enes@upstash.com"},{"name":"ademilter-upstash","email":"adem@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"0905a9d36a26ae717387fded244fcf98c7a0a889","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.4.tgz","fileCount":7,"integrity":"sha512-DFoek973UiyC1o2vVPMfteBTMa+Kx822thHLoDF+orPH4ufTaqd0fbefwg1cZg4V1RK+V0BGdEFc+RuBLknSVg==","signatures":[{"sig":"MEUCIQC3vdUMgH8skqRJtk4OwKtOCxOFVtg/NQDK0kjg9k9ykgIgWTpVDKjWX5k2r+iinFYT1Jt1DhS3nmLnWsdHGXZb1NQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":13404},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"1fd7dbdc5c1b75a29d5e6d126062e49c42fbdbfa","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"hezarfen","email":"ogzhan11@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.7.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"18.20.4","dependencies":{"@upstash/vector":"^1.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"latest","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.4_1723210709943_0.776926156463827","host":"s3://npm-registry-packages"}},"1.0.5-canary":{"name":"@upstash/semantic-cache","version":"1.0.5-canary","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.5-canary","maintainers":[{"name":"cahidarda","email":"cahidardaooz@gmail.com"},{"name":"fahreddin.ozcan","email":"fahreddin@upstash.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"c729e510d069c3bb829cfc22f418ccd6ec250ebb","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.5-canary.tgz","fileCount":7,"integrity":"sha512-613N1Lxx9glYrPjitG21xfGCJmir2k9LykOdYezBNtzXhz6xN4PTCFw8Zb2BGF1L4zaxh0RJ3jsjpGfDnDBMVg==","signatures":[{"sig":"MEYCIQCk0+7dtW6Cvo63IEmHQuwA3AKSnuDfCL/4vSMYrMUwhgIhAOzByHlQfL+q3S8TwgWNDjx5HgINJQj6mEpX1Phk2DLL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15321},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"fcc0e7354ffbebaa8311e0e1c9f882a07f50eb21","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"cahidarda","email":"cahidardaooz@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.7.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"18.20.4","dependencies":{"@upstash/vector":"^1.1.3"},"_hasShrinkwrap":false,"readmeFilename":"readme.md","devDependencies":{"tsup":"^8.2.3","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.5-canary_1732172154602_0.563294259872962","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"@upstash/semantic-cache","version":"1.0.5","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","_id":"@upstash/semantic-cache@1.0.5","maintainers":[{"name":"cahidarda","email":"cahidardaooz@gmail.com"},{"name":"fahreddin.ozcan","email":"fahreddin@upstash.com"},{"name":"buggyhunter","email":"bill@upstash.com"},{"name":"mdogan","email":"mehmet@upstash.com"}],"homepage":"https://upstash.com/vector","bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"dist":{"shasum":"b1eeac82565bb968f606073a74b79d4bf4c2666f","tarball":"https://registry.npmjs.org/@upstash/semantic-cache/-/semantic-cache-1.0.5.tgz","fileCount":7,"integrity":"sha512-H+r5SGLQ1KAMvxGOogBnYXTzWuHa4epBbmbKo66Jrksc2b20gLDkH9v0dE6ZsRFKQ8BdFc8To7t62VrFsRaxCg==","signatures":[{"sig":"MEUCIErOxynboBfkdpIzH3kqJRyOd7+qBaSLZ3DtlqtNEDU2AiEA8Ai+QMj246zLWsOYUJVUsIvfaxMM41A++rUa5biqxL0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":15314},"main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","gitHead":"50894ae555bc90da57d6f19646eac2ddef90681f","scripts":{"fmt":"prettier --write .","lint":"tsc && eslint \"src/**/*.{js,ts,tsx}\" --quiet --fix","test":"bun test","build":"tsup","prepare":"husky install"},"_npmUser":{"name":"cahidarda","email":"cahidardaooz@gmail.com"},"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"_npmVersion":"10.7.0","description":"A Semantic cache built on top of Upstash Vector DB","directories":{},"_nodeVersion":"18.20.4","dependencies":{"@upstash/vector":"^1.1.3"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.2.3","husky":"^9.0.10","eslint":"^8","vitest":"latest","prettier":"^3.2.5","bun-types":"latest","typescript":"^5.4.5","@types/node":"^20.12.2","@commitlint/cli":"^19.2.2","eslint-plugin-unicorn":"^51.0.1","@typescript-eslint/parser":"^7.0.1","@commitlint/config-conventional":"^19.2.2","@typescript-eslint/eslint-plugin":"^7.0.1"},"_npmOperationalInternal":{"tmp":"tmp/semantic-cache_1.0.5_1732172884331_0.39883128469757656","host":"s3://npm-registry-packages"}}},"time":{"created":"2024-04-25T14:23:34.782Z","modified":"2025-11-25T13:17:58.747Z","1.0.0":"2024-04-19T18:55:11.869Z","1.0.1":"2024-04-25T14:23:35.033Z","1.0.2":"2024-04-30T14:27:25.792Z","1.0.3":"2024-04-30T14:49:50.764Z","1.0.4":"2024-08-09T13:38:30.137Z","1.0.5-canary":"2024-11-21T06:55:54.757Z","1.0.5":"2024-11-21T07:08:04.497Z"},"bugs":{"url":"https://github.com/upstash/semantic-cache/issues"},"author":{"name":"Enes Akar","email":"enes@upstash.com"},"license":"ISC","homepage":"https://upstash.com/vector","keywords":["vector","upstash","db","semantic-cache","cache","classification"],"repository":{"url":"git+https://github.com/upstash/semantic-cache.git","type":"git"},"description":"A Semantic cache built on top of Upstash Vector DB","maintainers":[{"email":"mehmet@upstash.com","name":"mdogan"},{"email":"bill@upstash.com","name":"buggyhunter"},{"email":"cahidardaooz@gmail.com","name":"cahidarda"},{"email":"fahreddin@upstash.com","name":"fahreddin.ozcan"},{"email":"enes@upstash.com","name":"upstashnpm"},{"email":"hello@joshtriedcoding.com","name":"joshtc"},{"email":"burak@upstash.com","name":"burak-ups"},{"email":"shannon@upstash.com","name":"shannonr"}],"readme":"# Semantic Cache\n\n\nSemantic Cache is a tool for caching natural text based on semantic similarity. It's ideal for any task that involves querying or retrieving information based on meaning, such as natural language classification or caching AI responses. Two pieces of text can be similar but not identical (e.g., \"great places to check out in Spain\" vs. \"best places to visit in Spain\"). Traditional caching doesn't recognize this semantic similarity and misses opportunities for reuse.\n\nSemantic Cache allows you to:\n\n- Easily classify natural text into predefined categories\n- Avoid redundant LLM work by caching AI responses\n- Reduce API latency by responding to similar queries with already cached values\n\n<img src=\"./assets/how-semantic-cache-works.png\" width=\"700\">\n\n## Highlights\n\n- **Uses semantic similarity**: Stores cache entries by their meaning, not just the literal characters\n- **Handles synonyms**: Recognizes and handles synonyms\n- **Multi-language support**: Works across different languages (if configured with multilingual vector models)\n- **Complex query support**: Understands long and nested user queries\n- **Easy integration**: Simple API for usage in Node.js applications\n- **Customizable**: Set a custom proximity threshold to filter out less relevant results\n\n## Getting Started\n\n### Prerequisites\n\n- An Upstash Vector database (create one [here](https://console.upstash.com/vector))\n\n### Installation\n\nInstall the package:\n\n```bash\nnpm install @upstash/semantic-cache @upstash/vector\n```\n\n### Setup\n\nFirst, create an Upstash Vector database [here](https://console.upstash.com/vector). You'll need the `url` and `token` credentials to connect your semantic cache. Important: Choose any pre-made embedding model when creating your database.\n\n> [!NOTE]  \n> Different embedding models are great for different use cases. For example, if low latency is a priority, choose a model with a smaller dimension size like `bge-small-en-v1.5`. If accuracy is important, choose a model with more dimensions.\n\nCreate a `.env` file in the root directory of your project and add your Upstash Vector URL and token:\n\n```plaintext\nUPSTASH_VECTOR_REST_URL=https://example.upstash.io\nUPSTASH_VECTOR_REST_TOKEN=your_secret_token_here\n```\n\n### Using Semantic Cache\n\nHere’s how you can use Semantic Cache in your Node.js application:\n\n```typescript\nimport { SemanticCache } from \"@upstash/semantic-cache\";\nimport { Index } from \"@upstash/vector\";\n\n// 👇 your vector database\nconst index = new Index();\n\n// 👇 your semantic cache\nconst semanticCache = new SemanticCache({ index, minProximity: 0.95 });\n\nasync function runDemo() {\n  await semanticCache.set(\"Capital of Turkey\", \"Ankara\");\n  await delay(1000);\n\n  // 👇 outputs: \"Ankara\"\n  const result = await semanticCache.get(\"What is Turkey's capital?\");\n  console.log(result);\n}\n\nfunction delay(ms: number) {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nrunDemo();\n```\n\n### The `minProximity` Parameter\n\nThe `minProximity` parameter ranges from `0` to `1`. It lets you define the minimum relevance score to determine a cache hit. The higher this number, the more similar your user input must be to the cached content to be a hit. In practice, a score of 0.95 indicates a very high similarity, while a score of 0.75 already indicates a low similarity. For example, a value of 1.00, the highest possible, would only accept an _exact_ match of your user query and cache content as a cache hit.\n\n### Namespace Support\n\nYou can seperate your data into partitions with namespaces.\n\n```typescript\nimport { SemanticCache } from \"@upstash/semantic-cache\";\nimport { Index } from \"@upstash/vector\";\n\n// 👇 your vector database\nconst index = new Index();\n\n// 👇 your semantic cache\nconst semanticCache = new SemanticCache({ index, minProximity: 0.95, namespace: \"user1\" });\n\nawait semanticCache.set(\"Capital of Turkey\", \"Ankara\");\n```\n\n## Examples\n\nThe following examples demonstrate how you can utilize Semantic Cache in various use cases:\n\n> [!NOTE]  \n> We add a 1-second delay after setting the data to allow time for the vector index to update. This delay is necessary to ensure that the data is available for retrieval.\n\n### Basic Semantic Retrieval\n\n```typescript\nawait semanticCache.set(\"Capital of France\", \"Paris\");\nawait delay(1000);\n\n// 👇 outputs \"Paris\"\nconst result = await semanticCache.get(\"What's the capital of France?\");\n```\n\n### Handling Synonyms\n\n```typescript\nawait semanticCache.set(\"largest city in USA by population\", \"New York\");\nawait delay(1000);\n\n// 👇 outputs \"New York\"\nconst result = await semanticCache.get(\"which is the most populated city in the USA?\");\n```\n\n### Multilingual Queries\n\nNote: Your embedding model needs to support the languages you intend to use.\n\n```typescript\nawait semanticCache.set(\"German Chancellor\", \"Olaf Scholz\");\nawait delay(1000);\n\n// 👇 \"Who is the chancellor of Germany?\" -> outputs \"Olaf Scholz\"\nconst result = await semanticCache.get(\"Wer ist der Bundeskanzler von Deutschland?\");\n```\n\n### Complex Queries\n\n```typescript\nawait semanticCache.set(\"year in which the Berlin wall fell\", \"1989\");\nawait delay(1000);\n\n// 👇 outputs \"1989\"\nconst result = await semanticCache.get(\"what's the year the Berlin wall destroyed?\");\n```\n\n### Different Contexts\n\n```typescript\nawait semanticCache.set(\"the chemical formula for water\", \"H2O\");\nawait semanticCache.set(\"the healthiest drink on a hot day\", \"water\");\n\nawait delay(1000);\n\n// 👇 outputs \"water\"\nconst result = await semanticCache.get(\"what should i drink when it's hot outside?\");\n\n// 👇 outputs \"H2O\"\nconst result = await semanticCache.get(\"tell me water's chemical formula\");\n```\n\n## Contributing\n\nWe appreciate your contributions! If you'd like to contribute to this project, please fork the repository, make your changes, and submit a pull request.\n\n## License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n","readmeFilename":"readme.md"}