---
title: "Generative and reranker models"
description: "Configure generative and reranker models for collections with code in Python, TypeScript, Go, Java, and C#."
url: https://docs.weaviate.io/weaviate/manage-collections/generative-reranker-models
---

# Generative and reranker models

> [!TIP]
>
> **Embedding models / Vectorizers**
>
> Visit the [Vectorizer and vector config](https://docs.weaviate.io/weaviate/manage-collections/vector-config) guide to find out how to configure an embedding model for your collection or to fine-tune the vector index settings.

## Specify a reranker model integration

Configure a [`reranker`](https://docs.weaviate.io/weaviate/concepts/search#rerank) model integration for [reranking retrieved results](https://docs.weaviate.io/weaviate/search/rerank).

> [!NOTE]
>
> **Related pages**
>
> - [Available reranker model integrations](https://docs.weaviate.io/weaviate/model-providers)

**Python**

```py
from weaviate.classes.config import Configure, Property, DataType

client.collections.create(
    "Article",
    vector_config=Configure.Vectors.text2vec_openai(),
    reranker_config=Configure.Reranker.cohere(),
)
```

**JavaScript/TypeScript**

```ts
import { vectors, reranker } from '@weaviate/node';

await client.collections.create({
  name: 'Article',
  vectorizers: vectors.text2VecOpenAI(),
  reranker: reranker.cohere(),
})
```

**Go (v5)**

```go
  articleClass := &models.Class{
    Class:       "Article",
    Description: "Collection of articles",
    Vectorizer:  "text2vec-openai",
    ModuleConfig: map[string]interface{}{
      "reranker-cohere": map[string]interface{}{
        "model": "rerank-v3.5",
      },
    },
  }
```

**Go (v6)**

```go
// Coming soon
```

**Java**

```java
client.collections.create("Article",
    col -> col.vectorConfig(VectorConfig.text2vecTransformers())
        .rerankerModules(Reranker.cohere())
        .properties(Property.text("title")));
```

**C#**

```csharp
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        VectorConfig = Configure.Vector("default", v => v.Text2VecTransformers()),
        RerankerConfig = Configure.Reranker.Cohere(),
        Properties = [Property.Text("title")],
    }
);
```

## Update the reranker model integration

> [!NOTE]
>
> **Available from `v1.25.23`, `v1.26.8` and `v1.27.1`**
>
> The `reranker` and `generative` configurations are mutable from `v1.25.23`, `v1.26.8` and `v1.27.1`.

Update the [`reranker`](https://docs.weaviate.io/weaviate/concepts/search#rerank) model integration for [reranking retrieved results](https://docs.weaviate.io/weaviate/search/rerank).

**Python**

```py
from weaviate.classes.config import Reconfigure

collection = client.collections.use("Article")

collection.config.update(
    reranker_config=Reconfigure.Reranker.cohere()  # Update the reranker module
)
```

**JavaScript/TypeScript**

```ts
import { reconfigure } from '@weaviate/node';

  const collection = client.collections.use('Article')

  await collection.config.update({
    reranker: reconfigure.reranker.voyageAI()  // Update the reranker module
  })
```

**Go (v5)**

```go
  updatedArticleClassConfig := &models.Class{
    // Note: The new collection config must be provided in full,
    // including the configuration that is not being updated.
    // We suggest using the original class config as a starting point.
    Class: "Article",
    ModuleConfig: map[string]interface{}{
      "reranker-cohere": map[string]interface{}{
        "model": "rerank-v3.5",
      },
    },
  }
```

**Go (v6)**

```go
// Coming soon
```

**Java**

```java
var collection = client.collections.use("Article");
collection.config.update(col -> col.rerankerModules(Reranker.cohere()));
```

**C#**

```csharp
var collection = client.Collections.Use("Article");
await collection.Config.Update(c =>
{
    c.RerankerConfig = Configure.Reranker.Cohere();
});
```

## Specify a generative model integration

Specify a `generative` model integration for a collection (for RAG).

> [!NOTE]
>
> **Related pages**
>
> - [Available generative model integrations](https://docs.weaviate.io/weaviate/model-providers)

**Python**

```py
from weaviate.classes.config import Configure, Property, DataType

client.collections.create(
    "Article",
    vector_config=Configure.Vectors.text2vec_openai(),
    generative_config=Configure.Generative.openai(
        model="gpt-4o"  # set your generative model (optional parameter)
    ),
)
```

**JavaScript/TypeScript**

```ts
import { vectors, generative } from '@weaviate/node';

await client.collections.create({
  name: 'Article',
  vectorizers: vectors.text2VecOpenAI(),
  generative: generative.openAI({
    model: "gpt-4o"  // set your generative model (optional parameter)
  }),
})
```

**Go (v5)**

```go
  articleClass := &models.Class{
    Class:       "Article",
    Description: "Collection of articles",
    Vectorizer:  "text2vec-openai",
    ModuleConfig: map[string]interface{}{
      "generative-openai": map[string]interface{}{
        "model": "gpt-4o",
      },
    },
  }
```

**Go (v6)**

```go
// Coming soon
```

**Java**

```java
client.collections.create("Article",
    col -> col.vectorConfig(VectorConfig.text2vecTransformers())
        .generativeModule(Generative.cohere())
        .properties(Property.text("title")));
```

**C#**

```csharp
await client.Collections.Create(
    new CollectionCreateParams
    {
        Name = "Article",
        VectorConfig = Configure.Vector("default", v => v.Text2VecTransformers()),
        GenerativeConfig = Configure.Generative.Cohere(),
        Properties = [Property.Text("title")],
    }
);
```

## Update the generative model integration

> [!NOTE]
>
> **Available from `v1.25.23`, `v1.26.8` and `v1.27.1`**
>
> The `reranker` and `generative` configurations are mutable from `v1.25.23`, `v1.26.8` and `v1.27.1`.

Update a [`generative`](https://docs.weaviate.io/weaviate/concepts/search#retrieval-augmented-generation-rag) model integration.

**Python**

```py
from weaviate.classes.config import Reconfigure

collection = client.collections.use("Article")

collection.config.update(
    generative_config=Reconfigure.Generative.cohere()  # Update the generative module
)
```

**JavaScript/TypeScript**

```ts
import { reconfigure } from '@weaviate/node';

const collection = client.collections.use("Article")

await collection.config.update({
  generative: weaviate.reconfigure.generative.openAI()  // Update the generative module
})
```

**Go (v5)**

```go
  updatedArticleClassConfig := &models.Class{
    Class: "Article",
    ModuleConfig: map[string]interface{}{
      "generative-cohere": map[string]interface{}{},
    },
  }
```

**Go (v6)**

```go
// Coming soon
```

**Java**

```java
var collection = client.collections.use("Article");
collection.config.update(col -> col.generativeModule(Generative.cohere()));
```

**C#**

```csharp
var collection = client.Collections.Use("Article");
await collection.Config.Update(c =>
{
    c.GenerativeConfig = Configure.Generative.Cohere();
});
```

> [!TIP]
>
> You can [override the generative integration settings at query time](https://docs.weaviate.io/weaviate/search/generative#configure-a-generative-model-provider) without updating it in the collection configuration.

## Further resources

- [API References: REST: Schema](https://docs.weaviate.io/weaviate/api/rest#tag/schema/post/schema)

- [References: Configuration: Schema](https://docs.weaviate.io/weaviate/config-refs/collections)

- [Concepts: Data structure](https://docs.weaviate.io/weaviate/concepts/data)
