This tutorial shows you how to connect your Weaviate cluster and perform semantic search with PromptQL.
We'll be using the Cohere API key to create embeddings for our unstructured data via Weaviate Client. We also need the Weaviate Cloud URL and Weaviate API Key. Both can be obtained from Weaviate Cloud.
In your project directory, add the key to your .env
file.
First, copy the env.sample
file to .env
cp env.sample .env
Now, update the API Keys
APP_PYTHON_COHERE_API_KEY='....'
APP_PYTHON_WCD_URL='....'
APP_PYTHON_WCD_API_KEY='....'
Note: Feel free to modify the embedding configuration in Weaviate Client to use something other than Cohere and configure the API key accordingly.
After configuring the .env
values with the above credentials, continue with the data loading.
Head to app/connector/python
and execute
python3 load-data.py
This will create a movie collection and load sample movie data with vector embedding using Cohere.
In app/connector/python/functions.py
, add additional functions based on requirements.
We already have two functions.
semantic_search
and keyword_search
. They are exposed as functions to PromptQL.
Make sure Docker is running, then execute:
ddn connector introspect python
Tip: Run in debug mode with the --log-level DEBUG
to understand what is going on with the introspection:
Create your supergraph build locally:
ddn supergraph build local
ddn run docker-start
Run the following from your project's directory:
ddn console --local
Now, you can ask semantic questions on your data:
> Movies with dystopian future
> Historical movies