diff --git a/README.md b/README.md index 4ebcd78..4be6eee 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Code recipes for cooking with [Modus](https://github.com/hypermodeinc/modus), th ## 🚀 Getting started with Modus -For more infromation on getting started with Modus, check out [the docs](https://docs.hypermode.com/modus/overview). +For more information on getting started with Modus, check out [the docs](https://docs.hypermode.com/modus/overview). ## 📺 Video walkthroughs @@ -16,5 +16,6 @@ The following recipes have associated recorded content: | [modus-getting-started](modus-getting-started/) | [Getting Started With Modus video](https://www.youtube.com/watch?v=3CcJTXTmz88) | | [modushack-data-models](modushack-data-models/) | [ModusHack: Working With Data & AI Models livestream](https://www.youtube.com/watch?v=gB-v7YWwkCw&list=PLzOEKEHv-5e3zgRGzDysyUm8KQklHQQgi&index=3) | | [modus-press](modus-press/) | Coming soon | -| [dgraph-101](dgraph-101/) | [Working with Dgraph in Modus](https://youtu.be/Z2fB-nBf4Wo) | -| [function-calling](function-calling/) | [Use LLM function calling aka tools in Modus.](https://youtu.be/afFk7JzSIm0) | +| [dgraph-101](dgraph-101/) | [Working with Dgraph in Modus](https://youtu.be/Z2fB-nBf4Wo) | +| [function-calling](function-calling/) | [Use LLM function calling aka tools in Modus.](https://youtu.be/afFk7JzSIm0) | +| [instant-vector-search](instant-vector-search) | [Instant vector search with Modus & Hypermode](https://www.youtube.com/watch?v=4H_xPTUbwL8) | diff --git a/instant-vector-search/README.md b/instant-vector-search/README.md index 62e879b..4a5ae58 100644 --- a/instant-vector-search/README.md +++ b/instant-vector-search/README.md @@ -1,32 +1,32 @@ # instant-vector-search -A simplified template demonstrating how to build instant vector search using Hypermode and Modus. This project showcases how to configure collections, embed data, and deploy APIs to perform real-time vector search with minimal setup. +A simplified example demonstrating how to build instant vector search using Hypermode and Modus. This project showcases how to configure collections, embed data, and deploy APIs to perform real-time vector search with minimal setup. ## Guide -Check out the guide on how to create a project using this template: -[Instant Vector Search Guide](TODO) +Check out the blog post on how to create a project using this example: +[How to Build an Instant Vector Search App using Hypermode & Modus](https://hypermode.com/blog/instant-vector-search-guide) ## Semantic Search in Action -This template demonstrates how instant vector search can enhance your application by generating embeddings from user queries and performing vector searches in less than 200ms. +This example demonstrates how instant vector search can enhance your application by generating embeddings from user queries and performing vector searches in less than 200ms. ## How to Use the Template Fork or clone this repository to get started: -``` -git clone https://github.com/hypermodeinc/instant-vector-search.git -cd instant-vector-search +```bash +git clone https://github.com/hypermodeinc/modus-recipes.git +cd modus-recipes/instant-vector-search ``` Install Modus CLI: -``` +```bash npm install -g @hypermode/modus-cli ``` -## Initialize and deploy your app: +## Initialize and deploy your app You can deploy using either the Hypermode Console or Hyp CLI. @@ -37,10 +37,16 @@ Option 1: Hypermode Console Option 2: Hyp CLI -- Run the following command to import and deploy your app: +- Install the Hyp CLI +```bash +npm install -g @hypermode/hyp-cli ``` -hyp init + +- Run the following command to import and deploy your app: + +```bash +hyp link ``` ## Uploading Data @@ -57,7 +63,7 @@ Once your data is in place, the embeddings will be generated automatically, and You can test the API via the Query page in the Hypermode Console. Run a sample vector search query: -``` +```GraphQL query { search(query: "your search term here") } diff --git a/instant-vector-search/assembly/index.ts b/instant-vector-search/assembly/index.ts index 03a3312..7dc17fb 100644 --- a/instant-vector-search/assembly/index.ts +++ b/instant-vector-search/assembly/index.ts @@ -6,6 +6,9 @@ const textsCollection = "texts"; const searchMethod = "searchMethod1"; const embeddingModelName = "minilm"; +/** + * Add text(s) to the collection + */ export function upsertTexts(ids: string[], texts: string[]): string[] { const errors: string[] = []; @@ -24,6 +27,9 @@ export function upsertTexts(ids: string[], texts: string[]): string[] { return ids; } +/** + * Perform a vector search using an embedding of the input string + */ export function search(query: string): string[] { const searchResults = collections.search( textsCollection, @@ -48,6 +54,9 @@ export function search(query: string): string[] { return searchTexts; } +/** + * Embed the input text(s) using the miniLM embedding model + */ export function miniLMEmbed(texts: string[]): f32[][] { const model = models.getModel(embeddingModelName); const input = model.createInput(texts);