Option 1: Weaviate Cloud
Here, you will create a Weaviate Cloud instance. Weaviate Cloud is a fully managed Weaviate instance that runs in the cloud. It simplifies the process of using Weaviate, as you don't have to worry about installation or maintenance.
Log in to the Weaviate Cloud console
Go to the Weaviate Cloud console and log in with your credentials, or sign up as required.
Create a Weaviate instance
Find the "Clusters" tab, click the plus button, and select the Free option. A free cluster is free forever and needs no credit card, which makes it ideal for this course. Give it a name and click "Create cluster". This should take a few minutes.
Retrieve your Weaviate instance details
Once the instance is created, you will be able see its details selecting the cluster.
Retrieve its (REST) URL, and the API key. You may need to create a new API key here. If so, make sure to assign an admin role to the key.
You will need these details to connect to your Weaviate instance.
For more detailed instructions on creating a Weaviate Cloud instance, refer to the Weaviate Cloud documentation.
Connect to your Weaviate Cloud instance
To connect to the Weaviate Cloud instance, you need to use the cluster URL and the API key. You can find these details in the Weaviate Cloud console.
Use the connect_to_weaviate_cloud function to connect to your instance.
Some Weaviate modules can use inference APIs for vectorizing data or generative AI model integration. You can provide the API keys for these services to Weaviate at instantiation.
This course uses Cohere, so you can provide the Cohere API key to Weaviate through headers={"X-Cohere-Api-Key": <YOUR_KEY>}.
Putting it together, connect to Weaviate with code like this shown below:
import weaviate
import os
headers = {
"X-Cohere-Api-Key": os.getenv("COHERE_APIKEY")
} # Replace with your Cohere API key
client = weaviate.connect_to_weaviate_cloud(
cluster_url=os.getenv("WEAVIATE_URL"), # Replace with your Weaviate Cloud URL
auth_credentials=os.getenv("WEAVIATE_API_KEY"), # Replace with your Weaviate Cloud key
headers=headers,
)
Use this snippet every time you connect to your Weaviate instance in this course. For brevity, this is shown as follows in the subsequent lessons:
client = weaviate.connect_to_weaviate_cloud(...)
You are now set up with a Weaviate Cloud instance to use with Python and the Weaviate Python client library. You can review the next lesson to see how to create a local Docker instance.
Or, skip to the subsequent lesson to see how to connect to Weaviate and verify the connection.