# Weaviate

The **Weaviate Node** in Stack AI is used to query a Weaviate vector database. Weaviate is a popular open-source vector database that allows you to store and search data using vector embeddings, which is especially useful for semantic search, recommendation systems, and AI-powered retrieval tasks.

Here’s a detailed explanation of Vector Search in Weaviate and how to establish a connection in Stack AI:

***

### Available Actions

**Vector Search** in Weaviate allows you to search for objects (such as documents, images, or data entries) that are most similar to a given query, using vector embeddings. This is especially useful for semantic search, recommendations, and AI-powered retrieval.

#### How the "Vector Search" Action Works

* **Action Name:** Vector Search
* **Provider:** Weaviate
* **Purpose:** Search for similar vectors in a Weaviate database.

**Required Input Parameters**

1. **Class Name** (`class_name`):\
   The name of the Weaviate class (collection/table) you want to search in.\
   \&#xNAN;*Example: "Article", "Document", "Product"*
2. **Properties** (`properties`):\
   Comma-separated list of properties to return in the results.\
   \&#xNAN;*Example: "title,description,url"*
3. **Query** (`query`):\
   The search query (text) to find similar vectors.\
   \&#xNAN;*Example: "AI workflow automation"*
4. **Number of Results** (`top_k`):\
   How many results to return.\
   \&#xNAN;*Example: 5 or 10*

**Output**

* **Results** (`results`):\
  The results of the vector search query, typically a list of objects with the requested properties.

***

### How to Establish a Connection to Weaviate

To connect Stack AI to your Weaviate instance, you need to provide connection details. Here’s how:

1. **Connection ID:**\
   If you have a private Weaviate instance, you’ll need a connection ID. This is usually set up in your Stack AI integrations or connections panel.
   * In the action node’s `action_configurations`, add:

     ```json
     { "connection_id": "<your-weaviate-connection-id>" }
     ```
   * If you’re using the default Stack AI Weaviate instance, you may not need to set this.
2. **Configure the Action Node:**
   * Set the required input parameters (`class_name`, `properties`, `query`, `top_k`).
   * If you want to use dynamic input (e.g., from an Input node or LLM), reference the node like `{in-0}` or `{llm-0}` in the `query` field.

***

### Summary Table

| Parameter      | Description                                   | Example Value            |
| -------------- | --------------------------------------------- | ------------------------ |
| class\_name    | Weaviate class to search                      | "Article"                |
| properties     | Properties to return (comma-separated)        | "title,description,url"  |
| query          | Search query (text or node reference)         | "AI workflow automation" |
| top\_k         | Number of results to return                   | 5                        |
| connection\_id | (Optional) Connection ID for private Weaviate | "abc123-connection-id"   |

How to Use the Weaviate Node

1. **Connect to a Weaviate Database**: You typically need to configure the node with a connection to your Weaviate instance (this may require a connection ID if you have a private instance).
2. **Set Query Parameters**: Define what you want to search for—this usually involves providing a query vector or text, and specifying parameters like the number of results (`top_k`), the class or collection to search, and any filters.
3. **Input Data**: The node can take input from other nodes (like an LLM or Input node) to dynamically generate queries.
4. **Use Output**: The results from the Weaviate node can be passed to downstream nodes, such as an LLM for summarization or an Output node for display.

#### Example Workflow

* User provides a search query (Input node).
* The query is embedded (optionally by an LLM or embedding node).
* The Weaviate node performs a vector search using the embedding.
* The results are passed to an LLM for summarization or directly to the Output node.

#### When to Use the Weaviate Node

* When you need to perform advanced, AI-powered search over large datasets.
* When you want to build applications that require semantic understanding, such as chatbots, document search, or recommendation engines.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stackai.com/workflow-builder/apps/weaviate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
