# Generative and reranker models

:::callout{intent="tip" title="Embedding models / Vectorizers"}
Visit the [Vectorizer and vector config](vector-config.md) 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`](../search/index.md#rerank) model integration for [reranking retrieved results](../how-to-query-search/rerank.md).

:::callout{intent="info" title="Related pages"}
- [Available reranker model integrations](../model-provider-integrations/index.md)
:::

:::code-group{sync="languages"}
```python title="Python" {6}
from weaviate.classes.config import Configure, Property, DataType

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

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

```go title="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",
    },
  },
}
```

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

```csharp title="C#"
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

:::callout{intent="info" title="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`](../search/index.md#rerank) model integration for [reranking retrieved results](../how-to-query-search/rerank.md).

:::code-group{sync="languages"}
```python title="Python" {6}
from weaviate.classes.config import Reconfigure

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

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

```typescript title="JavaScript/TypeScript"
import { reconfigure } from 'weaviate-client';
```

```go title="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",
    },
  },
}
```

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

```csharp title="C#"
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).

:::callout{intent="info" title="Related pages"}
- [Available generative model integrations](../model-provider-integrations/index.md)
:::

:::code-group{sync="languages"}
```python title="Python" {6-8}
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)
    ),
)
```

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

```go title="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",
    },
  },
}
```

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

```csharp title="C#"
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

:::callout{intent="info" title="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`](../search/index.md#retrieval-augmented-generation-rag) model integration.

:::code-group{sync="languages"}
```python title="Python" {6}
from weaviate.classes.config import Reconfigure

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

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

```typescript title="JavaScript/TypeScript"
import { reconfigure } from 'weaviate-client';
```

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

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

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

:::callout{intent="tip"}
You can [override the generative integration settings at query time](../how-to-query-search/generative.md#configure-a-generative-model-provider) without updating it in the collection configuration.
:::

## Further resources

- [API References: REST: Schema](/weaviate/api/rest#tag/schema/post/schema)
- [References: Configuration: Schema](../reference-configuration/collections.md)
- [Concepts: Data structure](../concepts/data.md)

## 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`.
