Skip to main content

Quickstart

This Quickstart guide shows you how to get started with Weaviate Cloud (WCD).

Create a WCD account

  1. Go the WCD homepage.
  2. Click, "Register here".

Create an account

  1. Provide an email address and password.
  2. After you confirm your email address, return to the login page.
  3. Log in to the WCD console.

Create a Weaviate Cluster

When you log into the WCD web console, the Dashboard tab lists your clusters. There are no clusters when you log in to a new account. WCD has short-term, sandbox clusters and permanent, serverless clusters.

To create a cluster, click the 'Create cluster' button on the WCD Dashboard page.

Create a cluster

Follow the steps to create a cluster:

Sandbox clusters

To create a sandbox cluster, follow these steps:

  1. Select the "Free sandbox" tab.
  2. Give your cluster a name. WCD adds a random suffix to sandbox cluster names to ensure uniqueness.
  3. Verify that "Enable Authentication?" is set to "Yes".
  4. Click create.

It takes a minute or two to create the new cluster. When the cluster is ready, WCD displays a check mark (✔️) next to the cluster name.

Sandbox expiration

The sandbox is free for 14 days. After 14 days, the sandbox expires and all data is deleted.

To retrieve a copy of your sandbox data before it is deleted, use the cursor API.

To preserve your data and upgrade to a paid instance, contact us for help.

Serverless clusters

Serverless clusters require billing details. WCD prompts you to add billing details if you have not already added them.

To create a serverless cluster, follow these steps:

  1. Select the "Managed cluster" tab.
  2. Give your cluster a name.
  3. Select a version.
  4. Select a region.
  5. Accept the terms and conditions.
  6. Click create.

It takes a minute or two to create the new cluster. When the cluster is ready, WCD displays a check mark (✔️) next to the cluster name.

Explore the Details panel

The Details panel lists cluster metrics, authorization details, and other useful information. To access your cluster, you need the cluster URL and authentication details.

To get the cluster URL and authentication details, follow these steps:

  1. Click the Details button to open the Details panel.

Details button

  1. To get the API keys, click the API keys button.

Details expanded

  1. Copy the API key for the Admin user to a safe place.

API key

  1. The cluster URL begins with the cluster name. Copy it to a safe place.

Cluster URL

Install a client library

The WCD console includes a query interface, but most most WCD interactions rely on a Weaviate client. Clients are available in several programming languages. Chose one that makes sense for your project.

To install a client, follow these steps for your language:

Install the latest, Python client v4, by adding weaviate-client to your Python environment with pip:

pip install -U weaviate-client

Connect to your WCD instance

These code samples demonstrate how to connect a Weaviate client to your WCD cluster.

To connect to your cluster, follow these steps for your language:

  1. Copy the sample client code to a file.
  2. Find your WCD cluster URL and API key in the WCD Console.
  3. Create environment variables, or edit the sample code, to pass the URL and API keys to your client.
  4. Run the client code.
import weaviate
from weaviate.classes.init import Auth
import os

# Best practice: store your credentials in environment variables
wcd_url = os.environ["WCD_DEMO_URL"]
wcd_api_key = os.environ["WCD_DEMO_RO_KEY"]
openai_api_key = os.environ["OPENAI_APIKEY"]

with weaviate.connect_to_weaviate_cloud(
cluster_url=wcd_url, # Replace with your Weaviate Cloud URL
auth_credentials=Auth.api_key(wcd_api_key), # Replace with your Weaviate Cloud key
headers={
'X-OpenAI-Api-key': openai_api_key # Replace with appropriate header key/value pair for the required API
}
) as client: # Use this context manager to ensure the connection is closed
print(client.is_ready())

If you are connected, the server returns True.

Define a collection

Weaviate stores objects in collections. Every collection has a schema. Collection schemas are highly configurable, but some properties cannot be changed after you create the collection. For best results, define a collection schema before you import your data.

To create a schema for the Question collection, follow these steps in your client code:

  1. Create a client connection.
  2. Add the collection definition code after the client creation code.
  3. Run the code.
    questions = client.collections.create(
name="Question",
vectorizer_config=wvc.config.Configure.Vectorizer.text2vec_openai(), # If set to "none" you must always provide vectors yourself. Could be any other "text2vec-*" also.
generative_config=wvc.config.Configure.Generative.openai() # Ensure the `generative-openai` module is used for generative queries
)

The collection has these properties:

  • Collection name: Question
  • Vectorizer module: text2vec-openai
  • Generative module: generative-openai

Load data

This example code downloads a small data set and uploads it to your WCD instance. The example assumes your collection has a schema already defined.

To upload the data, follow these steps in your client code:

  1. Create a client connection.
  2. Add the batch import code after the client creation code.
  3. Run the code.
    resp = requests.get('https://raw.githubusercontent.com/weaviate-tutorials/quickstart/main/data/jeopardy_tiny.json')
data = json.loads(resp.text) # Load data

question_objs = list()
for i, d in enumerate(data):
question_objs.append({
"answer": d["Answer"],
"question": d["Question"],
"category": d["Category"],
})

questions = client.collections.get("Question")
questions.data.insert_many(question_objs)

Query your data

Weaviate supports a variety of search methods. A near_text search vectorizes the search string and returns objects that have vectors that are most similar to it. This example performs a nearText search on the Question data collection.

To search for objects in the Question collection that have vectors that are similar to the vector for biology, run this example code:

import weaviate
import weaviate.classes as wvc
import os

# Best practice: store your credentials in environment variables
wcd_url = os.environ["WCD_DEMO_URL"]
wcd_api_key = os.environ["WCD_DEMO_RO_KEY"]
openai_api_key = os.environ["OPENAI_APIKEY"]

client = weaviate.connect_to_weaviate_cloud(
cluster_url=wcd_url, # Replace with your Weaviate Cloud URL
auth_credentials=wvc.init.Auth.api_key(wcd_api_key), # Replace with your Weaviate Cloud key
headers={"X-OpenAI-Api-Key": openai_api_key} # Replace with appropriate header key/value pair for the required API
)

try:
pass # Work with the client. Close client gracefully in the finally block.
questions = client.collections.get("Question")

response = questions.query.near_text(
query="biology",
limit=2
)

print(response.objects[0].properties) # Inspect the first object

finally:
client.close() # Close client gracefully

The results are similar to this:

{
"data": {
"Get": {
"Question": [
{
"answer": "DNA",
"category": "SCIENCE",
"question": "In 1953 Watson & Crick built a model of the molecular structure of this, the gene-carrying substance"
},
{
"answer": "Liver",
"category": "SCIENCE",
"question": "This organ removes excess glucose from the blood & stores it as glycogen"
}
]
}
}
}

Next steps

  • If you want to try out Weaviate and don't need to save your work, continue with a sandbox cluster.
  • If you want to build with Weaviate or if you need a persistent cluster, enter your billing details and create a serverless cluster.
  • To learn how Weaviate can help you build your project, review the Weaviate documentation.

Support

For help with Serverless, Enterprise SaaS, and Bring Your Own Cloud accounts, contact Weaviate support directly to open a support ticket.

For questions and support from the Weaviate community, try these resources:

To add a support plan, contact Weaviate sales.