Skip to main content

Quickstart

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

Create a WCS account

  1. Go the WCS 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 WCS console.

Create a Weaviate Cluster

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

To create a cluster, click the 'Create cluster' button on the WCS 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. WCS 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, WCS 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.

Managed clusters

Managed clusters require billing details. WCS prompts you to add billing details if you have not already added them.

To create a managed cluster, follow these steps:

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

It takes a minute or two to create the new cluster. When the cluster is ready, WCS 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 WCS console includes a query interface, but most most WCS 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:

Add weaviate-client to your Python environment with pip.


Please use the v4 client with Weaviate 1.23.7 or higher.

pip install -U weaviate-client

Connect to your WCS instance

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

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

  1. Copy the sample client code to a file.
  2. Find your WCS cluster URL and API key in the WCS 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
import os

with weaviate.connect_to_wcs(
cluster_url=os.getenv("WCS_DEMO_URL"), # Replace with your WCS URL
auth_credentials=weaviate.auth.AuthApiKey(os.getenv("WCS_DEMO_RO_KEY")), # Replace with your WCS key
headers={'X-OpenAI-Api-key': os.getenv("OPENAI_APIKEY")} # Replace with your vectorizer API key
) 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 WCS 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

client = weaviate.connect_to_wcs(
cluster_url=os.getenv("WCS_URL"),
auth_credentials=weaviate.auth.AuthApiKey(os.getenv("WCS_API_KEY")),
headers={
"X-OpenAI-Api-Key": os.environ["OPENAI_APIKEY"] # Replace with your inference API key
}
)

try:
pass # Replace with your code. 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 managed cluster.
  • To learn how Weaviate can help you build your project, review the Weaviate documentation.

Support

For questions and support, try the following resources:

Weaviate also offers paid support services. If you have a contract with Weaviate, contact your sales representative for details.