recipes-ts
recipes-ts copied to clipboard
This repository shares end-to-end scripts on how to use various Weaviate features and integrations!

Welcome to Weaviate JavaScript Recipes π
This repo covers end-to-end examples of various features and integrations with Weaviate for JavaScript Developers!
π‘ This repo can also be used online with Replit
What are recipes?
Recipes are end-to-end scripts showing various features and integrations. Recipes are a reference for what using the Weaviate client can look like.
Concepts Covered πΊοΈ
Here are some of the concepts this repository covers:
Similarity Search π
Similarity Search leverages various machine learning models to perform searches based on semantic similarity. In Weaviate, this is done with query.nearText, query.nearObject and query.nearVector operators.
Generative Search β¨οΈ
Generative Search allows you to improve your search results by piping them through LLM models to perform RAG. In Weaviate, this is done with generate.nearText, generate.nearObject and generate.nearVector operators.
β οΈ Before getting started, you need to follow the installation Setup Instructions detailed in the setup section of this document. You will need the setup completed to successfully run the recipes.
π Setup Instructions
π Run on Replit
1. Open on recipes on Replit
Navigate to the recipes Replit and fork it.
2. Run in Weaviate Cloud Service
Head to WCS, where you can easily create a free sandbox cluster.
Take note of your cluster URL and apiKey and add them to your .env file as WEAVIATE_URL and WEAVIATE_ADMIN_KEY respectively.
3. Define environment variables
The .env.example file contains all the environment variables you would need to run the recipes.
Go to each provider website to create and copy your environment variables, e.g. access your Cohere variables here.
cp .env_example .env
Now you're ready to run a recipe!
π‘ Run locally
1. Install npm packages
Clone this repository, and install the project dependencies
npm install
2. Run locally using Docker
Considering you already have docker installed, follow along our Docker installation guide. Then run the command below to start your Weaviate server.
docker compose up -d
β οΈ When using Docker, remember to update all the
connectToWeaviateCloud()methods toconnectToLocal().
IMPORTANT: Make sure to define your environment variables before running Docker
3. Define environment variables
The .env.example file contains all the environment variables you would need to run the recipes.
Go to each provider website to create and copy your environment variables, e.g. access your Cohere
variables here.
cp .env_example .env
Now you're ready to run a recipe!
Run a Recipe!
Recipes are organized by concepts using folders (i.e. similarity search). Each concept folder has multiple folders showing its implementation with various model providers (i.e. Cohere, Mistral AI etc).
Provider subfolders contain relevant scripts and a README.md file with details on how to run each specific recipe.
To run a recipe, navigate to the concept you are interested in and select a provider to run it with. Follow the instructions in the README.md file and you should be good to go.
β οΈ Remember to add the relevant API keys to your
.envfiles
Feedback β
Please note this is an ongoing project, and updates will be made frequently. If you have a feature you would like to see, please drop it in the Weaviate Forum or open an issue.