Weaviate is an open-source vector database built to power AI applications. This quickstart guide will show you how to:

1. **Set up a collection** - Create a collection and import data into it.
2. **Search** - Perform a similarity (vector) search on your data.
3. **RAG** - Perform Retrieval Augmented Generation (RAG) with a generative model.

If you encounter any issues along the way or have additional questions, use the Ask AI feature.

## Prerequisites

Before we get started, install [Docker](https://docs.docker.com/get-started/get-docker/) on your machine.
We will be running Weaviate and Ollama language models locally. We recommend that you use a modern computer with at least 8GB of RAM, preferably 16GB or more.

:::callout{intent="note" title="Telemetry"}
To help us improve Weaviate and understand community usage trends, Weaviate collects telemetry data by default. To learn more or opt-out, click [here](../monitoring-and-logging/telemetry.md).
:::

***

## Start Weaviate and Ollama with Docker Compose

Save the following code to a file named `docker-compose.yml` in your project directory.

```yaml
services:
  weaviate:
    command:
    - --host
    - 0.0.0.0
    - --port
    - '8080'
    - --scheme
    - http
    image: cr.weaviate.io/semitechnologies/weaviate:1.38.2
    ports:
    - 8080:8080
    - 50051:50051
    volumes:
    - weaviate_data:/var/lib/weaviate
    restart: on-failure:0
    environment:
      AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true'
      PERSISTENCE_DATA_PATH: '/var/lib/weaviate'
      ENABLE_MODULES: 'text2vec-ollama,generative-ollama'
      CLUSTER_HOSTNAME: 'node1'
      OLLAMA_API_ENDPOINT: 'http://ollama:11434'
    depends_on:
      - ollama

  ollama:
    image: ollama/ollama:0.12.9
    ports:
      - "11434:11434"
    volumes:
      - ollama_data:/root/.ollama

volumes:
  weaviate_data:
  ollama_data:
```

Run the following command to start a Weaviate instance and the Ollama server inside Docker containers:

```bash
docker-compose up -d
```

Once the Ollama service starts, you can pull the required embedding model ([`nomic-embed-text`](https://ollama.com/library/nomic-embed-text)) and generative model ([`llama3.2`](https://ollama.com/library/llama3.2)) in the `ollama` container:

```bash
docker compose exec ollama ollama pull nomic-embed-text
docker compose exec ollama ollama pull llama3.2
```

***

## Install a client library

Follow the instructions below to install one of the official client libraries, available in [Python](../client-libraries/python.md), [JavaScript/TypeScript](../client-libraries/typescript.md), [Go](../client-libraries/go.md), and [Java](../client-libraries/java.md).

:::code-group{sync="languages"}
```bash title="Python"
pip install -U "weaviate-client[agents]"
```

```bash title="JavaScript/TypeScript"
npm install weaviate-client weaviate-agents
```

```bash title="Go"
go get github.com/weaviate/weaviate-go-client/v5
```

```xml title="Java"
<dependency>
  <groupId>io.weaviate</groupId>
  <artifactId>client6</artifactId>
  <version>6.2.0</version> <!-- Check latest version: https://github.com/weaviate/java-client  -->
</dependency>
```

```xml title="C#"
<PackageReference Include="Weaviate.Client" Version="1.0.0" />
```
:::

## Step 1: Create a collection & import data

There are two paths you can choose from when importing data:

::::card-grid
:::card{title="Vectorize objects during import (recommended)" href="?import=vectorization#create-a-collection" icon="refresh-cw"}
Import objects and vectorize them with the Ollama embedding model.
:::

:::card{title="Import vectors" href="?import=custom-embeddings#create-a-collection" icon="waypoints"}
Import pre-computed vector embeddings along with your data.
:::
::::

::::::tabs{sync="import" param="import"}
:::::tab{title="Vectorize objects during import"}
The following example creates a collection called `Movie` with the [Ollama](../model-provider-integrations/ollama-embeddings.md) embedding model provider (`text2vec-ollama`) for vectorizing data during import and for querying. You are also free to use any other available [embedding model provider](../model-provider-integrations/index.md).

::::tabs{sync="languages"}
:::tab{title="Python"}
```python
import weaviate
from weaviate.classes.config import Configure

# Step 1.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:
```
:::

:::tab{title="JavaScript/TypeScript"}
```typescript
import weaviate, { WeaviateClient, vectors } from 'weaviate-client';

// Step 1.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();
```
:::

:::tab{title="Go"}
The collection also contains a configuration for the generative (RAG) integration:

- Ollama [generative AI integrations](../model-provider-integrations/ollama-generative.md) for retrieval augmented generation (RAG).

```goraw
import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate/entities/models"
)

func main() {
  // Step 1.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }
```
:::

:::tab{title="Java"}
```javaraw
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
import io.weaviate.client6.v1.api.collections.batch.BatchContext;

import java.util.List;
import java.util.Map;

public class QuickstartLocalCreate {

  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;
    String collectionName = "Movie";

    try {
      // Step 1.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();
```
:::

:::tab{title="C#"}
```csharp
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Weaviate.Client;
using Weaviate.Client.Models;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalCreate
    {
        public static async Task Run()
        {
            string collectionName = "Movie";

            // Step 1.1: Connect to your local Weaviate instance
            var client = await Connect.Local();
```
:::
::::
:::::

:::::tab{title="Import vectors"}
The following example creates a collection called `Movie`. The data should already contain the pre-computed vector embeddings (Vector embeddings generated by an embedding model (from a provider like OpenAI, Anthropic, etc.).). This option is useful for when you are migrating data from a different vector database.

::::tabs{sync="languages"}
:::tab{title="Python"}
```python
import weaviate
from weaviate.classes.config import Configure
from weaviate.classes.data import DataObject

# Step 1.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:
```
:::

:::tab{title="JavaScript/TypeScript"}
```typescript
import weaviate, { WeaviateClient, vectors } from 'weaviate-client';

// Step 1.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();
```
:::

:::tab{title="Go"}
The collection also contains a configuration for the generative (RAG) integration:

- Ollama [generative AI integrations](../model-provider-integrations/ollama-generative.md) for retrieval augmented generation (RAG).

```goraw
import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate/entities/models"
)

func main() {
  // Step 1.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }
```
:::

:::tab{title="Java"}
```javaraw
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import io.weaviate.client6.v1.api.collections.Property;
import io.weaviate.client6.v1.api.collections.VectorConfig;
import io.weaviate.client6.v1.api.collections.Vectors;
import io.weaviate.client6.v1.api.collections.WeaviateObject;
import io.weaviate.client6.v1.api.collections.batch.BatchContext;
import java.util.List;
import java.util.Map;

public class QuickstartLocalCreateVectors {

  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;
    String collectionName = "Movie";

    try {
      // Step 1.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();
```
:::

:::tab{title="C#"}
```csharp
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Weaviate.Client;
using Weaviate.Client.Models;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalCreateVectors
    {
        public static async Task Run()
        {
            string collectionName = "Movie";

            // Step 1.1: Connect to your local Weaviate instance
            var client = await Connect.Local();
```
:::
::::
:::::
::::::

## Step 2: Semantic (vector) search

:::::tabs{sync="import" param="import"}
::::tab{title="Vectorize objects during import"}
Semantic search finds results based on meaning. This is called `nearText` in Weaviate. The following example searches for 2 objects (_limit_) whose meaning is most similar to that of `sci-fi`.

:::code-group{sync="languages"}
```python title="Python"
import weaviate
import json

# Step 2.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:

    # Step 2.2: Use this collection
    movies = client.collections.use("Movie")

    # Step 2.3: Perform a semantic search with NearText
    # highlight-start
```

```typescript title="JavaScript/TypeScript" {10-15}
import weaviate, { WeaviateClient } from 'weaviate-client';

// Step 2.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();

// Step 2.2: Use this collection
const movies = client.collections.get('Movie');

// Step 2.3: Perform a semantic search with NearText
const response = await movies.query.nearText(
  'sci-fi',
  {
    limit: 2,
  }
);

for (const obj of response.objects) {
  console.log(JSON.stringify(obj.properties, null, 2)); // Inspect the results
}

await client.close(); // Free up resources
```

```goraw title="Go" {22-34}
import (
  "context"
  "encoding/json"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate-go-client/v5/weaviate/graphql"
)

func main() {
  // Step 1.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }

  // Step 2.2: Perform a semantic search with NearText
  title := graphql.Field{Name: "title"}
  description := graphql.Field{Name: "description"}
  genre := graphql.Field{Name: "genre"}

  nearText := client.GraphQL().NearTextArgBuilder().
    WithConcepts([]string{"sci-fi"})

  result, err := client.GraphQL().Get().
    WithClassName("Movie").
    WithNearText(nearText).
    WithLimit(2).
    WithFields(title, description, genre).
    Do(context.Background())

  if err != nil {
    panic(err)
  }

  // Inspect the results
  if result.Errors != nil {
    fmt.Printf("Error: %v\n", result.Errors)
    return
  }

  data := result.Data["Get"].(map[string]interface{})
  movies := data["Movie"].([]interface{})

  for _, movie := range movies {
    jsonData, err := json.MarshalIndent(movie, "", "  ")
    if err != nil {
      panic(err)
    }
    fmt.Println(string(jsonData))
  }
```

```javaraw title="Java" {20-21}
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import com.fasterxml.jackson.databind.ObjectMapper; // For pretty-printing JSON

import java.util.Map;

public class QuickstartLocalQueryNearText {
  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;

    try {
      // Step 2.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();

      // Step 2.2: Perform a semantic search with NearText
      CollectionHandle<Map<String, Object>> movies =
          client.collections.use("Movie");
      ObjectMapper objectMapper = new ObjectMapper();

      var response = movies.query.nearText("sci-fi",
          q -> q.limit(2).returnProperties("title", "description", "genre"));

      // Inspect the results
      System.out.println("--- Query Results ---");
      for (var obj : response.objects()) {
        System.out.println(objectMapper.writerWithDefaultPrettyPrinter()
            .writeValueAsString(obj.properties()));
      }
    } finally {
      if (client != null) {
        client.close(); // Free up resources
      }
    }
  }
}
```

```csharp title="C#" {18-22}
using System;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Weaviate.Client;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalQueryNearText
    {
        public static async Task Run()
        {
            // Step 2.1: Connect to your local Weaviate instance
            var client = await Connect.Local();

            // Step 2.2: Perform a semantic search with NearText
            var movies = client.Collections.Use("Movie");
            var response = await movies.Query.NearText(
                "sci-fi",
                limit: 2,
                returnProperties: ["title", "description", "genre"]
            );

            // Inspect the results
            Console.WriteLine("--- Query Results ---");
            foreach (var obj in response.Objects)
            {
                Console.WriteLine(
                    JsonSerializer.Serialize(
                        obj.Properties,
                        new JsonSerializerOptions { WriteIndented = true }
                    )
                );
            }
        }
    }
}
```
:::
::::

::::tab{title="Import vectors"}
Semantic search finds results based on meaning. This is called `nearVector` in Weaviate. The following example searches for 2 objects (_limit_) whose vector is most similar to the query vector.

:::code-group{sync="languages"}
```python title="Python"
import weaviate
import json

# Step 2.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:

    # Step 2.2: Use this collection
    movies = client.collections.use("Movie")

    # Step 2.3: Perform a vector search with NearVector
    # highlight-start
```

```typescript title="JavaScript/TypeScript" {10-15}
import weaviate, { WeaviateClient } from 'weaviate-client';

// Step 2.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();

// Step 2.2: Use this collection
const movies = client.collections.get('Movie');

// Step 2.3: Perform a vector search with NearVector
const response = await movies.query.nearVector(
  [0.11, 0.21, 0.31, 0.41, 0.51, 0.61, 0.71, 0.81],
  {
    limit: 2,
  }
);

for (const obj of response.objects) {
  console.log(JSON.stringify(obj.properties, null, 2)); // Inspect the results
}

await client.close(); // Free up resources
```

```goraw title="Go" {22-34}
import (
  "context"
  "encoding/json"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate-go-client/v5/weaviate/graphql"
)

func main() {
  // Step 1.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }

  // Step 2.2: Perform a vector search with NearVector
  title := graphql.Field{Name: "title"}
  description := graphql.Field{Name: "description"}
  genre := graphql.Field{Name: "genre"}

  nearVector := client.GraphQL().NearVectorArgBuilder().
    WithVector([]float32{0.11, 0.21, 0.31, 0.41, 0.51, 0.61, 0.71, 0.81})

  result, err := client.GraphQL().Get().
    WithClassName("Movie").
    WithNearVector(nearVector).
    WithLimit(2).
    WithFields(title, description, genre).
    Do(context.Background())

  if err != nil {
    panic(err)
  }

  // Inspect the results
  if result.Errors != nil {
    fmt.Printf("Error: %v\n", result.Errors)
    return
  }

  data := result.Data["Get"].(map[string]interface{})
  movies := data["Movie"].([]interface{})

  for _, movie := range movies {
    jsonData, err := json.MarshalIndent(movie, "", "  ")
    if err != nil {
      panic(err)
    }
    fmt.Println(string(jsonData))
  }
```

```javaraw title="Java" {20-25}
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import com.fasterxml.jackson.databind.ObjectMapper; // For pretty-printing JSON

import java.util.Map;

public class QuickstartLocalQueryNearVector {
  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;

    try {
      // Step 2.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();

      // Step 2.2: Perform a vector search with NearVector
      CollectionHandle<Map<String, Object>> movies =
          client.collections.use("Movie");
      ObjectMapper objectMapper = new ObjectMapper();

      // Use primitive float[] for v6
      float[] queryVector =
          new float[] {0.11f, 0.21f, 0.31f, 0.41f, 0.51f, 0.61f, 0.71f, 0.81f};

      var response = movies.query.nearVector(queryVector,
          q -> q.limit(2).returnProperties("title", "description", "genre"));

      // Inspect the results
      System.out.println("--- Query Results ---");
      for (var obj : response.objects()) {
        System.out.println(objectMapper.writerWithDefaultPrettyPrinter()
            .writeValueAsString(obj.properties()));
      }
    } finally {
      if (client != null) {
        client.close(); // Free up resources
      }
    }
  }
}
```

```csharp title="C#" {18-24}
using System;
using System.Text.Json;
using System.Threading.Tasks;
using Weaviate.Client;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalQueryNearVector
    {
        public static async Task Run()
        {
            // Step 2.1: Connect to your local Weaviate instance
            var client = await Connect.Local();

            // Step 2.2: Perform a vector search with NearVector
            var movies = client.Collections.Use("Movie");

            float[] queryVector = [0.11f, 0.21f, 0.31f, 0.41f, 0.51f, 0.61f, 0.71f, 0.81f];

            var response = await movies.Query.NearVector(
                queryVector,
                limit: 2,
                returnProperties: ["title", "description", "genre"]
            );

            // Inspect the results
            Console.WriteLine("--- Query Results ---");
            foreach (var obj in response.Objects)
            {
                Console.WriteLine(
                    JsonSerializer.Serialize(
                        obj.Properties,
                        new JsonSerializerOptions { WriteIndented = true }
                    )
                );
            }
        }
    }
}
```
:::
::::
:::::

:::accordion{title="Example response"}
```json
{
  "genre": "Science Fiction",
  "title": "The Matrix",
  "description": "A computer hacker learns about the true nature of reality and his role in the war against its controllers."
}
{
  "genre": "Fantasy",
  "title": "The Lord of the Rings: The Fellowship of the Ring",
  "description": "A meek Hobbit and his companions set out on a perilous journey to destroy a powerful ring and save Middle-earth."
}
```
:::

:::callout{intent="tip" title="Query Agent"}
Try the [Query Agent](../agents/overview.md) with a Weaviate Cloud instance. You simply provide a prompt/question in natural language, and the Query Agent takes care of all the needed steps to provide an answer.
:::

## Step 3: Retrieval augmented generation (RAG)

:::::tabs{sync="import" param="import"}
::::tab{title="Vectorize objects during import"}
Retrieval augmented generation (RAG), also called generative search, works by prompting a large language model (LLM) with a combination of a _user query_ and _data retrieved from a database_.

The following example combines the semantic search for the query `sci-fi` with a prompt to generate a tweet using the Ollama generative model (`generative-ollama`).

:::code-group{sync="languages"}
```python title="Python"
import weaviate
from weaviate.classes.generate import GenerativeConfig

# Step 2.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:
```

```typescript title="JavaScript/TypeScript" {10-22}
import weaviate, { WeaviateClient, generativeParameters } from 'weaviate-client';

// Step 2.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();

// Step 2.2: Use this collection
const movies = client.collections.get('Movie');

// Step 2.3: Perform RAG with on NearText results
const response = await movies.generate.nearText(
  'sci-fi',
  {
    groupedTask: 'Write a tweet with emojis about this movie.',
    config: generativeParameters.ollama({
      apiEndpoint: 'http://ollama:11434',  // If using Docker you might need: http://host.docker.internal:11434
      model: 'llama3.2',                   // The model to use
    }),
  },
  {
    limit: 1,
  }
);

console.log(response.generative); // Inspect the results

await client.close(); // Free up resources
```

```goraw title="Go" {21-36}
import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate-go-client/v5/weaviate/graphql"
)

func main() {
  // Step 2.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }

  // Step 2.2: Perform RAG with NearText results
  title := graphql.Field{Name: "title"}
  description := graphql.Field{Name: "description"}
  genre := graphql.Field{Name: "genre"}

  nearText := client.GraphQL().NearTextArgBuilder().
    WithConcepts([]string{"sci-fi"})

  generate := graphql.NewGenerativeSearch().GroupedResult("Write a tweet with emojis about this movie.")

  result, err := client.GraphQL().Get().
    WithClassName("Movie").
    WithNearText(nearText).
    WithLimit(1).
    WithFields(title, description, genre).
    WithGenerativeSearch(generate).
    Do(context.Background())

  if err != nil {
    panic(err)
  }

  // Inspect the results
  if result.Errors != nil {
    fmt.Printf("Error: %v\n", result.Errors)
    return
  }

  fmt.Printf("%v", result)
```

```javaraw title="Java" {18-25}
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import io.weaviate.client6.v1.api.collections.generate.GenerativeProvider;
import java.util.Map;

public class QuickstartLocalQueryNearTextRAG {
  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;

    try {
      // Step 2.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();

      // Step 2.2: Perform RAG with nearText results
      CollectionHandle<Map<String, Object>> movies =
          client.collections.use("Movie");

      var response = movies.generate.nearText("sci-fi",
          q -> q.limit(1).returnProperties("title", "description", "genre"),
          // Generative configuration (RAG task)
          g -> g.groupedTask("Write a tweet with emojis about this movie.",
              p -> p.generativeProvider(
                  GenerativeProvider.ollama(o -> o.apiEndpoint("http://ollama:11434")// If using Docker you might need: http://host.docker.internal:11434
                      .model("llama3.2") // The model to use
                  ))));

      // Inspect the results
      System.out.println(response.generative().text());

    } finally {
      if (client != null) {
        client.close(); // Free up resources
      }
    }
  }
}
```

```csharp title="C#" {20-30}
using System;
using System.Text.Json;
using System.Threading.Tasks;
using Weaviate.Client;
using Weaviate.Client.Models;
using Weaviate.Client.Models.Generative;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalQueryNearTextRAG
    {
        public static async Task Run()
        {
            // Step 3.1: Connect to your local Weaviate instance
            var client = await Connect.Local();

            // Step 3.2: Perform RAG with nearText results
            var movies = client.Collections.Use("Movie");

            var response = await movies.Generate.NearText(
                "sci-fi",
                limit: 1,
                returnProperties: ["title", "description", "genre"],
                groupedTask: new GroupedTask("Write a tweet with emojis about this movie."),
                provider: new Providers.Ollama
                {
                    ApiEndpoint = "http://ollama:11434", // If using Docker you might need: http://host.docker.internal:11434
                    Model = "llama3.2", // The model to use
                }
            );

            // Inspect the results
            Console.WriteLine(JsonSerializer.Serialize(response.Generative.Values));
        }
    }
}
```
:::
::::

::::tab{title="Import vectors"}
Retrieval augmented generation (RAG), also called generative search, works by prompting a large language model (LLM) with a combination of a _user query_ and _data retrieved from a database_.

The following example combines the vector similarity search with a prompt to generate a tweet using the Ollama generative model (`generative-ollama`).

:::code-group{sync="languages"}
```python title="Python"
import weaviate
from weaviate.classes.generate import GenerativeConfig

# Step 2.1: Connect to your local Weaviate instance
with weaviate.connect_to_local() as client:
```

```typescript title="JavaScript/TypeScript" {10-22}
import weaviate, { WeaviateClient, generativeParameters } from 'weaviate-client';

// Step 2.1: Connect to your local Weaviate instance
const client: WeaviateClient = await weaviate.connectToLocal();

// Step 2.2: Use this collection
const movies = client.collections.get('Movie');

// Step 2.3: Perform RAG with on NearVector results
const response = await movies.generate.nearVector(
  [0.11, 0.21, 0.31, 0.41, 0.51, 0.61, 0.71, 0.81],
  {
    groupedTask: 'Write a tweet with emojis about this movie.',
    config: generativeParameters.ollama({
      apiEndpoint: 'http://ollama:11434',  // If using Docker you might need: http://host.docker.internal:11434
      model: 'llama3.2',                   // The model to use
    }),
  },
  {
    limit: 1,
  }
);

console.log(response.generative); // Inspect the results

await client.close(); // Free up resources
```

```goraw title="Go" {21-36}
import (
  "context"
  "fmt"

  "github.com/weaviate/weaviate-go-client/v5/weaviate"
  "github.com/weaviate/weaviate-go-client/v5/weaviate/graphql"
)

func main() {
  // Step 2.1: Connect to your local Weaviate instance
  cfg := weaviate.Config{
    Host:   "localhost:8080",
    Scheme: "http",
  }
  client, err := weaviate.NewClient(cfg)
  if err != nil {
    panic(err)
  }

  // Step 2.2: Perform RAG with NearText results
  title := graphql.Field{Name: "title"}
  description := graphql.Field{Name: "description"}
  genre := graphql.Field{Name: "genre"}

  nearVector := client.GraphQL().NearVectorArgBuilder().
    WithVector([]float32{0.11, 0.21, 0.31, 0.41, 0.51, 0.61, 0.71, 0.81})

  generate := graphql.NewGenerativeSearch().GroupedResult("Write a tweet with emojis about this movie.")

  result, err := client.GraphQL().Get().
    WithClassName("Movie").
    WithNearVector(nearVector).
    WithLimit(1).
    WithFields(title, description, genre).
    WithGenerativeSearch(generate).
    Do(context.Background())

  if err != nil {
    panic(err)
  }

  // Inspect the results
  if result.Errors != nil {
    fmt.Printf("Error: %v\n", result.Errors)
    return
  }

  fmt.Printf("%v", result)
```

```javaraw title="Java" {18-29}
import io.weaviate.client6.v1.api.WeaviateClient;
import io.weaviate.client6.v1.api.collections.CollectionHandle;
import io.weaviate.client6.v1.api.collections.generate.GenerativeProvider;
import java.util.Map;

public class QuickstartLocalQueryNearVectorRAG {
  public static void main(String[] args) throws Exception {
    WeaviateClient client = null;

    try {
      // Step 2.1: Connect to your local Weaviate instance
      client = WeaviateClient.connectToLocal();

      // Step 2.2: Perform RAG with NearVector results
      CollectionHandle<Map<String, Object>> movies =
          client.collections.use("Movie");

      // Use primitive float[] for v6
      float[] queryVector =
          new float[] {0.11f, 0.21f, 0.31f, 0.41f, 0.51f, 0.61f, 0.71f, 0.81f};

      var response = movies.generate.nearVector(queryVector,
          q -> q.limit(1).returnProperties("title", "description", "genre"),
          // Generative configuration (RAG task)
          g -> g.groupedTask("Write a tweet with emojis about this movie.",
              p -> p.generativeProvider(
                  GenerativeProvider.ollama(o -> o.apiEndpoint("http://ollama:11434")// If using Docker you might need: http://host.docker.internal:11434
                      .model("llama3.2") // The model to use
                  ))));

      // Inspect the results
      // Use .generative() to access the generative result
      System.out.println(response.generative().text());

    } finally {
      if (client != null) {
        client.close(); // Free up resources
      }
    }
  }
}
```

```csharp title="C#" {20-32}
using System;
using System.Text.Json;
using System.Threading.Tasks;
using Weaviate.Client;
using Weaviate.Client.Models;
using Weaviate.Client.Models.Generative;

namespace WeaviateProject.Examples
{
    public class QuickstartLocalQueryNearVectorRAG
    {
        public static async Task Run()
        {
            // Step 3.1: Connect to your local Weaviate instance
            var client = await Connect.Local();

            // Step 3.2: Perform RAG with NearVector results
            var movies = client.Collections.Use("Movie");

            float[] queryVector = [0.11f, 0.21f, 0.31f, 0.41f, 0.51f, 0.61f, 0.71f, 0.81f];

            var response = await movies.Generate.NearVector(
                vectors: queryVector,
                limit: 1,
                returnProperties: ["title", "description", "genre"],
                groupedTask: new GroupedTask("Write a tweet with emojis about this movie."),
                provider: new Providers.Ollama
                {
                    ApiEndpoint = "http://ollama:11434", // If using Docker you might need: http://host.docker.internal:11434
                    Model = "llama3.2", // The model to use
                }
            );

            // Inspect the results
            Console.WriteLine(JsonSerializer.Serialize(response.Generative.Values));
        }
    }
}
```
:::
::::
:::::

:::accordion{title="Example response"}
```json
🕶️ Unplug from the system & join Neo's journey 💊🐰

"The Matrix" will blow your mind 🤯 as reality unravels 🌀

Kung-fu, slow-mo & mind-bending sci-fi 🥋🕴️

Are you ready to see how deep the rabbit hole goes? 🔴🔵 #TheMatrix #WakeUp
```
:::

## Next steps

We recommend you check out the following resources to continue learning about Weaviate.

::::card-grid
:::card{title="Quick tour of Weaviate" href="/guides/guides-tutorials-quick-tour-of-weaviate" icon="signpost"}
Continue with the **Quick tour tutorial** – an end-to-end guide that covers important topics like configuring collections, searches, etc.
:::

:::card{title="Weaviate Academy" href="https://academy.weaviate.io/" icon="graduation-cap"}
Check out **Weaviate Academy** – a learning platform centered around AI-native development.
:::

:::card{title="How-to manuals" href="/guides/guides-guides" icon="book-open"}
Quick examples of how to configure, manage and query Weaviate using client libraries.
:::

:::card{title="Starter guides" href="/guides/starter-guides-index" icon="compass"}
Guides and tips for new users learning how to use Weaviate.
:::
::::

## Questions and feedback

Have a question or feedback? Here's how to reach us.

::::card-grid
:::card{title="Community Forum" href="https://forum.weaviate.io/c/support" icon="messages-square"}
Ask questions and connect with other developers on our **Community forum**.
:::

:::card{title="Support" href="/guides/support-overview" icon="life-buoy"}
Weaviate Cloud user or customer? Find the right channel on the **Support page**.
:::
::::

## Related pages

- [Agents](./agents-index.md)
- [AI-assisted Weaviate code generation](./ai-assisted-vibe-coding-index.md)
- [APIs](./apis-index.md)
- [Authorization and authentication](./authorization-and-authentication-index.md)
- [Benchmarks](./benchmarks-index.md)
- [Best practices](./best-practices-index.md)
- [Client libraries](./clients-index.md)
- [Client Libraries / SDKs](./client-libraries-index.md)
- [Cloud](./cloud-index.md)
- [Cloud account management](./cloud-account-management-index.md)

# Agent Instructions

This portal answers questions programmatically. To receive a synthesized,
source-cited answer instead of crawling page by page, append the `?ask=`
query parameter to any page URL on this site:

    /guides/quickstart?ask=how+do+I+authenticate

Optional parameters:

- `&goal=<what-you-are-trying-to-do>` steers the answer toward your
  objective (e.g. `&goal=write+a+python+client`).
- `&version=<label>` scopes the answer to a mounted version when the
  portal publishes more than one.

The response is `text/markdown`: the answer followed by a `# Sources` list
of the portal pages it was grounded in. Status codes are the contract:

- `200` — the answer; `402` — the portal owner’s plan or answer credits are
  exhausted (surface this to your operator; do NOT retry); `429` — you are
  rate-limited; back off for the `Retry-After` seconds; `503` — the answer
  lane is temporarily unavailable; fall back to crawling the `.md` pages.

For the full corpus map read `llms.txt` at the site root; for the tool
surface (search + page fetch as MCP tools) see `/mcp`.
